diff options
author | Lothar Waßmann <LW@KARO-electronics.de> | 2009-07-14 23:10:21 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-07-15 18:20:37 (GMT) |
commit | f7e5cc0c40dff92bad2894153f675c6c542ba2f0 (patch) | |
tree | bd7e85854edeb3271f9a29f021392d7fdcc08bed /net | |
parent | 252aa9d94a04252046f3a382e6aca1b5c95921d8 (diff) | |
download | linux-f7e5cc0c40dff92bad2894153f675c6c542ba2f0.tar.xz |
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')
-rw-r--r-- | net/can/bcm.c | 3 | ||||
-rw-r--r-- | net/can/raw.c | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/net/can/bcm.c b/net/can/bcm.c index 95d7f32..1d17e41 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -1469,6 +1469,9 @@ static int bcm_release(struct socket *sock) bo->ifindex = 0; } + sock_orphan(sk); + sock->sk = NULL; + release_sock(sk); sock_put(sk); diff --git a/net/can/raw.c b/net/can/raw.c index 6aa154e..3482546 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); |