skb_dequeue() will return NULL for an empty list or a pointer to the head element.
Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com> --- net/nfc/rawsock.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c index e2188de..c6de1ac 100644 --- a/net/nfc/rawsock.c +++ b/net/nfc/rawsock.c @@ -201,6 +201,10 @@ static void rawsock_tx_work(struct work_struct *work) } skb = skb_dequeue(&sk->sk_write_queue); + if (!skb) { + rawsock_write_queue_purge(sk); + return; + } sock_hold(sk); rc = nfc_data_exchange(dev, target_idx, skb, -- 2.7.4