Skip to content

Commit

Permalink
fix infoleak in rtnetlink
Browse files Browse the repository at this point in the history
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"

Bug: 28620102

Change-Id: I13da380c6fe8abca49e3cf9f05293c02b44d2e5e
Signed-off-by: kangjie <kangjielu@gmail.com>
(cherry picked from commit d7bd06d4e7f6b8f9019bb993fd41dc361154abc3)
  • Loading branch information
kengiter authored and andi34 committed Mar 21, 2017
1 parent 437e9c1 commit 0494d91
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -924,14 +924,14 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
NLA_PUT_STRING(skb, IFLA_IFALIAS, dev->ifalias);

if (1) {
struct rtnl_link_ifmap map = {
.mem_start = dev->mem_start,
.mem_end = dev->mem_end,
.base_addr = dev->base_addr,
.irq = dev->irq,
.dma = dev->dma,
.port = dev->if_port,
};
struct rtnl_link_ifmap map;
memset(&map, 0, sizeof(map));
map.mem_start = dev->mem_start;
map.mem_end = dev->mem_end;
map.base_addr = dev->base_addr;
map.irq = dev->irq;
map.dma = dev->dma;
map.port = dev->if_port;
NLA_PUT(skb, IFLA_MAP, sizeof(map), &map);
}

Expand Down

0 comments on commit 0494d91

Please sign in to comment.