Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757092AbdLPTom (ORCPT ); Sat, 16 Dec 2017 14:44:42 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:36596 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756815AbdLPToc (ORCPT ); Sat, 16 Dec 2017 14:44:32 -0500 X-Google-Smtp-Source: ACJfBoujC34l/VKlOBUtAYwe35tCxVa7DY5dxiOSo9hOE0iAprNft4plSQdrgtPHZjL/74zrrx2LpQ== From: Arvind Yadav To: sameo@linux.intel.com, davem@davemloft.net Cc: linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH] NFC: Handle return value of skb_dequeue() Date: Sun, 17 Dec 2017 01:14:20 +0530 Message-Id: <8a2fd474b3c7a14e13852f0947544aad8f0ae169.1513453148.git.arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 597 Lines: 25 skb_dequeue() will return NULL for an empty list or a pointer to the head element. Signed-off-by: Arvind Yadav --- 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