Skip to content

Commit 8402641

Browse files
Alan Coxgregkh
authored andcommitted
pcmcia: Fix requery
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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b38a4bd commit 8402641

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

drivers/pcmcia/cistpl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info)
13861386
if (!s)
13871387
return -EINVAL;
13881388

1389-
if (s->functions) {
1389+
if (s->functions || !(s->state & SOCKET_PRESENT)) {
13901390
WARN_ON(1);
13911391
return -EINVAL;
13921392
}

drivers/pcmcia/ds.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,9 @@ static void pcmcia_requery(struct pcmcia_socket *s)
667667
{
668668
int has_pfc;
669669

670+
if (!(s->state & SOCKET_PRESENT))
671+
return;
672+
670673
if (s->functions == 0) {
671674
pcmcia_card_add(s);
672675
return;

0 commit comments

Comments
 (0)