Message ID | 564F6EAC.7070608@sandisk.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
> 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@mellanox.com> > Cc: stable <stable@vger.kernel.org> Looks good, Reviewed-by: Sagi Grimberg <sagig@mellanox.com> -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 20/11/2015 21:04, Bart Van Assche wrote: > 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@mellanox.com> > Cc: stable <stable@vger.kernel.org> Thanks. Reviewed-by: Haggai Eran <haggaie@mellanox.com> -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, Nov 20, 2015 at 11:04:12AM -0800, Bart Van Assche wrote: > 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@mellanox.com> > Cc: stable <stable@vger.kernel.org> > drivers/infiniband/core/cma.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) Yep Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> 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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 69e5477..f8dfc63 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;