aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAbraham Arce <abraham.arce.moreno@gmail.com>2010-04-16 10:48:43 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-21 19:29:22 -0400
commit761172fbf672c5784b2a0d71ca2f4389eb7a2c21 (patch)
treee52513d9473d51eb64722962bbbbdaf28a5b05f7 /drivers/net
parentdf245dce572bc22b230a05532a3f9daee50effb5 (diff)
KS8851: NULL pointer dereference if list is empty
Fix NULL pointer dereference in ks8851_tx_work by checking if dequeued list is already empty before writing the packet to TX FIFO Unable to handle kernel NULL pointer dereference at virtual address 00000050 PC is at ks8851_tx_work+0xdc/0x1b0 LR is at wait_for_common+0x148/0x164 pc : [<c01c0df4>] lr : [<c025a980>] psr: 20000013 Backtrace: ks8851_tx_work+0x0/0x1b0 worker_thread+0x0/0x190 kthread+0x0/0x90 Signed-off-by: Abraham Arce <x0066660@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ks8851.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c
index 13cc1ca261d9..9e9f9b349766 100644
--- a/drivers/net/ks8851.c
+++ b/drivers/net/ks8851.c
@@ -722,12 +722,14 @@ static void ks8851_tx_work(struct work_struct *work)
722 txb = skb_dequeue(&ks->txq); 722 txb = skb_dequeue(&ks->txq);
723 last = skb_queue_empty(&ks->txq); 723 last = skb_queue_empty(&ks->txq);
724 724
725 ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr | RXQCR_SDA); 725 if (txb != NULL) {
726 ks8851_wrpkt(ks, txb, last); 726 ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr | RXQCR_SDA);
727 ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr); 727 ks8851_wrpkt(ks, txb, last);
728 ks8851_wrreg16(ks, KS_TXQCR, TXQCR_METFE); 728 ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr);
729 ks8851_wrreg16(ks, KS_TXQCR, TXQCR_METFE);
729 730
730 ks8851_done_tx(ks, txb); 731 ks8851_done_tx(ks, txb);
732 }
731 } 733 }
732 734
733 mutex_unlock(&ks->lock); 735 mutex_unlock(&ks->lock);