提交 c4433be6 编写于 作者: G Giuseppe Cavallaro 提交者: David S. Miller

stmmac: fix sleep inside atomic

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: NGiuseppe Cavallaro <peppe.cavallaro@st.com>
Reported-by: NJiri Slaby <jirislaby@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 3fb5a991
...@@ -1865,15 +1865,15 @@ static int stmmac_resume(struct platform_device *pdev) ...@@ -1865,15 +1865,15 @@ static int stmmac_resume(struct platform_device *pdev)
if (!netif_running(dev)) if (!netif_running(dev))
return 0; return 0;
spin_lock(&priv->lock);
if (priv->shutdown) { if (priv->shutdown) {
/* Re-open the interface and re-init the MAC/DMA /* Re-open the interface and re-init the MAC/DMA
and the rings. */ and the rings (i.e. on hibernation stage) */
stmmac_open(dev); stmmac_open(dev);
goto out_resume; return 0;
} }
spin_lock(&priv->lock);
/* Power Down bit, into the PM register, is cleared /* Power Down bit, into the PM register, is cleared
* automatically as soon as a magic packet or a Wake-up frame * automatically as soon as a magic packet or a Wake-up frame
* is received. Anyway, it's better to manually clear * is received. Anyway, it's better to manually clear
...@@ -1901,7 +1901,6 @@ static int stmmac_resume(struct platform_device *pdev) ...@@ -1901,7 +1901,6 @@ static int stmmac_resume(struct platform_device *pdev)
netif_start_queue(dev); netif_start_queue(dev);
out_resume:
spin_unlock(&priv->lock); spin_unlock(&priv->lock);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册