Re: [PATCH] smsc95xx: fix suspend buffer overflow
From: Joe Perches <joe@perches.com>
Date: 2012-11-27 17:42:59
On Tue, 2012-11-27 at 13:23 +0000, Steve Glendinning wrote:
quoted hunk ↗ jump to hunk
This patch fixes a buffer overflow introduced by bbd9f9e, where the filter_mask array is accessed beyond its bounds. Reported-by: Dan Carpenter <redacted> Signed-off-by: Steve Glendinning <steve.glendinning@shawell.net> --- drivers/net/usb/smsc95xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 79d495d..6cdc504 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c@@ -1281,7 +1281,7 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message) } if (pdata->wolopts & (WAKE_BCAST | WAKE_MCAST | WAKE_ARP | WAKE_UCAST)) { - u32 *filter_mask = kzalloc(32, GFP_KERNEL); + u32 *filter_mask = kzalloc(sizeof(u32) * 32, GFP_KERNEL);
It's also unchecked for alloc failure.
u32 command[2]; u32 offset[2]; u32 crc[4];