[PATCH] can: isotp: fix isotp_getname() leak

Subsystems: can network layer, the rest

STALE2037d

3 messages, 2 authors, 2021-01-12 · open the first message on its own page

[PATCH] can: isotp: fix isotp_getname() leak

From: Oliver Hartkopp <socketcan@hartkopp.net>
Date: 2021-01-12 09:09:30

Initialize the sockaddr_can structure to prevent a data leak to user space.

Suggested-by: Cong Wang <redacted>
Reported-by: syzbot+057884e2f453e8afebc8@syzkaller.appspotmail.com
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
---
 net/can/isotp.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/net/can/isotp.c b/net/can/isotp.c
index 7839c3b9e5be..3ef7f78e553b 100644
--- a/net/can/isotp.c
+++ b/net/can/isotp.c
@@ -1153,10 +1153,11 @@ static int isotp_getname(struct socket *sock, struct sockaddr *uaddr, int peer)
 	struct isotp_sock *so = isotp_sk(sk);
 
 	if (peer)
 		return -EOPNOTSUPP;
 
+	memset(addr, 0, sizeof(*addr));
 	addr->can_family = AF_CAN;
 	addr->can_ifindex = so->ifindex;
 	addr->can_addr.tp.rx_id = so->rxid;
 	addr->can_addr.tp.tx_id = so->txid;
 
-- 
2.29.2

Re: [PATCH] can: isotp: fix isotp_getname() leak

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2021-01-12 09:13:04

On 1/12/21 10:04 AM, Oliver Hartkopp wrote:
Initialize the sockaddr_can structure to prevent a data leak to user space.

Suggested-by: Cong Wang <redacted>
Reported-by: syzbot+057884e2f453e8afebc8@syzkaller.appspotmail.com
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Can you add a Fixes: tag?

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

Re: [PATCH] can: isotp: fix isotp_getname() leak

From: Oliver Hartkopp <socketcan@hartkopp.net>
Date: 2021-01-12 09:20:39


On 12.01.21 10:12, Marc Kleine-Budde wrote:
On 1/12/21 10:04 AM, Oliver Hartkopp wrote:
quoted
Initialize the sockaddr_can structure to prevent a data leak to user space.

Suggested-by: Cong Wang <redacted>
Reported-by: syzbot+057884e2f453e8afebc8@syzkaller.appspotmail.com
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Can you add a Fixes: tag?
Yes, of course.

Sent out a v2 with Fixes: tag.

Best regards,
Oliver
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help