Patch "Bluetooth: L2CAP: do not leave dangling sk pointer on error in l2cap_sock_create()" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    Bluetooth: L2CAP: do not leave dangling sk pointer on error in l2cap_sock_create()

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     bluetooth-l2cap-do-not-leave-dangling-sk-pointer-on-.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit d916a23061e21b5d1cf60a4ab8f8747c556fbb16
Author: Ignat Korchagin <ignat@xxxxxxxxxxxxxx>
Date:   Mon Oct 14 16:38:01 2024 +0100

    Bluetooth: L2CAP: do not leave dangling sk pointer on error in l2cap_sock_create()
    
    [ Upstream commit 7c4f78cdb8e7501e9f92d291a7d956591bf73be9 ]
    
    bt_sock_alloc() allocates the sk object and attaches it to the provided
    sock object. On error l2cap_sock_alloc() frees the sk object, but the
    dangling pointer is still attached to the sock object, which may create
    use-after-free in other code.
    
    Signed-off-by: Ignat Korchagin <ignat@xxxxxxxxxxxxxx>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>
    Reviewed-by: Eric Dumazet <edumazet@xxxxxxxxxx>
    Link: https://patch.msgid.link/20241014153808.51894-3-ignat@xxxxxxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 9eea2af9a8e1c..6ec6f6a06521d 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -1678,6 +1678,7 @@ static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock,
 	chan = l2cap_chan_create();
 	if (!chan) {
 		sk_free(sk);
+		sock->sk = NULL;
 		return NULL;
 	}
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux