Re: [PATCH 4.19 241/422] net: socionext: Fix two sleep-in-atomic-context bugs in ave_rxfifo_reset()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 21, 2019 at 09:21:40PM +0100, Pavel Machek wrote:
> Hi!
> 
> > [ Upstream commit 0020f5c807ef67954d9210eea0ba17a6134cdf7d ]
> > 
> > The driver may sleep with holding a spinlock.
> > The function call paths (from bottom to top) in Linux-4.17 are:
> > 
> > [FUNC] usleep_range
> > drivers/net/ethernet/socionext/sni_ave.c, 892:
> > 	usleep_range in ave_rxfifo_reset
> > drivers/net/ethernet/socionext/sni_ave.c, 932:
> > 	ave_rxfifo_reset in ave_irq_handler
> > 
> > [FUNC] usleep_range
> > drivers/net/ethernet/socionext/sni_ave.c, 888:
> > 	usleep_range in ave_rxfifo_reset
> > drivers/net/ethernet/socionext/sni_ave.c, 932:
> > 	ave_rxfifo_reset in ave_irq_handler
> > 
> > To fix these bugs, usleep_range() is replaced with udelay().
> 
> I don't believe this is serious enough for -stable, but more
> importantly:

Sleeping in a spinlock is not allowed, yes, this is a bugfix worth of
stable, how could it not?

> > +++ b/drivers/net/ethernet/socionext/sni_ave.c
> > @@ -906,11 +906,11 @@ static void ave_rxfifo_reset(struct net_device *ndev)
> >  
> >  	/* assert reset */
> >  	writel(AVE_GRR_RXFFR, priv->base + AVE_GRR);
> > -	usleep_range(40, 50);
> > +	udelay(50);
> >  
> >  	/* negate reset */
> >  	writel(0, priv->base + AVE_GRR);
> > -	usleep_range(10, 20);
> > +	udelay(20);
> >
> 
> udelay(40) / udelay(10) should be enough here.

Maybe not, this way is safe, right?

greg k-h



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux