From: Tony Nguyen <[email protected]>
To: [email protected], [email protected], [email protected],
[email protected]
Cc: Przemyslaw Patynowski <[email protected]>,
[email protected], [email protected],
Jesse Brandeburg <[email protected]>,
Konrad Jankowski <[email protected]>
Subject: [PATCH net 6/7] iavf: Fix handling of dummy receive descriptors
Date: Mon, 11 Jul 2022 16:02:42 -0700 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
From: Przemyslaw Patynowski <[email protected]>
Fix memory leak caused by not handling dummy receive descriptor properly.
iavf_get_rx_buffer now sets the rx_buffer return value for dummy receive
descriptors. Without this patch, when the hardware writes a dummy
descriptor, iavf would not free the page allocated for the previous receive
buffer. This is an unlikely event but can still happen.
[Jesse: massaged commit message]
Fixes: efa14c398582 ("iavf: allow null RX descriptors")
Signed-off-by: Przemyslaw Patynowski <[email protected]>
Signed-off-by: Jesse Brandeburg <[email protected]>
Tested-by: Konrad Jankowski <[email protected]>
Signed-off-by: Tony Nguyen <[email protected]>
---
drivers/net/ethernet/intel/iavf/iavf_txrx.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/iavf/iavf_txrx.c b/drivers/net/ethernet/intel/iavf/iavf_txrx.c
index 7bf8c25dc824..06d18797d25a 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_txrx.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_txrx.c
@@ -1285,11 +1285,10 @@ static struct iavf_rx_buffer *iavf_get_rx_buffer(struct iavf_ring *rx_ring,
{
struct iavf_rx_buffer *rx_buffer;
- if (!size)
- return NULL;
-
rx_buffer = &rx_ring->rx_bi[rx_ring->next_to_clean];
prefetchw(rx_buffer->page);
+ if (!size)
+ return rx_buffer;
/* we are reusing so sync this buffer for CPU use */
dma_sync_single_range_for_cpu(rx_ring->dev,
--
2.35.1
next prev parent reply other threads:[~2022-07-11 23:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-11 23:02 [PATCH net 0/7][pull request] Intel Wired LAN Driver Updates 2022-07-11 Tony Nguyen
2022-07-11 23:02 ` [PATCH net 1/7] iavf: Fix VLAN_V2 addition/rejection Tony Nguyen
2022-07-11 23:02 ` [PATCH net 2/7] iavf: Disallow changing rx/tx-frames and rx/tx-frames-irq Tony Nguyen
2022-07-11 23:02 ` [PATCH net 3/7] iavf: Fix reset error handling Tony Nguyen
2022-07-11 23:02 ` [PATCH net 4/7] iavf: Fix NULL pointer dereference in iavf_get_link_ksettings Tony Nguyen
2022-07-11 23:02 ` [PATCH net 5/7] iavf: Fix adminq error handling Tony Nguyen
2022-07-11 23:02 ` Tony Nguyen [this message]
2022-07-11 23:02 ` [PATCH net 7/7] iavf: Fix missing state logs Tony Nguyen
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=20220711230243.3123667-7-anthony.l.nguyen@intel.com \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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