Skip to content

Commit

Permalink
parisc: isa-eeprom - Fix loff_t usage
Browse files Browse the repository at this point in the history
loff_t is a signed type. If userspace passes a negative ppos, the "count"
range check is weakened. "count"s bigger than HPEE_MAX_LENGTH will pass the check.
Also, if ppos is negative, the readb(eisa_eeprom_addr + *ppos) will poke in random
memory.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Cc: stable@kernel.org
Signed-off-by: Helge Deller <deller@gmx.de>
  • Loading branch information
Michael Buesch authored and Helge Deller committed Aug 2, 2009
1 parent 450d6e3 commit 6b4dbcd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/parisc/eisa_eeprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static ssize_t eisa_eeprom_read(struct file * file,
ssize_t ret;
int i;

if (*ppos >= HPEE_MAX_LENGTH)
if (*ppos < 0 || *ppos >= HPEE_MAX_LENGTH)
return 0;

count = *ppos + count < HPEE_MAX_LENGTH ? count : HPEE_MAX_LENGTH - *ppos;
Expand Down

0 comments on commit 6b4dbcd

Please sign in to comment.