watchdog: pcwd_usb: overflow in usb_pcwd_send_command()
Subsystems (2)
PATCH 1/1 watchdog: pcwd_usb: overflow in usb_pcwd_send_command()
We changed "buf" from being an array of 6 chars to being a pointer this sizeof(buf) needs to be updated as well.
drivers/watchdog/pcwd_usb.c +1 -1
@@ -258,7 +258,7 @@ static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd,if (usb_control_msg (usb_pcwd->udev,usb_sndctrlpipe (usb_pcwd->udev,0 ),HID_REQ_SET_REPORT ,HID_DT_REPORT , -0x0200 , usb_pcwd->interface_number, buf,sizeof (buf), +0x0200 , usb_pcwd->interface_number, buf,6 ,USB_COMMAND_TIMEOUT ) !=sizeof (buf)) {dbg ("usb_pcwd_send_command: error in usb_control_msg for " "cmd 0x%x 0x%x 0x%x\n" , cmd, *msb, *lsb);
Hi Dan,
Quoted 11 lines
We changed "buf" from being an array of 6 chars to being a pointer this sizeof(buf) needs to be updated as well.
Fixes 2ddb8089a7e5 ('watchdog: pcwd_usb: Use allocated buffer for usb_control_msg')Signed-off-by Dan Carpenter <[email protected]>drivers/watchdog/pcwd_usb.c +0
-0
drivers/watchdog/pcwd_usb.c static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd, · line 264
Quoted 8 lines
drivers/watchdog/pcwd_usb.c +1
-1@@ -258,7 +258,7 @@ static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd,if (usb_control_msg (usb_pcwd->udev,usb_sndctrlpipe (usb_pcwd->udev,0 ),HID_REQ_SET_REPORT ,HID_DT_REPORT , -0x0200 , usb_pcwd->interface_number, buf,sizeof (buf), +0x0200 , usb_pcwd->interface_number, buf,6 ,USB_COMMAND_TIMEOUT ) !=sizeof (buf)) {dbg ("usb_pcwd_send_command: error in usb_control_msg for " "cmd 0x%x 0x%x 0x%x\n" , cmd, *msb, *lsb);
Added to linux-watchdog-next.
Kind regards,
Wim.
Guenter Roeck
maintainerQuoted 3 lines · Dan Carpenter
We changed "buf" from being an array of 6 chars to being a pointer this sizeof(buf) needs to be updated as well.
oops ...
Quoted 8 lines
Fixes 2ddb8089a7e5 ('watchdog: pcwd_usb: Use allocated buffer for usb_control_msg')Signed-off-by Dan Carpenter <[email protected]>drivers/watchdog/pcwd_usb.c +0
-0
drivers/watchdog/pcwd_usb.c static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd, · line 262
Quoted 6 lines
drivers/watchdog/pcwd_usb.c +1
-1@@ -258,7 +258,7 @@ static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd,if (usb_control_msg (usb_pcwd->udev,usb_sndctrlpipe (usb_pcwd->udev,0 ),HID_REQ_SET_REPORT ,HID_DT_REPORT , -0x0200 , usb_pcwd->interface_number, buf,sizeof (buf), +0x0200 , usb_pcwd->interface_number, buf,6 ,USB_COMMAND_TIMEOUT ) !=sizeof (buf)) {
Doesn't it have to be fixed here as well ?
Thanks,
Guenter
Quoted 8 lines
drivers/watchdog/pcwd_usb.c +0
-1dbg ("usb_pcwd_send_command: error in usb_control_msg for " "cmd 0x%x 0x%x 0x%x\n" , cmd, *msb, *lsb); --To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 15 lines · Guenter Roeck
Quoted 3 lines · Dan Carpenter
We changed "buf" from being an array of 6 chars to being a pointer this sizeof(buf) needs to be updated as well.
oops ...
Quoted 9 lines
Fixes 2ddb8089a7e5 ('watchdog: pcwd_usb: Use allocated buffer for usb_control_msg')Signed-off-by Dan Carpenter <[email protected]>drivers/watchdog/pcwd_usb.c +0
-0@@ -258,7 +258,7 @@ static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd,
Quoted 7 lines
drivers/watchdog/pcwd_usb.c static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd, · line 262
Quoted 5 lines
drivers/watchdog/pcwd_usb.c +1
-1if (usb_control_msg (usb_pcwd->udev,usb_sndctrlpipe (usb_pcwd->udev,0 ),HID_REQ_SET_REPORT ,HID_DT_REPORT , -0x0200 , usb_pcwd->interface_number, buf,sizeof (buf), +0x0200 , usb_pcwd->interface_number, buf,6 ,USB_COMMAND_TIMEOUT ) !=sizeof (buf)) {Doesn't it have to be fixed here as well ?
Yeah. Good eye. I'll send a v2.
regards,
dan carpenter
PATCH v2 1/1 watchdog: pcwd_usb: overflow in usb_pcwd_send_command()
In reply to Guenter RoeckWe changed "buf" from being an array of 6 chars to being a pointer this sizeof(buf) needs to be updated as well.
---
v2: Fix the bug that Guenter Roeck pointed out in v1.
drivers/watchdog/pcwd_usb.c +2 -2
@@ -258,8 +258,8 @@ static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd,if (usb_control_msg (usb_pcwd->udev,usb_sndctrlpipe (usb_pcwd->udev,0 ),HID_REQ_SET_REPORT ,HID_DT_REPORT , -0x0200 , usb_pcwd->interface_number, buf,sizeof (buf), -USB_COMMAND_TIMEOUT ) !=sizeof (buf)) { +0x0200 , usb_pcwd->interface_number, buf,6 , +USB_COMMAND_TIMEOUT ) !=6 ) {dbg ("usb_pcwd_send_command: error in usb_control_msg for " "cmd 0x%x 0x%x 0x%x\n" , cmd, *msb, *lsb); }
Quoted 5 lines · Dan Carpenter
We changed "buf" from being an array of 6 chars to being a pointer this sizeof(buf) needs to be updated as well.
Fixes 2ddb8089a7e5 ('watchdog: pcwd_usb: Use allocated buffer for usb_control_msg')Signed-off-by Dan Carpenter <[email protected]>
Quoted 24 lines
---
v2: Fix the bug that Guenter Roeck pointed out in v1.drivers/watchdog/pcwd_usb.c +2
-3@@ -258,8 +258,8 @@ static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd,if (usb_control_msg (usb_pcwd->udev,usb_sndctrlpipe (usb_pcwd->udev,0 ),HID_REQ_SET_REPORT ,HID_DT_REPORT , -0x0200 , usb_pcwd->interface_number, buf,sizeof (buf), -USB_COMMAND_TIMEOUT ) !=sizeof (buf)) { +0x0200 , usb_pcwd->interface_number, buf,6 , +USB_COMMAND_TIMEOUT ) !=6 ) {dbg ("usb_pcwd_send_command: error in usb_control_msg for " "cmd 0x%x 0x%x 0x%x\n" , cmd, *msb, *lsb); } --To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 5 lines · Dan Carpenter
We changed "buf" from being an array of 6 chars to being a pointer this sizeof(buf) needs to be updated as well.
Fixes 2ddb8089a7e5 ('watchdog: pcwd_usb: Use allocated buffer for usb_control_msg')Signed-off-by Dan Carpenter <[email protected]>
I thought I had replied earlier, but I don't find my reply anywhere. My apologies if this is a duplicate.
Guenter
Hi Dan,
Quoted 7 lines
We changed "buf" from being an array of 6 chars to being a pointer this sizeof(buf) needs to be updated as well.
Fixes 2ddb8089a7e5 ('watchdog: pcwd_usb: Use allocated buffer for usb_control_msg')Signed-off-by Dan Carpenter <[email protected]>---
v2: Fix the bug that Guenter Roeck pointed out in v1.
This was added to linux-watchdog-next.
Kind regards,
Wim.