linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IB/cma: Add a missing rcu_read_unlock()
@ 2015-11-20 19:04 Bart Van Assche
       [not found] ` <564F6EAC.7070608-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Van Assche @ 2015-11-20 19:04 UTC (permalink / raw)
  To: Doug Ledford
  Cc: Haggai Eran, linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

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/w@public.gmane.org>
Cc: stable <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
---
 drivers/infiniband/core/cma.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

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;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] IB/cma: Add a missing rcu_read_unlock()
       [not found] ` <564F6EAC.7070608-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
@ 2015-11-21  2:20   ` Sagi Grimberg
  2015-11-22  8:10   ` Haggai Eran
  2015-11-23 18:47   ` Jason Gunthorpe
  2 siblings, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2015-11-21  2:20 UTC (permalink / raw)
  To: Bart Van Assche, Doug Ledford
  Cc: Haggai Eran, linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org


> 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/w@public.gmane.org>
> Cc: stable <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>

Looks good,

Reviewed-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] IB/cma: Add a missing rcu_read_unlock()
       [not found] ` <564F6EAC.7070608-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
  2015-11-21  2:20   ` Sagi Grimberg
@ 2015-11-22  8:10   ` Haggai Eran
  2015-11-23 18:47   ` Jason Gunthorpe
  2 siblings, 0 replies; 4+ messages in thread
From: Haggai Eran @ 2015-11-22  8:10 UTC (permalink / raw)
  To: Bart Van Assche, Doug Ledford
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

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-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Cc: stable <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>

Thanks.

Reviewed-by: Haggai Eran <haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] IB/cma: Add a missing rcu_read_unlock()
       [not found] ` <564F6EAC.7070608-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
  2015-11-21  2:20   ` Sagi Grimberg
  2015-11-22  8:10   ` Haggai Eran
@ 2015-11-23 18:47   ` Jason Gunthorpe
  2 siblings, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2015-11-23 18:47 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Doug Ledford, Haggai Eran, Or Gerlitz,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

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-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Cc: stable <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
>  drivers/infiniband/core/cma.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)

Yep

Reviewed-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-23 18:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-20 19:04 [PATCH] IB/cma: Add a missing rcu_read_unlock() Bart Van Assche
     [not found] ` <564F6EAC.7070608-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-11-21  2:20   ` Sagi Grimberg
2015-11-22  8:10   ` Haggai Eran
2015-11-23 18:47   ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).