Skip to contentSkip to conversation

Race between suspend and open in network drivers?

DISCUSSION Dmitry Torokhov 1 participant 1 message Apr 24, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

I have a question regarding possible race between suspend and open methods in most network drivers. Consider b44 for example:

static int b44_suspend(struct pci_dev *pdev, pm_message_t state)

{
        struct net_device *dev = pci_get_drvdata(pdev);
        struct b44 *bp = netdev_priv(dev);

        if (!netif_running(dev))
                 return 0;

Why can we just check netif_running and bail out? What stops 2nd CPU from getting into b44_open right then and set up the device and we'll get into suspend with device fully set up and DMAing...

Come to think of it it's not even a race since b44_open does not even check if device is suspended. I must be missing something... Do we rely on userland being completely stopped while suspending? But what about suspend to ram (IIRC we don't stop userlan there) or selective suspend?

Thanks!

Signature · 1 line
Dmitry