netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] can: add missing socket check in can/raw release
@ 2011-04-20 11:57 Oliver Hartkopp
  2011-04-20 17:03 ` Dave Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Oliver Hartkopp @ 2011-04-20 11:57 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Dave Jones

v2: added space after 'if' according code style.

We can get here with a NULL socket argument passed from userspace,
so we need to handle it accordingly.

Thanks to Dave Jones pointing at this issue in net/can/bcm.c

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>

---

diff --git a/net/can/raw.c b/net/can/raw.c
index 649acfa..8f215e6 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -305,7 +305,12 @@ static int raw_init(struct sock *sk)
 static int raw_release(struct socket *sock)
 {
 	struct sock *sk = sock->sk;
-	struct raw_sock *ro = raw_sk(sk);
+	struct raw_sock *ro;
+
+	if (!sk)
+		return 0;
+
+	ro = raw_sk(sk);

 	unregister_netdevice_notifier(&ro->notifier);


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

* Re: [PATCH v2] can: add missing socket check in can/raw release
  2011-04-20 11:57 [PATCH v2] can: add missing socket check in can/raw release Oliver Hartkopp
@ 2011-04-20 17:03 ` Dave Jones
  2011-04-20 19:22   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Jones @ 2011-04-20 17:03 UTC (permalink / raw)
  To: Oliver Hartkopp; +Cc: David Miller, netdev

On Wed, Apr 20, 2011 at 01:57:15PM +0200, Oliver Hartkopp wrote:
 > v2: added space after 'if' according code style.
 > 
 > We can get here with a NULL socket argument passed from userspace,
 > so we need to handle it accordingly.
 > 
 > Thanks to Dave Jones pointing at this issue in net/can/bcm.c
 > 
 > Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>

ACK. That was the first thing I hit this morning ;-)

	Dave


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

* Re: [PATCH v2] can: add missing socket check in can/raw release
  2011-04-20 17:03 ` Dave Jones
@ 2011-04-20 19:22   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2011-04-20 19:22 UTC (permalink / raw)
  To: davej; +Cc: socketcan, netdev

From: Dave Jones <davej@redhat.com>
Date: Wed, 20 Apr 2011 13:03:34 -0400

> On Wed, Apr 20, 2011 at 01:57:15PM +0200, Oliver Hartkopp wrote:
>  > v2: added space after 'if' according code style.
>  > 
>  > We can get here with a NULL socket argument passed from userspace,
>  > so we need to handle it accordingly.
>  > 
>  > Thanks to Dave Jones pointing at this issue in net/can/bcm.c
>  > 
>  > Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
> 
> ACK. That was the first thing I hit this morning ;-)

Aha, so this patch fixes the same bug in a different part of CAN,
I missed that :-)

Ok I'll apply this, thanks!

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

end of thread, other threads:[~2011-04-20 19:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-20 11:57 [PATCH v2] can: add missing socket check in can/raw release Oliver Hartkopp
2011-04-20 17:03 ` Dave Jones
2011-04-20 19:22   ` David Miller

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).