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

Dan Carpenter dan.carpenter at oracle.com
Mon Aug 25 17:16:56 UTC 2014


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.

regards,
dan carpenter


More information about the devel mailing list