Skip to content

Commit

Permalink
pcmcia cis: on an out of range CIS read return 0xff, don't just warn
Browse files Browse the repository at this point in the history
The current code displays warnings but then proceeds to try and reference
the data through the PCMCIA window. Instead return 0xff. This prevents bogus
CIS data sending us off into hyperspace.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Alan Cox authored and Greg Kroah-Hartman committed Jan 12, 2015
1 parent a6c6193 commit b38a4bd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/pcmcia/cistpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,12 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
} else {
u_int inc = 1, card_offset, flags;

if (addr > CISTPL_MAX_CIS_SIZE)
if (addr > CISTPL_MAX_CIS_SIZE) {
dev_dbg(&s->dev,
"attempt to read CIS mem at addr %#x", addr);
memset(ptr, 0xff, len);
return -1;
}

flags = MAP_ACTIVE | ((cis_width) ? MAP_16BIT : 0);
if (attr) {
Expand Down

0 comments on commit b38a4bd

Please sign in to comment.