Skip to content

Commit

Permalink
pcmcia: Fix requery
Browse files Browse the repository at this point in the history
The requery logic goes off and attempts to read the CIS of empty slots. In
most cases this happens not to do any harm - but not all!

Add the missing check and also a WARN() to catch any other offenders.

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 b38a4bd commit 8402641
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/pcmcia/cistpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,7 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info)
if (!s)
return -EINVAL;

if (s->functions) {
if (s->functions || !(s->state & SOCKET_PRESENT)) {
WARN_ON(1);
return -EINVAL;
}
Expand Down
3 changes: 3 additions & 0 deletions drivers/pcmcia/ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,9 @@ static void pcmcia_requery(struct pcmcia_socket *s)
{
int has_pfc;

if (!(s->state & SOCKET_PRESENT))
return;

if (s->functions == 0) {
pcmcia_card_add(s);
return;
Expand Down

0 comments on commit 8402641

Please sign in to comment.