Patch "can: isotp: return -EADDRNOTAVAIL when reading from unbound socket" has been added to the 5.15-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: return -EADDRNOTAVAIL when reading from unbound socket

to the 5.15-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-return-eaddrnotavail-when-reading-from-unb.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 4a9c224849621f75a6f36eb96fa4e1dc5a4f41ba
Author: Oliver Hartkopp <socketcan@xxxxxxxxxxxx>
Date:   Wed Mar 16 17:42:57 2022 +0100

    can: isotp: return -EADDRNOTAVAIL when reading from unbound socket
    
    [ Upstream commit 30ffd5332e06316bd69a654c06aa033872979b7c ]
    
    When reading from an unbound can-isotp socket the syscall blocked
    indefinitely. As unbound sockets (without given CAN address information)
    do not make sense anyway we directly return -EADDRNOTAVAIL on read()
    analogue to the known behavior from sendmsg().
    
    Fixes: e057dd3fc20f ("can: add ISO 15765-2:2016 transport protocol")
    Link: https://github.com/linux-can/can-utils/issues/349
    Link: https://lore.kernel.org/all/20220316164258.54155-2-socketcan@xxxxxxxxxxxx
    Suggested-by: Derek Will <derekrobertwill@xxxxxxxxx>
    Signed-off-by: Oliver Hartkopp <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 9de6c3daed79..9ea179a6aeb0 100644
--- a/net/can/isotp.c
+++ b/net/can/isotp.c
@@ -1045,12 +1045,16 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
 {
 	struct sock *sk = sock->sk;
 	struct sk_buff *skb;
+	struct isotp_sock *so = isotp_sk(sk);
 	int err = 0;
 	int noblock;
 
 	noblock = flags & MSG_DONTWAIT;
 	flags &= ~MSG_DONTWAIT;
 
+	if (!so->bound)
+		return -EADDRNOTAVAIL;
+
 	skb = skb_recv_datagram(sk, flags, noblock, &err);
 	if (!skb)
 		return err;



[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