staging: dgnc: Fix frame size is larger than 1024B

Konrad Zapalowicz bergo.torino at gmail.com
Mon Aug 25 20:47:32 UTC 2014


On 08/25, Dan Carpenter wrote:
> Hello Konrad Zapalowicz,
> 
> The patch ea6e9dea2e72: "staging: dgnc: Fix frame size is larger than
> 1024B" from Aug 6, 2014, leads to the following static checker
> warning:
> 
> 	drivers/staging/dgnc/dgnc_tty.c:479 dgnc_sniff_nowait_nolock()
> 	error: scheduling with locks held: 'spin_lock:ch_lock'
> 
> drivers/staging/dgnc/dgnc_tty.c
>    467  void dgnc_sniff_nowait_nolock(struct channel_t *ch, uchar *text, uchar *buf, int len)
>    468  {
>    469          struct timeval tv;
>    470          int n;
>    471          int r;
>    472          int nbuf;
>    473          int i;
>    474          int tmpbuflen;
>    475          char *tmpbuf;
>    476          char *p;
>    477          int too_much_data;
>    478  
>    479          tmpbuf = kzalloc(TMPBUFLEN, GFP_KERNEL);
>                                             ^^^^^^^^^^
> 
> This is a sleeping under spinlock bug.
> 
>    480          if (!tmpbuf)
>    481                  return;
>    482          p = tmpbuf;
> 
> Normally the way to fix these is to just do a GFP_ATOMIC allocation but
> sometimes you can shuffle the lock and the allocation around to avoid
> the problem.

Thanks for the info, I was not aware about this kind of consequences.
I'll fix it in the upcoming series of patches for the dgnc driver.

By the way, now I  understand why someone has put there that local,
huge table which was fixed by my patch.

cheers,
konrad
 
> regards,
> dan carpenter


More information about the devel mailing list