Skip to content

Commit

Permalink
stmmac: fix sleep inside atomic
Browse files Browse the repository at this point in the history
We cannot use spinlock when kmalloc is invoked with
GFP_KERNEL flag because it can sleep.
So this patch reviews the usage of spinlock within the
stmmac_resume function avoing this bug.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Giuseppe Cavallaro authored and David S. Miller committed Sep 7, 2010
1 parent 3fb5a99 commit c4433be
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/net/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1865,15 +1865,15 @@ static int stmmac_resume(struct platform_device *pdev)
if (!netif_running(dev))
return 0;

spin_lock(&priv->lock);

if (priv->shutdown) {
/* Re-open the interface and re-init the MAC/DMA
and the rings. */
and the rings (i.e. on hibernation stage) */
stmmac_open(dev);
goto out_resume;
return 0;
}

spin_lock(&priv->lock);

/* Power Down bit, into the PM register, is cleared
* automatically as soon as a magic packet or a Wake-up frame
* is received. Anyway, it's better to manually clear
Expand Down Expand Up @@ -1901,7 +1901,6 @@ static int stmmac_resume(struct platform_device *pdev)

netif_start_queue(dev);

out_resume:
spin_unlock(&priv->lock);
return 0;
}
Expand Down

0 comments on commit c4433be

Please sign in to comment.