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

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: can: add missing socket check in can/raw release.
  2011-04-20 11:46 can: add missing socket check in can/raw release Oliver Hartkopp
@ 2011-04-20 19:02 ` David Miller
  2011-04-20 19:04   ` Dave Jones
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2011-04-20 19:02 UTC (permalink / raw)
  To: socketcan; +Cc: netdev, davej

From: Oliver Hartkopp <socketcan@hartkopp.net>
Date: Wed, 20 Apr 2011 13:46:40 +0200

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

I already applied Dave's patch from last night.

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

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

On Wed, Apr 20, 2011 at 12:02:18PM -0700, David Miller wrote:
 > From: Oliver Hartkopp <socketcan@hartkopp.net>
 > Date: Wed, 20 Apr 2011 13:46:40 +0200
 > 
 > > 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>
 > 
 > I already applied Dave's patch from last night.

This is in a different path.

	Dave

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

end of thread, other threads:[~2011-04-20 19:04 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:46 can: add missing socket check in can/raw release Oliver Hartkopp
2011-04-20 19:02 ` David Miller
2011-04-20 19:04   ` Dave Jones

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