Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7e5cc0c authored by Lothar Waßmann's avatar Lothar Waßmann Committed by David S. Miller
Browse files

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: default avatarLothar Wassmann <LW@KARO-electronics.de>
Acked-by: default avatarOliver Hartkopp <oliver@hartkopp.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 252aa9d9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);

+3 −0
Original line number Diff line number Diff line
@@ -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);