linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] orinoco: fix GFP_KERNEL in orinoco_set_key with interrupts disabled
@ 2009-12-10 16:54 Andrey Borzenkov
  2009-12-10 18:34 ` Dave
  0 siblings, 1 reply; 5+ messages in thread
From: Andrey Borzenkov @ 2009-12-10 16:54 UTC (permalink / raw)
  To: orinoco-devel, linux-wireless


[-- Attachment #1.1: Type: Text/Plain, Size: 1722 bytes --]

I had to resurrect old notebook and immediately hit this under 2.6.32:

[   77.254109] WARNING: at /home/bor/src/linux-git/kernel/lockdep.c:2465 
lockdep
_trace_alloc+0x9a/0xa0()
[   77.254109] Hardware name: PORTEGE 4000
[   77.254109] Modules linked in: af_packet irnet ppp_generic slhc 
ircomm_tty ircomm binfmt_misc dm_mirror dm_region_hash dm_log 
dm_round_robin dm_multipath dm_mod loop nvram toshiba cryptomgr aead 
pcompress crypto_blkcipher michael_mic crypto_hash crypto_algapi 
orinoco_cs orinoco cfg80211 smsc_ircc2 pcmcia irda toshiba_acpi 
yenta_socket video i2c_ali1535 backlight rsrc_nonstatic ali_agp 
pcmcia_core psmouse output crc_ccitt i2c_core alim1535_wdt rfkill sg 
evdev ohci_hcd agpgart usbcore pata_ali libata reiserfs [last unloaded: 
scsi_wait_scan]
[   77.254109] Pid: 2296, comm: wpa_supplicant Not tainted 2.6.32-1avb 
#1
[   77.254109] Call Trace:
[   77.254109]  [<c011f0ad>] warn_slowpath_common+0x6d/0xa0
[   77.254109]  [<c014206a>] ? lockdep_trace_alloc+0x9a/0xa0
[   77.254109]  [<c014206a>] ? lockdep_trace_alloc+0x9a/0xa0
[   77.254109]  [<c011f0f5>] warn_slowpath_null+0x15/0x20
[   77.254109]  [<c014206a>] lockdep_trace_alloc+0x9a/0xa0
[   77.254109]  [<c018d296>] __kmalloc+0x36/0x130
[   77.254109]  [<dffcb6a8>] ? orinoco_set_key+0x48/0x1c0 [orinoco]
[   77.254109]  [<dffcb6a8>] orinoco_set_key+0x48/0x1c0 [orinoco]
[   77.254109]  [<dffcb9fc>] orinoco_ioctl_set_encodeext+0x1dc/0x2d0 
[orinoco]

Moving allocation outside of orinoco_lock is non-trivial (as sometimes 
it depends on information from card which itself must be protected). 
Until orinoco_lock can be converted from spinlock into mutex, this patch 
is the most simple solution.

[-- Attachment #1.2: orinoco_set_key-atomic --]
[-- Type: message/rfc822, Size: 3670 bytes --]

From: Andrey Borzenkov <arvidjaar@mail.ru>
Subject: [PATCH] orinoco: fix GFP_KERNEL in orinoco_set_key with interrupts disabled

orinoco_set_key is called from two places both with interrupts disabled
(under orinoco_lock). Use GFP_ATOMIC instead of GFP_KERNEL. Fixes following
warning:

[   77.254109] WARNING: at /home/bor/src/linux-git/kernel/lockdep.c:2465 lockdep_trace_alloc+0x9a/0xa0()
[   77.254109] Hardware name: PORTEGE 4000
[   77.254109] Modules linked in: af_packet irnet ppp_generic slhc ircomm_tty ircomm binfmt_misc dm_mirror dm_region_hash dm_log dm_round_robin dm_multipath dm_mod loop nvram toshiba cryptomgr aead pcompress crypto_blkcipher michael_mic crypto_hash crypto_algapi orinoco_cs orinoco cfg80211 smsc_ircc2 pcmcia irda toshiba_acpi yenta_socket video i2c_ali1535 backlight rsrc_nonstatic ali_agp pcmcia_core psmouse output crc_ccitt i2c_core alim1535_wdt rfkill sg evdev ohci_hcd agpgart usbcore pata_ali libata reiserfs [last unloaded: scsi_wait_scan]
[   77.254109] Pid: 2296, comm: wpa_supplicant Not tainted 2.6.32-1avb #1
[   77.254109] Call Trace:
[   77.254109]  [<c011f0ad>] warn_slowpath_common+0x6d/0xa0
[   77.254109]  [<c014206a>] ? lockdep_trace_alloc+0x9a/0xa0
[   77.254109]  [<c014206a>] ? lockdep_trace_alloc+0x9a/0xa0
[   77.254109]  [<c011f0f5>] warn_slowpath_null+0x15/0x20
[   77.254109]  [<c014206a>] lockdep_trace_alloc+0x9a/0xa0
[   77.254109]  [<c018d296>] __kmalloc+0x36/0x130
[   77.254109]  [<dffcb6a8>] ? orinoco_set_key+0x48/0x1c0 [orinoco]
[   77.254109]  [<dffcb6a8>] orinoco_set_key+0x48/0x1c0 [orinoco]
[   77.254109]  [<dffcb9fc>] orinoco_ioctl_set_encodeext+0x1dc/0x2d0 [orinoco]
[   77.254109]  [<c035b117>] ioctl_standard_call+0x207/0x3b0
[   77.254109]  [<dffcb820>] ? orinoco_ioctl_set_encodeext+0x0/0x2d0 [orinoco]
[   77.254109]  [<c0307f1f>] ? rtnl_lock+0xf/0x20
[   77.254109]  [<c0307f1f>] ? rtnl_lock+0xf/0x20
[   77.254109]  [<c02fb115>] ? __dev_get_by_name+0x85/0xb0
[   77.254109]  [<c035b616>] wext_handle_ioctl+0x176/0x200
[   77.254109]  [<dffcb820>] ? orinoco_ioctl_set_encodeext+0x0/0x2d0 [orinoco]
[   77.254109]  [<c030020f>] dev_ioctl+0x6af/0x730
[   77.254109]  [<c02eec65>] ? move_addr_to_kernel+0x55/0x60
[   77.254109]  [<c02eed59>] ? sys_sendto+0xe9/0x130
[   77.254109]  [<c02ed77e>] sock_ioctl+0x7e/0x250
[   77.254109]  [<c02ed700>] ? sock_ioctl+0x0/0x250
[   77.254109]  [<c019cf4c>] vfs_ioctl+0x1c/0x70
[   77.254109]  [<c019d1fa>] do_vfs_ioctl+0x6a/0x590
[   77.254109]  [<c0178e50>] ? might_fault+0x90/0xa0
[   77.254109]  [<c0178e0a>] ? might_fault+0x4a/0xa0
[   77.254109]  [<c02ef90e>] ? sys_socketcall+0x17e/0x280
[   77.254109]  [<c019d759>] sys_ioctl+0x39/0x60
[   77.254109]  [<c0102e3b>] sysenter_do_call+0x12/0x32
[   77.254109] ---[ end trace 95ef563548d21efd ]---

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>

---

 drivers/net/wireless/orinoco/wext.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c
index 7698fdd..ade152f 100644
--- a/drivers/net/wireless/orinoco/wext.c
+++ b/drivers/net/wireless/orinoco/wext.c
@@ -32,14 +32,14 @@ static int orinoco_set_key(struct orinoco_private *priv, int index,
 	kzfree(priv->keys[index].seq);
 
 	if (key_len) {
-		priv->keys[index].key = kzalloc(key_len, GFP_KERNEL);
+		priv->keys[index].key = kzalloc(key_len, GFP_ATOMIC);
 		if (!priv->keys[index].key)
 			goto nomem;
 	} else
 		priv->keys[index].key = NULL;
 
 	if (seq_len) {
-		priv->keys[index].seq = kzalloc(seq_len, GFP_KERNEL);
+		priv->keys[index].seq = kzalloc(seq_len, GFP_ATOMIC);
 		if (!priv->keys[index].seq)
 			goto free_key;
 	} else

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] orinoco: fix GFP_KERNEL in orinoco_set_key with interrupts disabled
  2009-12-10 16:54 [PATCH] orinoco: fix GFP_KERNEL in orinoco_set_key with interrupts disabled Andrey Borzenkov
@ 2009-12-10 18:34 ` Dave
  2009-12-10 18:55   ` Andrey Borzenkov
  0 siblings, 1 reply; 5+ messages in thread
From: Dave @ 2009-12-10 18:34 UTC (permalink / raw)
  To: Andrey Borzenkov; +Cc: orinoco-devel, linux-wireless

Andrey Borzenkov wrote:
> I had to resurrect old notebook and immediately hit this under 2.6.32:
> 
> [   77.254109] WARNING: at /home/bor/src/linux-git/kernel/lockdep.c:2465 
> lockdep
> _trace_alloc+0x9a/0xa0()
> 
> Until orinoco_lock can be converted from spinlock into mutex, this patch 
> is the most simple solution.

Thank you Andrey. The patch is correct (though it could clean up the
misdirected comment 4 or 5 lines above).

Is it worth pushing this to stable?


Dave.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] orinoco: fix GFP_KERNEL in orinoco_set_key with interrupts disabled
  2009-12-10 18:34 ` Dave
