summaryrefslogtreecommitdiffstats
path: root/net/can/raw.c
diff options
context:
space:
mode:
authorLothar Waßmann <LW@KARO-electronics.de>2009-07-15 01:10:21 +0200
committerDavid S. Miller <davem@davemloft.net>2009-07-15 20:20:37 +0200
commitf7e5cc0c40dff92bad2894153f675c6c542ba2f0 (patch)
treebd7e85854edeb3271f9a29f021392d7fdcc08bed /net/can/raw.c
parentRevert "NET: Fix locking issues in PPP, 6pack, mkiss and strip line disciplin... (diff)
downloadlinux-f7e5cc0c40dff92bad2894153f675c6c542ba2f0.tar.xz
linux-f7e5cc0c40dff92bad2894153f675c6c542ba2f0.zip
net/can bugfix: use after free bug in can protocol drivers
Fix a use after free bug in can protocol drivers The release functions of the can protocol drivers lack a call to sock_orphan() which leads to referencing freed memory under certain circumstances. This patch fixes a bug reported here: https://lists.berlios.de/pipermail/socketcan-users/2009-July/000985.html Signed-off-by: Lothar Wassmann <LW@KARO-electronics.de> Acked-by: Oliver Hartkopp <oliver@hartkopp.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/can/raw.c')
-rw-r--r--net/can/raw.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/can/raw.c b/net/can/raw.c
index 6aa154e806ae..3482546e8884 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -306,6 +306,9 @@ static int raw_release(struct socket *sock)
ro->bound = 0;
ro->count = 0;
+ sock_orphan(sk);
+ sock->sk = NULL;
+
release_sock(sk);
sock_put(sk);