diff mbox series

can: isotp: fix isotp_getname() leak

Message ID 20210112090457.11262-1-socketcan@hartkopp.net (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series can: isotp: fix isotp_getname() leak | expand

Checks

Context Check Description
netdev/tree_selection success Series ignored based on subject

Commit Message

Oliver Hartkopp Jan. 12, 2021, 9:04 a.m. UTC
Initialize the sockaddr_can structure to prevent a data leak to user space.

Suggested-by: Cong Wang <xiyou.wangcong@gmail.com>
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(+)

Comments

Marc Kleine-Budde Jan. 12, 2021, 9:12 a.m. UTC | #1
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 <xiyou.wangcong@gmail.com>
> Reported-by: syzbot+057884e2f453e8afebc8@syzkaller.appspotmail.com
> Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>

Can you add a Fixes: tag?

Marc
Oliver Hartkopp Jan. 12, 2021, 9:17 a.m. UTC | #2
On 12.01.21 10:12, Marc Kleine-Budde wrote:
> 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 <xiyou.wangcong@gmail.com>
>> 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
diff mbox series

Patch

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;