media: dw2102: Fix a buffer overflow
PATCH 1/1 media: dw2102: Fix a buffer overflow
This bug in dw2102_load_firmware() function appears only when building the kernel via LLVM+Clang. Due to reading of 64 bytes chunk, it may happen that there will be an attempt to read a more bytes in chunk than there is left, which is why Kernel oops occurs. At least this bug happens when downloading the firmware for Prof Revolution DVB-S2 7500 USB.
Signed-off-by Maksim Pinigin <[email protected]>
--- drivers/media/usb/dvb-usb/dw2102.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/dvb-usb/dw2102.c +1 -1
@@ -1893,7 +1893,7 @@ static int dw2102_load_firmware(struct usb_device *dev,break ; }info ("start downloading DW210X firmware" ); - p =kmalloc (fw->size,GFP_KERNEL ); + p =kzalloc (round_up (fw->size,0x40 ),GFP_KERNEL ); reset =1 ;/*stop the CPU*/ dw210x_op_rw (dev,0xa0 ,0x7f92 ,0 , &reset,1 ,DW210X_WRITE_MSG );
Signature · 1 line
2.39.5