summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-07-09 18:57:54 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 17:55:48 -0300
commitbcd2ebb76039bf4b1d1cb9f9f0e182548578e692 (patch)
tree7fcd647e3f9f7ea420417bb36abd46e786911bba /drivers/media
parente076c92ed6908b0a06ea0d419606a59cae7febe6 (diff)
[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 <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/frontends/drxk_hard.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c
index c4b35a5638c..89db3783587 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;