netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, jallen@linux.vnet.ibm.com,
	nfont@linux.vnet.ibm.com,
	Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Subject: [PATCH net v2] ibmvnic: Check for NULL skb's in NAPI poll routine
Date: Mon, 19 Feb 2018 20:12:57 -0600	[thread overview]
Message-ID: <1519092777-11559-1-git-send-email-tlfalcon@linux.vnet.ibm.com> (raw)
In-Reply-To: <1518970121-8539-1-git-send-email-tlfalcon@linux.vnet.ibm.com>

After introduction of commit d0869c0071e4, there were some instances of
RX queue entries from a previous session (before the device was closed
and reopened) returned to the NAPI polling routine. Since the corresponding
socket buffers were freed, this resulted in a panic on reopen. Include
a check for a NULL skb here to avoid this.

Fixes: d0869c0071e4 ("ibmvnic: Clean RX pool buffers during device close")
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
v2: Followed David Miller's suggestion to check for a NULL socket buffer
    Originally sent as "ibmvnic: Clean RX pools only during a hard reset"
---
 drivers/net/ethernet/ibm/ibmvnic.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 996f475..1495cb9 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1901,6 +1901,11 @@ static int ibmvnic_poll(struct napi_struct *napi, int budget)
 			dev_kfree_skb_any(rx_buff->skb);
 			remove_buff_from_pool(adapter, rx_buff);
 			continue;
+		} else if (!rx_buff->skb) {
+			/* free the entry */
+			next->rx_comp.first = 0;
+			remove_buff_from_pool(adapter, rx_buff);
+			continue;
 		}
 
 		length = be32_to_cpu(next->rx_comp.len);
-- 
2.7.5

      parent reply	other threads:[~2018-02-20  2:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-18 16:08 [PATCH net] ibmvnic: Clean RX pools only during a hard reset Thomas Falcon
2018-02-18 16:08 ` [PATCH net-next] ibmvnic: Keep track of supplementary TX descriptors Thomas Falcon
2018-02-20 18:20   ` David Miller
2018-02-19 16:37 ` [PATCH net] ibmvnic: Clean RX pools only during a hard reset David Miller
2018-02-19 19:24   ` Thomas Falcon
2018-02-19 19:30     ` David Miller
2018-02-19 20:01       ` Thomas Falcon
2018-02-20  2:12 ` Thomas Falcon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1519092777-11559-1-git-send-email-tlfalcon@linux.vnet.ibm.com \
    --to=tlfalcon@linux.vnet.ibm.com \
    --cc=davem@davemloft.net \
    --cc=jallen@linux.vnet.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=nfont@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).