b53: fix memory out of bounds access on 64 bit targets

On device reset the sizes for the vlan and port tables were wrongly
calculated based on the pointer size instead of the struct size. This
causes buffer overruns on 64 bit targets, resulting in panics.

Fix this by dereferencing the pointers.

Reported-by: Fedor Konstantinov <blmink@mink.su>
Signed-off-by: Jonas Gorski <jogo@openwrt.org>

SVN-Revision: 45938
owl
Jonas Gorski 2015-06-10 09:21:36 +00:00
parent d24d5412ff
commit 9fbd6d0ba0
1 changed files with 2 additions and 2 deletions

View File

@ -803,8 +803,8 @@ static int b53_global_reset_switch(struct switch_dev *dev)
priv->enable_jumbo = 0; priv->enable_jumbo = 0;
priv->allow_vid_4095 = 0; priv->allow_vid_4095 = 0;
memset(priv->vlans, 0, sizeof(priv->vlans) * dev->vlans); memset(priv->vlans, 0, sizeof(*priv->vlans) * dev->vlans);
memset(priv->ports, 0, sizeof(priv->ports) * dev->ports); memset(priv->ports, 0, sizeof(*priv->ports) * dev->ports);
return b53_switch_reset(priv); return b53_switch_reset(priv);
} }