Skip to content

Commit 9824dfa

Browse files
wtarreaudavem330
authored andcommitted
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>
1 parent 018349d commit 9824dfa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: drivers/net/appletalk/ipddp.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,12 @@ static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
283283
case SIOCFINDIPDDPRT:
284284
spin_lock_bh(&ipddp_route_lock);
285285
rp = __ipddp_find_route(&rcp);
286-
if (rp)
287-
memcpy(&rcp2, rp, sizeof(rcp2));
286+
if (rp) {
287+
memset(&rcp2, 0, sizeof(rcp2));
288+
rcp2.ip = rp->ip;
289+
rcp2.at = rp->at;
290+
rcp2.flags = rp->flags;
291+
}
288292
spin_unlock_bh(&ipddp_route_lock);
289293

290294
if (rp) {

0 commit comments

Comments
 (0)