[PATCH] fix pcmcia_device_probe oops
authorHugh Dickins <hugh@veritas.com>
Fri, 10 Mar 2006 21:13:44 +0000 (21:13 +0000)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 10 Mar 2006 21:40:26 +0000 (13:40 -0800)
Fix pcmcia_device_probe NULL pointer dereference at startup.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/pcmcia/ds.c

index 54ad93daca3c4b3900877a6feceb09710401b519..bb96ce1db08c314507d333a1c6145ebfb09006bf 100644 (file)
@@ -411,7 +411,7 @@ static int pcmcia_device_probe(struct device * dev)
         * pseudo devices, and if not, add the second one.
         */
        did = (struct pcmcia_device_id *) p_dev->dev.driver_data;
-       if ((did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) &&
+       if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) &&
            (p_dev->socket->device_count == 1) && (p_dev->device_no == 0))
                pcmcia_add_pseudo_device(p_dev->socket);