Patch "can: isotp: check CAN address family in isotp_bind()" 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

    can: isotp: check CAN address family in isotp_bind()

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:
     can-isotp-check-can-address-family-in-isotp_bind.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 c211cbc2a3e6e64698240b11164b56d91a57b30d
Author: Oliver Hartkopp <socketcan@xxxxxxxxxxxx>
Date:   Wed Jan 4 21:18:44 2023 +0100

    can: isotp: check CAN address family in isotp_bind()
    
    [ Upstream commit c6adf659a8ba85913e16a571d5a9bcd17d3d1234 ]
    
    Add missing check to block non-AF_CAN binds.
    
    Syzbot created some code which matched the right sockaddr struct size
    but used AF_XDP (0x2C) instead of AF_CAN (0x1D) in the address family
    field:
    
    bind$xdp(r2, &(0x7f0000000540)={0x2c, 0x0, r4, 0x0, r2}, 0x10)
                                    ^^^^
    This has no funtional impact but the userspace should be notified about
    the wrong address family field content.
    
    Link: https://syzkaller.appspot.com/text?tag=CrashLog&x=11ff9d8c480000
    Reported-by: syzbot+5aed6c3aaba661f5b917@xxxxxxxxxxxxxxxxxxxxxxxxx
    Signed-off-by: Oliver Hartkopp <socketcan@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/all/20230104201844.13168-1-socketcan@xxxxxxxxxxxx
    Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/can/isotp.c b/net/can/isotp.c
index fc81d77724a13..9bc344851704e 100644
--- a/net/can/isotp.c
+++ b/net/can/isotp.c
@@ -1220,6 +1220,9 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len)
 	if (len < ISOTP_MIN_NAMELEN)
 		return -EINVAL;
 
+	if (addr->can_family != AF_CAN)
+		return -EINVAL;
+
 	/* sanitize tx CAN identifier */
 	if (tx_id & CAN_EFF_FLAG)
 		tx_id &= (CAN_EFF_FLAG | CAN_EFF_MASK);



[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