aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Van Assche <[email protected]>2015-11-20 11:04:12 -0800
committerDoug Ledford <[email protected]>2015-12-08 12:14:43 -0500
commitd3632493c70b6a866a77264cd8cfdeb89958b906 (patch)
tree5413e996b53a1a1aeaf98440b5ab672a4260084f
parent8f5ba10ed40a9d3ffe84854984227d011a7428bd (diff)
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 f887f2ac87c2). Cc: Haggai Eran <[email protected]> Cc: stable <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Haggai Eran <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
-rw-r--r--drivers/infiniband/core/cma.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 944cd90417bc..d2d5d004f16d 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -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;