Commit 6b4dbcd86a9d464057fcc7abe4d0574093071fcc

Authored by Michael Buesch
Committed by Helge Deller
1 parent 450d6e306b

parisc: isa-eeprom - Fix loff_t usage

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>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

drivers/parisc/eisa_eeprom.c
... ... @@ -55,7 +55,7 @@
55 55 ssize_t ret;
56 56 int i;
57 57  
58   - if (*ppos >= HPEE_MAX_LENGTH)
  58 + if (*ppos < 0 || *ppos >= HPEE_MAX_LENGTH)
59 59 return 0;
60 60  
61 61 count = *ppos + count < HPEE_MAX_LENGTH ? count : HPEE_MAX_LENGTH - *ppos;