@ 2009-12-10 18:55   ` Andrey Borzenkov
  2009-12-14 13:53     ` Dave
  0 siblings, 1 reply; 5+ messages in thread
From: Andrey Borzenkov @ 2009-12-10 18:55 UTC (permalink / raw)
  To: Dave; +Cc: orinoco-devel, linux-wireless

[-- Attachment #1: Type: Text/Plain, Size: 730 bytes --]

On Thursday 10 of December 2009 21:34:53 Dave wrote:
> Andrey Borzenkov wrote:
> > I had to resurrect old notebook and immediately hit this under
> > 2.6.32:
> >
> > [   77.254109] WARNING: at
> > /home/bor/src/linux-git/kernel/lockdep.c:2465 lockdep
> > _trace_alloc+0x9a/0xa0()
> >
> > Until orinoco_lock can be converted from spinlock into mutex, this
> > patch is the most simple solution.
> 
> Thank you Andrey. The patch is correct (though it could clean up the
> misdirected comment 4 or 5 lines above).
> 

Do you want me to resubmit with this cleanup?

> Is it worth pushing this to stable?
> 

I think yes. Sleeping under spinlock with interrupts disabled is not fun 
even if it is very unlikely.

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] orinoco: fix GFP_KERNEL in orinoco_set_key with interrupts disabled
  2009-12-10 18:55   ` Andrey Borzenkov
@ 2009-12-14 13:53     ` Dave
  2009-12-22 18:38       ` [PATCH v2] 2.6.33: " Andrey Borzenkov
  0 siblings, 1 reply; 5+ messages in thread
From: Dave @ 2009-12-14 13:53 UTC (permalink / raw)
  To: Andrey Borzenkov; +Cc: orinoco-devel, linux-wireless

Andrey Borzenkov wrote:
> On Thursday 10 of December 2009 21:34:53 Dave wrote:
>> Andrey Borzenkov wrote:
>>> I had to resurrect old notebook and immediately hit this under
>>> 2.6.32:
>>>
>>> [   77.254109] WARNING: at
>>> /home/bor/src/linux-git/kernel/lockdep.c:2465 lockdep
>>> _trace_alloc+0x9a/0xa0()
>>>
>>> Until orinoco_lock can be converted from spinlock into mutex, this
>>> patch is the most simple solution.
>> Thank you Andrey. The patch is correct (though it could clean up the
>> misdirected comment 4 or 5 lines above).
> 
> Do you want me to resubmit with this cleanup?
> 
>> Is it worth pushing this to stable?
> 
> I think yes. Sleeping under spinlock with interrupts disabled is not fun 
> even if it is very unlikely.

If I understand it right, we want to cc the patch to stable@kernel.org.
So if you could take care of that comment and resubmit with cc (and
something in the title so John can tell we'd like this in 2.6.33 as
well), everyone's happy

<festive>
and Santa distributes the patch to all the good little kernels and
kernelettes
</festive>


Dave.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] 2.6.33: orinoco: fix GFP_KERNEL in orinoco_set_key with interrupts disabled
  2009-12-14 13:53     ` Dave
