Commit b42b3a27 authored by Oliver Hartkopp's avatar Oliver Hartkopp Committed by Marc Kleine-Budde

can: isotp: isotp_getname(): fix kernel information leak

Initialize the sockaddr_can structure to prevent a data leak to user space.
Suggested-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Reported-by: syzbot+057884e2f453e8afebc8@syzkaller.appspotmail.com
Fixes: e057dd3f ("can: add ISO 15765-2:2016 transport protocol")
Signed-off-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
Link: https://lore.kernel.org/r/20210112091643.11789-1-socketcan@hartkopp.netSigned-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent a95d25dd
...@@ -1155,6 +1155,7 @@ static int isotp_getname(struct socket *sock, struct sockaddr *uaddr, int peer) ...@@ -1155,6 +1155,7 @@ static int isotp_getname(struct socket *sock, struct sockaddr *uaddr, int peer)
if (peer) if (peer)
return -EOPNOTSUPP; return -EOPNOTSUPP;
memset(addr, 0, sizeof(*addr));
addr->can_family = AF_CAN; addr->can_family = AF_CAN;
addr->can_ifindex = so->ifindex; addr->can_ifindex = so->ifindex;
addr->can_addr.tp.rx_id = so->rxid; addr->can_addr.tp.rx_id = so->rxid;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment