* re: staging: dgnc: Fix frame size is larger than 1024B
@ 2014-08-25 17:16 Dan Carpenter
2014-08-25 20:47 ` Konrad Zapalowicz
2014-08-31 20:42 ` [PATCH] staging: dgnc: Fix sleeping under spinlock bug Konrad Zapalowicz
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2014-08-25 17:16 UTC (permalink / raw)
To: bergo.torino; +Cc: driverdev-devel
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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: staging: dgnc: Fix frame size is larger than 1024B
2014-08-25 17:16 staging: dgnc: Fix frame size is larger than 1024B Dan Carpenter
@ 2014-08-25 20:47 ` Konrad Zapalowicz
2014-08-31 20:42 ` [PATCH] staging: dgnc: Fix sleeping under spinlock bug Konrad Zapalowicz
1 sibling, 0 replies; 3+ messages in thread
From: Konrad Zapalowicz @ 2014-08-25 20:47 UTC (permalink / raw)
To: Dan Carpenter; +Cc: driverdev-devel
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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] staging: dgnc: Fix sleeping under spinlock bug
2014-08-25 17:16 staging: dgnc: Fix frame size is larger than 1024B Dan Carpenter
2014-08-25 20:47 ` Konrad Zapalowicz
@ 2014-08-31 20:42 ` Konrad Zapalowicz
1 sibling, 0 replies; 3+ messages in thread
From: Konrad Zapalowicz @ 2014-08-31 20:42 UTC (permalink / raw)
To: lidza.louina; +Cc: markh, gregkh, driverdev-devel, devel, Konrad Zapalowicz
From: Konrad Zapalowicz <bergo.torino+kernel@gmail.com>
This commit changes the memory allocation flags to ATOMIC in order to
avoid sleeping in the nowait/nolock code.
Signed-off-by: Konrad Zapalowicz <bergo.torino+kernel@gmail.com>
---
drivers/staging/dgnc/dgnc_tty.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index afb20a3..a798476 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -462,7 +462,7 @@ void dgnc_sniff_nowait_nolock(struct channel_t *ch, uchar *text, uchar *buf, int
char *p;
int too_much_data;
- tmpbuf = kzalloc(TMPBUFLEN, GFP_KERNEL);
+ tmpbuf = kzalloc(TMPBUFLEN, GFP_ATOMIC);
if (!tmpbuf)
return;
p = tmpbuf;
--
1.8.1.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-31 20:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-25 17:16 staging: dgnc: Fix frame size is larger than 1024B Dan Carpenter
2014-08-25 20:47 ` Konrad Zapalowicz
2014-08-31 20:42 ` [PATCH] staging: dgnc: Fix sleeping under spinlock bug Konrad Zapalowicz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.