Message ID | 20210312165948.909295-1-eric.dumazet@gmail.com |
---|---|
State | New |
Headers | show |
Series | [net] net: qrtr: fix a kernel-infoleak in qrtr_recvmsg() | expand |
Hello: This patch was applied to netdev/net.git (refs/heads/master): On Fri, 12 Mar 2021 08:59:48 -0800 you wrote: > From: Eric Dumazet <edumazet@google.com> > > struct sockaddr_qrtr has a 2-byte hole, and qrtr_recvmsg() currently > does not clear it before copying kernel data to user space. > > It might be too late to name the hole since sockaddr_qrtr structure is uapi. > > [...] Here is the summary with links: - [net] net: qrtr: fix a kernel-infoleak in qrtr_recvmsg() https://git.kernel.org/netdev/net/c/50535249f624 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c index edb6ac17cecabd94fe392eb4f589dbbbf7bfa2c0..dfc820ee553a0948cc64f25f5b8f9c5d0061cfd4 100644 --- a/net/qrtr/qrtr.c +++ b/net/qrtr/qrtr.c @@ -1058,6 +1058,11 @@ static int qrtr_recvmsg(struct socket *sock, struct msghdr *msg, rc = copied; if (addr) { + /* There is an anonymous 2-byte hole after sq_family, + * make sure to clear it. + */ + memset(addr, 0, sizeof(*addr)); + addr->sq_family = AF_QIPCRTR; addr->sq_node = cb->src_node; addr->sq_port = cb->src_port;