Skip to contentSkip to conversation

IB/cma: Add a missing rcu_read_unlock()

PATCH In review Bart Van Assche 4 participants 4 messages Nov 20, 2015 – Nov 23, 2015 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 <haggaie-VPRAkNaXOzVWk0Htik3J/[email protected]>
Cc stable <[email protected]>
---
 drivers/infiniband/core/cma.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/infiniband/core/cma.c +1 -4
index 69e5477..f8dfc63 100644
@@ -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;
Signature · 6 lines
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

Reviewed-by
#2 lore raw
Quoted 7 lines

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 <haggaie-VPRAkNaXOzVWk0Htik3J/[email protected]>
Cc stable <[email protected]>

Looks good,

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Reviewed-by
#3 lore raw
In reply to a message not in the archive
Quoted 6 lines · Bart Van Assche

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 <haggaie-VPRAkNaXOzVWk0Htik3J/[email protected]>
Cc stable <[email protected]>

Thanks.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Reviewed-by
#4 lore raw
In reply to a message not in the archive
Quoted 8 lines · Bart Van Assche

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 <haggaie-VPRAkNaXOzVWk0Htik3J/[email protected]>
Cc stable <[email protected]>
 drivers/infiniband/core/cma.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Yep

You say sparse detected this? Mellanox/Or folks - I thought you ran all the common static stuff on your patches?

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html