IB/cma: Add a missing rcu_read_unlock()

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 f887f2ac87).
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>
This commit is contained in:
Bart Van Assche 2015-11-20 11:04:12 -08:00 committed by Doug Ledford
parent 8f5ba10ed4
commit d3632493c7
1 changed files with 1 additions and 4 deletions

View File

@ -1126,10 +1126,7 @@ static bool validate_ipv4_net_dev(struct net_device *net_dev,
rcu_read_lock(); rcu_read_lock();
err = fib_lookup(dev_net(net_dev), &fl4, &res, 0); err = fib_lookup(dev_net(net_dev), &fl4, &res, 0);
if (err) ret = err == 0 && FIB_RES_DEV(res) == net_dev;
return false;
ret = FIB_RES_DEV(res) == net_dev;
rcu_read_unlock(); rcu_read_unlock();
return ret; return ret;