stuff-up in pcmcia/cardbus stuff

stuff-up in pcmcia/cardbus stuff

Post by Dominik Brodowsk » Wed, 19 Feb 2003 11:00:07




> Recent 2.5 kernels will crash with a null pointer dereference on my
> powerbook (PowerPC laptop) when I try to suspend.  I tracked it down
> to cardbus_suspend() in drivers/pcmcia/pci-socket.c calling
> pcmcia_suspend_socket() with a NULL argument.  It turns out that
> socket->pcmcia_socket is never set in the current code.

Indeed. socket->pcmcia_socket (old) == socket->cls_d.s_info[0] (new)
Could you please check whether this patch helps?

        Dominik

diff -ruN linux-original/drivers/pcmcia/pci_socket.c linux/drivers/pcmcia/pci_socket.c
--- linux-original/drivers/pcmcia/pci_socket.c  2003-02-18 09:08:00.000000000 +0100

 static int cardbus_suspend (struct pci_dev *dev, u32 state)
 {
        pci_socket_t *socket = pci_get_drvdata(dev);
-       pcmcia_suspend_socket (socket->pcmcia_socket);
+       if (socket && socket->cls_d.s_info[0])
+               pcmcia_suspend_socket (socket->cls_d.s_info[0]);
        return 0;
 }

 static int cardbus_resume (struct pci_dev *dev)
 {
        pci_socket_t *socket = pci_get_drvdata(dev);
-       pcmcia_resume_socket (socket->pcmcia_socket);
+       if (socket && socket->cls_d.s_info[0])
+               pcmcia_resume_socket (socket->cls_d.s_info[0]);
        return 0;
 }

diff -ruN linux-original/drivers/pcmcia/pci_socket.h linux/drivers/pcmcia/pci_socket.h
--- linux-original/drivers/pcmcia/pci_socket.h  2003-02-18 09:08:00.000000000 +0100

        socket_cap_t cap;
        spinlock_t event_lock;
        unsigned int events;
-       struct socket_info_t *pcmcia_socket;
        struct work_struct tq_task;
        struct timer_list poll_timer;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

stuff-up in pcmcia/cardbus stuff

Post by Jeff Garzi » Wed, 19 Feb 2003 11:30:16



> Indeed. socket->pcmcia_socket (old) == socket->cls_d.s_info[0] (new)

If this is true...


>  static int cardbus_suspend (struct pci_dev *dev, u32 state)
>  {
>    pci_socket_t *socket = pci_get_drvdata(dev);
> -  pcmcia_suspend_socket (socket->pcmcia_socket);
> +  if (socket && socket->cls_d.s_info[0])
> +          pcmcia_suspend_socket (socket->cls_d.s_info[0]);
>    return 0;
>  }

>  static int cardbus_resume (struct pci_dev *dev)
>  {
>    pci_socket_t *socket = pci_get_drvdata(dev);
> -  pcmcia_resume_socket (socket->pcmcia_socket);
> +  if (socket && socket->cls_d.s_info[0])
> +          pcmcia_resume_socket (socket->cls_d.s_info[0]);
>    return 0;
>  }

1) ...why do you bother checking for NULL?  Isn't NULL indicative of a
BUG(), instead?

2) why are multiple s_info records allocated, when you hardcode use of
record #0 ?

        Jeff

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

stuff-up in pcmcia/cardbus stuff

Post by Dominik Brodowsk » Wed, 19 Feb 2003 17:00:22




> >Indeed. socket->pcmcia_socket (old) == socket->cls_d.s_info[0] (new)

> If this is true...


> > static int cardbus_suspend (struct pci_dev *dev, u32 state)
> > {
> >       pci_socket_t *socket = pci_get_drvdata(dev);
> >-      pcmcia_suspend_socket (socket->pcmcia_socket);
> >+      if (socket && socket->cls_d.s_info[0])
> >+              pcmcia_suspend_socket (socket->cls_d.s_info[0]);
> >       return 0;
> > }

> > static int cardbus_resume (struct pci_dev *dev)
> > {
> >       pci_socket_t *socket = pci_get_drvdata(dev);
> >-      pcmcia_resume_socket (socket->pcmcia_socket);
> >+      if (socket && socket->cls_d.s_info[0])
> >+              pcmcia_resume_socket (socket->cls_d.s_info[0]);
> >       return 0;
> > }

> 1) ...why do you bother checking for NULL?  Isn't NULL indicative of a
> BUG(), instead?

Well, it's only a safeguard against suspending / resuming combined with
probing or removing the device. Else it's a BUG indeed...

Quote:> 2) why are multiple s_info records allocated, when you hardcode use of
> record #0 ?

Only one s_info is actually allocated (in cs.c::pcmcia_register_socket) as
only one pcmcia/cardbus socket is attached to one pci_dev for yenta-style
devices. There are up to four pcmcia sockets to one pci_dev for i82092
devices, though. And so s_info[3] might be perfectly valid within the
i82092 driver.

        Dominik

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/