Skip to content

Commit 5f8e447

Browse files
kengiterdavem330
authored andcommitted
net: fix infoleak in rtnetlink
The stack object “map” has a total size of 32 bytes. Its last 4 bytes are padding generated by compiler. These padding bytes are not initialized and sent out via “nla_put”. Signed-off-by: Kangjie Lu <kjlu@gatech.edu> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b8670c0 commit 5f8e447

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

Diff for: net/core/rtnetlink.c

+10-8
Original file line numberDiff line numberDiff line change
@@ -1180,14 +1180,16 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
11801180

11811181
static int rtnl_fill_link_ifmap(struct sk_buff *skb, struct net_device *dev)
11821182
{
1183-
struct rtnl_link_ifmap map = {
1184-
.mem_start = dev->mem_start,
1185-
.mem_end = dev->mem_end,
1186-
.base_addr = dev->base_addr,
1187-
.irq = dev->irq,
1188-
.dma = dev->dma,
1189-
.port = dev->if_port,
1190-
};
1183+
struct rtnl_link_ifmap map;
1184+
1185+
memset(&map, 0, sizeof(map));
1186+
map.mem_start = dev->mem_start;
1187+
map.mem_end = dev->mem_end;
1188+
map.base_addr = dev->base_addr;
1189+
map.irq = dev->irq;
1190+
map.dma = dev->dma;
1191+
map.port = dev->if_port;
1192+
11911193
if (nla_put(skb, IFLA_MAP, sizeof(map), &map))
11921194
return -EMSGSIZE;
11931195

0 commit comments

Comments
 (0)