@ 2009-12-22 18:38       ` Andrey Borzenkov
  0 siblings, 0 replies; 5+ messages in thread
From: Andrey Borzenkov @ 2009-12-22 18:38 UTC (permalink / raw)
  To: Dave; +Cc: orinoco-devel, linux-wireless, stable


[-- Attachment #1.1: Type: Text/Plain, Size: 328 bytes --]

On Monday 14 of December 2009 16:53:35 Dave wrote:
> If I understand it right, we want to cc the patch to
>  stable@kernel.org. So if you could take care of that comment and
>  resubmit with cc (and something in the title so John can tell we'd
>  like this in 2.6.33 as well), everyone's happy
> 

New version attached.

[-- Attachment #1.2: orinoco_set_key-atomic --]
[-- Type: message/rfc822, Size: 4022 bytes --]

From: Andrey Borzenkov <arvidjaar@mail.ru>
Subject: [PATCH] 2.6.33: orinoco: fix GFP_KERNEL in orinoco_set_key with interrupts disabled

orinoco_set_key is called from two places both with interrupts disabled
(under orinoco_lock). Use GFP_ATOMIC instead of GFP_KERNEL. Fixes following
warning:

[   77.254109] WARNING: at /home/bor/src/linux-git/kernel/lockdep.c:2465 lockdep_trace_alloc+0x9a/0xa0()
[   77.254109] Hardware name: PORTEGE 4000
[   77.254109] Modules linked in: af_packet irnet ppp_generic slhc ircomm_tty ircomm binfmt_misc dm_mirror dm_region_hash dm_log dm_round_robin dm_multipath dm_mod loop nvram toshiba cryptomgr aead pcompress crypto_blkcipher michael_mic crypto_hash crypto_algapi orinoco_cs orinoco cfg80211 smsc_ircc2 pcmcia irda toshiba_acpi yenta_socket video i2c_ali1535 backlight rsrc_nonstatic ali_agp pcmcia_core psmouse output crc_ccitt i2c_core alim1535_wdt rfkill sg evdev ohci_hcd agpgart usbcore pata_ali libata reiserfs [last unloaded: scsi_wait_scan]
[   77.254109] Pid: 2296, comm: wpa_supplicant Not tainted 2.6.32-1avb #1
[   77.254109] Call Trace:
[   77.254109]  [<c011f0ad>] warn_slowpath_common+0x6d/0xa0
[   77.254109]  [<c014206a>] ? lockdep_trace_alloc+0x9a/0xa0
[   77.254109]  [<c014206a>] ? lockdep_trace_alloc+0x9a/0xa0
[   77.254109]  [<c011f0f5>] warn_slowpath_null+0x15/0x20
[   77.254109]  [<c014206a>] lockdep_trace_alloc+0x9a/0xa0
[   77.254109]  [<c018d296>] __kmalloc+0x36/0x130
[   77.254109]  [<dffcb6a8>] ? orinoco_set_key+0x48/0x1c0 [orinoco]
[   77.254109]  [<dffcb6a8>] orinoco_set_key+0x48/0x1c0 [orinoco]
[   77.254109]  [<dffcb9fc>] orinoco_ioctl_set_encodeext+0x1dc/0x2d0 [orinoco]
[   77.254109]  [<c035b117>] ioctl_standard_call+0x207/0x3b0
[   77.254109]  [<dffcb820>] ? orinoco_ioctl_set_encodeext+0x0/0x2d0 [orinoco]
[   77.254109]  [<c0307f1f>] ? rtnl_lock+0xf/0x20
[   77.254109]  [<c0307f1f>] ? rtnl_lock+0xf/0x20
[   77.254109]  [<c02fb115>] ? __dev_get_by_name+0x85/0xb0
[   77.254109]  [<c035b616>] wext_handle_ioctl+0x176/0x200
[   77.254109]  [<dffcb820>] ? orinoco_ioctl_set_encodeext+0x0/0x2d0 [orinoco]
[   77.254109]  [<c030020f>] dev_ioctl+0x6af/0x730
[   77.254109]  [<c02eec65>] ? move_addr_to_kernel+0x55/0x60
[   77.254109]  [<c02eed59>] ? sys_sendto+0xe9/0x130
[   77.254109]  [<c02ed77e>] sock_ioctl+0x7e/0x250
[   77.254109]  [<c02ed700>] ? sock_ioctl+0x0/0x250
[   77.254109]  [<c019cf4c>] vfs_ioctl+0x1c/0x70
[   77.254109]  [<c019d1fa>] do_vfs_ioctl+0x6a/0x590
[   77.254109]  [<c0178e50>] ? might_fault+0x90/0xa0
[   77.254109]  [<c0178e0a>] ? might_fault+0x4a/0xa0
[   77.254109]  [<c02ef90e>] ? sys_socketcall+0x17e/0x280
[   77.254109]  [<c019d759>] sys_ioctl+0x39/0x60
[   77.254109]  [<c0102e3b>] sysenter_do_call+0x12/0x32
[   77.254109] ---[ end trace 95ef563548d21efd ]---

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>

---

 drivers/net/wireless/orinoco/wext.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c
index 7698fdd..31ca241 100644
--- a/drivers/net/wireless/orinoco/wext.c
+++ b/drivers/net/wireless/orinoco/wext.c
@@ -23,7 +23,7 @@
 #define MAX_RID_LEN 1024
 
 /* Helper routine to record keys
- * Do not call from interrupt context */
+ * It is called under orinoco_lock so it may not sleep */
 static int orinoco_set_key(struct orinoco_private *priv, int index,
 			   enum orinoco_alg alg, const u8 *key, int key_len,
 			   const u8 *seq, int seq_len)
@@ -32,14 +32,14 @@ static int orinoco_set_key(struct orinoco_private *priv, int index,
 	kzfree(priv->keys[index].seq);
 
 	if (key_len) {
-		priv->keys[index].key = kzalloc(key_len, GFP_KERNEL);
+		priv->keys[index].key = kzalloc(key_len, GFP_ATOMIC);
 		if (!priv->keys[index].key)
 			goto nomem;
 	} else
 		priv->keys[index].key = NULL;
 
 	if (seq_len) {
-		priv->keys[index].seq = kzalloc(seq_len, GFP_KERNEL);
+		priv->keys[index].seq = kzalloc(seq_len, GFP_ATOMIC);
 		if (!priv->keys[index].seq)
 			goto free_key;
 	} else

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-12-22 18:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-10 16:54 [PATCH] orinoco: fix GFP_KERNEL in orinoco_set_key with interrupts disabled Andrey Borzenkov
2009-12-10 18:34 ` Dave
2009-12-10 18:55   ` Andrey Borzenkov
2009-12-14 13:53     ` Dave
2009-12-22 18:38       ` [PATCH v2] 2.6.33: " Andrey Borzenkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).