]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
pcmcia: Fix requery
authorAlan Cox <alan@linux.intel.com>
Wed, 10 Dec 2014 15:06:40 +0000 (15:06 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 12 Jan 2015 13:04:12 +0000 (05:04 -0800)
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>
drivers/pcmcia/cistpl.c
drivers/pcmcia/ds.c

index 4ff725ca2c74e8884461cac564cb4ba86693bcc1..8b3b49217287faa17a1831d43f92a9cf85e76a1c 100644 (file)
@@ -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;
        }
index 757119b87146cbc5219527c8e7c584795c34174e..d3baf0bfca9f0692f9a2789465f727c911e0f7f2 100644 (file)
@@ -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;