Patch "net: af_can: do not leave a dangling sk pointer in can_create()" has been added to the 6.1-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

    net: af_can: do not leave a dangling sk pointer in can_create()

to the 6.1-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:
     net-af_can-do-not-leave-a-dangling-sk-pointer-in-can.patch
and it can be found in the queue-6.1 subdirectory.

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



commit 810e46d8df029b584e902b518d44111297d46422
Author: Ignat Korchagin <ignat@xxxxxxxxxxxxxx>
Date:   Mon Oct 14 16:38:03 2024 +0100

    net: af_can: do not leave a dangling sk pointer in can_create()
    
    [ Upstream commit 811a7ca7320c062e15d0f5b171fe6ad8592d1434 ]
    
    On error can_create() frees the allocated sk object, but sock_init_data()
    has already attached it to the provided sock object. This will leave a
    dangling sk pointer in the sock object and may cause use-after-free later.
    
    Signed-off-by: Ignat Korchagin <ignat@xxxxxxxxxxxxxx>
    Reviewed-by: Vincent Mailhol <mailhol.vincent@xxxxxxxxxx>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>
    Reviewed-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
    Link: https://patch.msgid.link/20241014153808.51894-5-ignat@xxxxxxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/can/af_can.c b/net/can/af_can.c
index c69168f11e44a..7d8543e877b44 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -171,6 +171,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
 		/* release sk on errors */
 		sock_orphan(sk);
 		sock_put(sk);
+		sock->sk = NULL;
 	}
 
  errout:




[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