diff options
author | Willy Tarreau <w@1wt.eu> | 2018-09-12 07:36:35 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-09-13 10:35:57 -0700 |
commit | 9824dfae5741275473a23a7ed5756c7b6efacc9d (patch) | |
tree | 60fb9379f5c1fd396025a630e9d21f0742e70563 /drivers/net/appletalk | |
parent | 018349d70f28a78d5343b3660cb66e1667005f8a (diff) | |
download | linux-stable-9824dfae5741275473a23a7ed5756c7b6efacc9d.tar.gz linux-stable-9824dfae5741275473a23a7ed5756c7b6efacc9d.tar.bz2 linux-stable-9824dfae5741275473a23a7ed5756c7b6efacc9d.zip |
net/appletalk: fix minor pointer leak to userspace in SIOCFINDIPDDPRT
Fields ->dev and ->next of struct ipddp_route may be copied to
userspace on the SIOCFINDIPDDPRT ioctl. This is only accessible
to CAP_NET_ADMIN though. Let's manually copy the relevant fields
instead of using memcpy().
BugLink: http://blog.infosectcbr.com.au/2018/09/linux-kernel-infoleaks.html
Cc: Jann Horn <jannh@google.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/appletalk')
-rw-r--r-- | drivers/net/appletalk/ipddp.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/appletalk/ipddp.c b/drivers/net/appletalk/ipddp.c index 9375cef22420..3d27616d9c85 100644 --- a/drivers/net/appletalk/ipddp.c +++ b/drivers/net/appletalk/ipddp.c @@ -283,8 +283,12 @@ static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) case SIOCFINDIPDDPRT: spin_lock_bh(&ipddp_route_lock); rp = __ipddp_find_route(&rcp); - if (rp) - memcpy(&rcp2, rp, sizeof(rcp2)); + if (rp) { + memset(&rcp2, 0, sizeof(rcp2)); + rcp2.ip = rp->ip; + rcp2.at = rp->at; + rcp2.flags = rp->flags; + } spin_unlock_bh(&ipddp_route_lock); if (rp) { |