Skip to contentSkip to conversation

ath9k : stability issue in a noisy environment

PATCH New Hewitt Lee 2 participants 3 messages May 9, 2012 – May 11, 2012 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore

Hewitt Lee

author
#0 lore raw

PATCH 1/1 ath9k : stability issue in a noisy environment

Hi All,

This patch unlink a skb comes from ath_tx_form_aggr() which is freed at ath_tx_get_buffer() when tx buffers are full.
Please kindly review it.
Thanks.

(quoted diff) +0 -0

b/v3.3.x/drivers/net/wireless/ath/ath9k/xmit.c
old mode 100644
new mode 100755
index 3182408..f4e1e62

v3.3.x/drivers/net/wireless/ath/ath9k/xmit.c +0 -0
@@ -1858,6 +1858,12 @@ static struct ath_buf *ath_tx_setup_buffer(struct

ath_softc *sc,
return bf;

error:
+ if (tid) {
+ if (skb == skb_peek(&tid->buf_q)) {
+ __skb_unlink(skb, &tid->buf_q);
+ }
+ }
+
dev_kfree_skb_any(skb);
return NULL;
}

Signature · 5 lines
Best Regards,
Hewitt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20120509/874fac26/attachment.htm 
#1 lore raw

PATCH 1/1 ath9k : stability issue in a noisy environment

Quoted 4 lines · Hewitt Lee

Hi All,
This patch unlink a skb comes from ath_tx_form_aggr() which is freed at ath_tx_get_buffer() when tx buffers are full.
Please kindly review it.

Please see:

http://wireless.kernel.org/en/developers/Documentation/SubmittingPatches

Also please provide a clear description of what you are trying to fix, what happens without the patch, what happens with the patch. My review below.

Quoted 13 lines
   Thanks.
   diff --git a/v3.3.x/drivers/net/wireless/ath/ath9k/xmit.c
   b/v3.3.x/drivers/net/wireless/ath/ath9k/xmit.c
   old mode 100644
   new mode 100755
   index 3182408..f4e1e62
   --- a/v3.3.x/drivers/net/wireless/ath/ath9k/xmit.c
   +++ b/v3.3.x/drivers/net/wireless/ath/ath9k/xmit.c
   @@ -1858,6 +1858,12 @@ static struct ath_buf *ath_tx_setup_buffer(struct
   ath_softc *sc,
      return bf;

error:

Quoted 9 lines
   +  if (tid) {
   +  if (skb == skb_peek(&tid->buf_q)) {
   +  __skb_unlink(skb, &tid->buf_q);
   +  }
   +  }
   +
      dev_kfree_skb_any(skb);
      return NULL;
    }

Yeah I have no idea why you are doing this here, based on your description the skb will be free'd at ath_tx_get_buffer() but ath_tx_get_buffer() does not free anything. Can you please be sure to check first against the latest development tree for 802.11 first?

Luis

author
#2 lore raw

PATCH 1/1 ath9k : stability issue in a noisy environment

Hi Luis,

Thanks for your kindly review and sorry for bad description. What I mentioned "ath_tx_get_buffer()" should be "ath_tx_setup_buffer()".

This is a null pointer deference problem.
In ath_tx_form_aggr(), if it fails to get a tx buffer by calling ath_tx_setup_buffer(), the skb will be freed at ath_tx_setup_buffer(). In this case, the skb still exists in the queue.(just peek, not dequeue)
Next round, ath_tx_form_aggr will still try to transmit this skb which is
already freed.
What I tried to do is to unlink the skb comes from ath_tx_form_aggr() when the tx buffers are full.
Thanks.

Below is the updated patch.
-------------------------------------------------------------------------------------
Fix the possibility of null pointer dereference in a noisy environment.

---
drivers/net/wireless/ath/ath9k/xmit.c | 6 ++++++

1 files changed, 6 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/drivers/net/wireless/ath/at
index 23eaa1b..9e6b98e 100644

drivers/net/wireless/ath/ath9k/xmit.c +0 -0
@@ -1863,6 +1863,12 @@ static struct ath_buf *ath_tx_setup_buffer(struct

ath_sof

        return bf;

error:
+ if (tid) {
+ if (skb == skb_peek(&tid->buf_q)) {
+ __skb_unlink(skb, &tid->buf_q);
+ }
+ }
+

        dev_kfree_skb_any(skb);
        return NULL;

}

