Skip to content

Commit

Permalink
IB/cma: Add a missing rcu_read_unlock()
Browse files Browse the repository at this point in the history
Ensure that validate_ipv4_net_dev() calls rcu_read_unlock() if
fib_lookup() fails. Detected by sparse. Compile-tested only.

Fixes: "IB/cma: Validate routing of incoming requests" (commit f887f2a).
Cc: Haggai Eran <haggaie@mellanox.com>
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: Haggai Eran <haggaie@mellanox.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

Signed-off-by: Doug Ledford <dledford@redhat.com>
  • Loading branch information
Bart Van Assche authored and Doug Ledford committed Dec 8, 2015
1 parent 8f5ba10 commit d363249
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/infiniband/core/cma.c
Original file line number Diff line number Diff line change
Expand Up @@ -1126,10 +1126,7 @@ static bool validate_ipv4_net_dev(struct net_device *net_dev,

rcu_read_lock();
err = fib_lookup(dev_net(net_dev), &fl4, &res, 0);
if (err)
return false;

ret = FIB_RES_DEV(res) == net_dev;
ret = err == 0 && FIB_RES_DEV(res) == net_dev;
rcu_read_unlock();

return ret;
Expand Down

0 comments on commit d363249

Please sign in to comment.