Commit 761172fb authored by Abraham Arce's avatar Abraham Arce Committed by David S. Miller

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: default avatarAbraham Arce <x0066660@ti.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent df245dce
...@@ -722,6 +722,7 @@ static void ks8851_tx_work(struct work_struct *work) ...@@ -722,6 +722,7 @@ static void ks8851_tx_work(struct work_struct *work)
txb = skb_dequeue(&ks->txq); txb = skb_dequeue(&ks->txq);
last = skb_queue_empty(&ks->txq); last = skb_queue_empty(&ks->txq);
if (txb != NULL) {
ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr | RXQCR_SDA); ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr | RXQCR_SDA);
ks8851_wrpkt(ks, txb, last); ks8851_wrpkt(ks, txb, last);
ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr); ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr);
...@@ -729,6 +730,7 @@ static void ks8851_tx_work(struct work_struct *work) ...@@ -729,6 +730,7 @@ static void ks8851_tx_work(struct work_struct *work)
ks8851_done_tx(ks, txb); ks8851_done_tx(ks, txb);
} }
}
mutex_unlock(&ks->lock); mutex_unlock(&ks->lock);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment