Skip to content

Commit

Permalink
[media] drxk: Avoid OOPSes if firmware is corrupted
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mauro Carvalho Chehab committed Jul 27, 2011
1 parent e076c92 commit bcd2ebb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/media/dvb/frontends/drxk_hard.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bcd2ebb

Please sign in to comment.