From: Mauro Carvalho Chehab Date: Sat, 9 Jul 2011 21:57:54 +0000 (-0300) Subject: [media] drxk: Avoid OOPSes if firmware is corrupted X-Git-Tag: v3.1-rc1~116^2~102 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=bcd2ebb76039bf4b1d1cb9f9f0e182548578e692;p=linux.git [media] drxk: Avoid OOPSes if firmware is corrupted Don't read paste the buffer, if the firmware is corrupted. Instead, print an error message. Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c index c4b35a5638cd..89db37835872 100644 --- a/drivers/media/dvb/frontends/drxk_hard.c +++ b/drivers/media/dvb/frontends/drxk_hard.c @@ -1388,6 +1388,12 @@ static int DownloadMicrocode(struct drxk_state *state, BlockCRC = (pSrc[0] << 8) | pSrc[1]; pSrc += sizeof(u16); offset += sizeof(u16); + + if (offset + BlockSize > Length) { + printk(KERN_ERR "drxk: Firmware is corrupted.\n"); + return -EINVAL; + } + status = write_block(state, Address, BlockSize, pSrc); if (status < 0) break;