summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath6kl/htc.c
diff options
context:
space:
mode:
authorVasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>2011-08-22 20:14:31 +0530
committerKalle Valo <kvalo@qca.qualcomm.com>2011-08-31 10:10:54 +0300
commit94e532d1a053b1514ffdad00408eee925104bf27 (patch)
treea82cb3fc6d56d999bd9946c5c3d1c4b8e6381d4d /drivers/net/wireless/ath/ath6kl/htc.c
parentabcb344b3b823c8c9eac6e13e45a53eaf1d5d00b (diff)
ath6kl: Fix system freeze under heavy data load
Patch "ath6kl: Fix buffer alignment for scatter-gather write" does memmove for a length (scat_req->scat_list[i].len) which is not the actual length of data that is suppossed to be moved. The right lengh is packet->act_len + HTC_HDR_LENGTH. Using wrong length for data move during buffer alignment causes system freeze after the following WARN_ON and sometimes target assert. WARNING: at drivers/net/wireless/ath/ath6kl/main.c:771 ath6k_credit_distribute+0x196/0x1a0 [<ffffffffa051cf5f>] ath6kl_htc_rxmsg_pending_handler+0x83f/0xe00 [ath6kl] [<ffffffff8104a743>] ? __wake_up+0x53/0x70 [<ffffffffa0518b18>] ath6kldev_intr_bh_handler+0x188/0x650 [ath6kl] [<ffffffffa052d316>] ath6kl_sdio_irq_handler+0x36/0x80 [ath6kl] [<ffffffff81492b3c>] sdio_irq_thread+0xfc/0x360 [<ffffffff81051c52>] ? default_wake_function+0x12/0x20 [<ffffffff81492a40>] ? sdio_claim_irq+0x220/0x220 [<ffffffff81080c36>] kthread+0x96/0xa0 [<ffffffff815b9fb4>] kernel_thread_helper+0x4/0x10 [<ffffffff81080ba0>] ? kthread_worker_fn+0x190/0x190 [<ffffffff815b9fb0>] ? gs_change+0x13/0x13 Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath6kl/htc.c')
-rw-r--r--drivers/net/wireless/ath/ath6kl/htc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/htc.c b/drivers/net/wireless/ath/ath6kl/htc.c
index 20016602dfd..dc575a82af1 100644
--- a/drivers/net/wireless/ath/ath6kl/htc.c
+++ b/drivers/net/wireless/ath/ath6kl/htc.c
@@ -22,6 +22,17 @@
#define CALC_TXRX_PADDED_LEN(dev, len) (__ALIGN_MASK((len), (dev)->block_mask))
+static void ath6kl_htc_buf_align(u8 **buf, unsigned long len)
+{
+ u8 *align_addr;
+
+ if (!IS_ALIGNED((unsigned long) *buf, 4)) {
+ align_addr = PTR_ALIGN(*buf - 4, 4);
+ memmove(align_addr, *buf, len);
+ *buf = align_addr;
+ }
+}
+
static void htc_prep_send_pkt(struct htc_packet *packet, u8 flags, int ctrl0,
int ctrl1)
{
@@ -391,6 +402,9 @@ static int htc_setup_send_scat_list(struct htc_target *target,
htc_prep_send_pkt(packet,
packet->info.tx.flags | HTC_FLAGS_SEND_BUNDLE,
cred_pad, packet->info.tx.seqno);
+ /* Make sure the buffer is 4-byte aligned */
+ ath6kl_htc_buf_align(&packet->buf,
+ packet->act_len + HTC_HDR_LENGTH);
scat_req->scat_list[i].buf = packet->buf;
scat_req->scat_list[i].len = len;