Below is the kernel panic log.
-------------------------------------------------------------------------------------

[28906.710000] Unable to handle kernel NULL pointer dereference at virtual
address 00000000
[28906.710000] pgd = c0004000
[28906.710000] [00000000] *pgd=00000000
[28906.710000] Internal error: Oops: 817 [#1]
[28906.710000] last sysfs file: /sys/class/scsi_host/host0/proc_name
[28906.710000] Modules linked in: usbhid hid usblp usb_storage xhci_hcd

ohci_hcd ehci_hcd cls_u32 sch_sfq sch_htb ipt_MASQUERADE ipt_REDIRECT iptable_nat nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_conntrack iptable_filter ip_tables x_tables bridge stp ath9k ath9k_common ath9k_hw ath mac80211 cfg80211 arc4 compat led_class ds212w_synobios(P) sky2 synoacl_ext4(P) synoacl_vfs(P) hfsplus fuse vfat fat cryptosoft ecryptfs sha512_generic sha256_generic sha1_generic ecb cesa_ocf_drv(P) cesa_dev cryptodev(P) ocf(P) chainiv des_generic crc32c eseqiv krng ansi_cprng rng aes_generic md5 cbc cryptomgr pcompress aead crypto_hash crypto_blkcipher crypto_wq crypto_algapi cpufreq cpufreq_stats freq_table dm_snapshot crc_itu_t crc_ccitt quota_v2 quota_tree usbcore sg psnap llc raid456 raid10 raid0 linear async_raid6_recov async_pq raid6_pq async_xor xor async_memcpy async_tx dm_mod ipv6 raid1 md_mod [last unloaded: ds212w_synobios]

[28906.710000] CPU: 0    Tainted: P            (2.6.32.12 #2400)
[28906.710000] PC is at free_block+0x5c/0x150
[28906.710000] LR is at 0x8
[28906.710000] pc : [<c0149b98>]    lr : [<00000008>]    psr: 40000093
[28906.710000] sp : c0379d20  ip : c8009c80  fp : c0379d44
[28906.710000] r10: c94ed500  r9 : c984e1a0  r8 : 0000003c
[28906.710000] r7 : 00000000  r6 : 00000025  r5 : c80156a4  r4 : c8009c80
[28906.710000] r3 : 00000000  r2 : 00000000  r1 : c11319c0  r0 : c984e1a0
[28906.710000] Flags: nZcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM
 Segment kernel
[28906.710000] Control: 0005397f  Table: 0a518000  DAC: 00000017
[28906.710000] Process swapper (pid: 0, stack limit = 0xc0378270)
[28906.710000] Stack: (0xc0379d20 to 0xc037a000)
[28906.710000] 9d20: 0000003c c8015600 00000000 c0df2fb0 cae50040 c984e1a0
c0379d64 c0379d48
[28906.710000] 9d40: c0149960 c0149b4c c8015600 60000013 c984e1a0 c0df2fb0
c0379d84 c0379d68
[28906.710000] 9d60: c0149a70 c0149904 00000000 c0df2ab8 c984e1a0 c0df2fb0
c0379dac c0379d88
[28906.710000] 9d80: bf4280c4 c0149a44 c0df2ab8 00000000 00000000 c0df2fb0
00000026 0000000c
[28906.710000] 9da0: c0379e2c c0379db0 bf42938c bf428000 ffffffff ffffffff
c94edf58 c94ed500
[28906.710000] 9dc0: c94edf70 c0df2fb0 c0df2ab8 00000fa5 c984e1d8 00000020
0000006e 0000009a
[28906.710000] 9de0: 000002d6 00003240 00000003 00000001 c0deb4e0 c0dea580
c0deb4e0 c0dea580
[28906.710000] 9e00: 00000000 c94edf58 c0deb4e0 c94ed500 c0dd0000 00000018
0000000a c03b7580
[28906.710000] 9e20: c0379e94 c0379e30 bf42ab5c bf429254 c0379e70 c0379e40
c02bce14 2dde0c2c
[28906.710000] 9e40: 00000f61 0000002d 80292a01 02808080 c0000000 ffffffff
ffffffff 20000013
[28906.710000] 9e60: c0dd0000 00000006 c0379e94 c0379e78 c0379e70 c0379e70
c94ed500 00000040
[28906.710000] 9e80: c0dd0000 00000006 c0379eb4 c0379e98 bf423bac bf42a9dc
00000000 c0378000
[28906.710000] 9ea0: 00000001 00000006 c0379ecc c0379eb8 c0100f00 bf423ac4
00000100 c0378000
[28906.710000] 9ec0: c0379f04 c0379ed0 c0100cdc c0100e84 00000200 c037bbc0
c03f3dd8 00000009
[28906.710000] 9ee0: 00000000 00000200 c037bbc0 c03f3dd8 56251311 00020474
c0379f1c c0379f08
[28906.710000] 9f00: c0026074 c0100c68 ffffffff 0000001f c0379f8c c0379f20
c002a950 c0026010
[28906.710000] 9f20: 000afc17 c0379f6c 00000000 20000013 c037eda0 c037ee10
c002321c c037bbc0
[28906.710000] 9f40: c03f3dd8 56251311 00020474 c0379f8c 2ae8b9a9 c0379f68
c0115790 c00f56d0
[28906.710000] 9f60: 20000013 ffffffff 4f8ea098 000afc17 4f8ea098 000afbed
c037ee10 c037eda0
[28906.710000] 9f80: c0379fb4 c0379f90 c02acb60 c00f5674 c0378000 c039657c
c002321c c037bbc0
[28906.710000] 9fa0: 000204dc 56251311 c0379fcc c0379fb8 c00d0d08 c02acabc
c03bc088 c039657c
[28906.710000] 9fc0: c0379ff4 c0379fd0 c00089f0 c00d0cb8 c0008384 00000000
00000000 c0023220
[28906.710000] 9fe0: 00053975 c039665c 00000000 c0379ff8 00008034 c000879c
00000000 00000000
[28906.710000] [<c0149b98>] (free_block+0x5c/0x150) from [<c0149960>]
(cache_flusharray+0x6c/0x90)
[28906.710000] [<c0149960>] (cache_flusharray+0x6c/0x90) from [<c0149a70>]
(kmem_cache_free+0x3c/0x58)
[28906.710000] [<c0149a70>] (kmem_cache_free+0x3c/0x58) from [<bf4280c4>]
(ath_tx_setup_buffer+0xd4/0xe8 [ath9k])
[28906.710000] unwind: Index not found bf4280c4
[28906.710000] Code: e5913000 e3130080 1a000002 e3a03000 (e5833000)
[28906.720000] ---[ end trace ed44141368d54b92 ]---
[28906.720000] Kernel panic - not syncing: Fatal exception in interrupt
[28906.730000] Rebooting in 3 seconds..Reseting !!

Best Regards,
Hewitt

2012/5/11 Luis R. Rodriguez <[email protected]>

Quoted 39 lines · Hewitt Lee
Quoted 2 lines

Hi All,
This patch unlink a skb comes from ath_tx_form_aggr() which is freed

at

Quoted 2 lines

ath_tx_get_buffer() when tx buffers are full.
Please kindly review it.

Please see:

http://wireless.kernel.org/en/developers/Documentation/SubmittingPatches

Also please provide a clear description of what you are trying to fix, what happens without the patch, what happens with the patch. My review below.

Quoted 9 lines
   Thanks.
   diff --git a/v3.3.x/drivers/net/wireless/ath/ath9k/xmit.c
   b/v3.3.x/drivers/net/wireless/ath/ath9k/xmit.c
   old mode 100644
   new mode 100755
   index 3182408..f4e1e62
   --- a/v3.3.x/drivers/net/wireless/ath/ath9k/xmit.c
   +++ b/v3.3.x/drivers/net/wireless/ath/ath9k/xmit.c
   @@ -1858,6 +1858,12 @@ static struct ath_buf

*ath_tx_setup_buffer(struct

Quoted 13 lines

ath_softc *sc,

      return bf;

    error:
   +  if (tid) {
   +  if (skb == skb_peek(&tid->buf_q)) {
   +  __skb_unlink(skb, &tid->buf_q);
   +  }
   +  }
   +
      dev_kfree_skb_any(skb);
      return NULL;
    }
Quoted 7 lines

Yeah I have no idea why you are doing this here, based on your description the skb will be free'd at ath_tx_get_buffer() but ath_tx_get_buffer() does not free anything. Can you please be sure to check first against the latest development tree for 802.11 first?

Luis

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20120511/ae6e1950/attachment.htm