netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iwl-next v4] ixgbe: Fix possible skb NULL pointer dereference
@ 2025-01-31 12:14 Piotr Kwapulinski
  2025-01-31 14:56 ` Simon Horman
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Piotr Kwapulinski @ 2025-01-31 12:14 UTC (permalink / raw)
  To: intel-wired-lan
  Cc: netdev, dan.carpenter, yuehaibing, maciej.fijalkowski,
	przemyslaw.kitszel, Piotr Kwapulinski

The commit c824125cbb18 ("ixgbe: Fix passing 0 to ERR_PTR in
ixgbe_run_xdp()") stopped utilizing the ERR-like macros for xdp status
encoding. Propagate this logic to the ixgbe_put_rx_buffer().

The commit also relaxed the skb NULL pointer check - caught by Smatch.
Restore this check.

Fixes: c824125cbb18 ("ixgbe: Fix passing 0 to ERR_PTR in ixgbe_run_xdp()")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
---
v1 -> v2
  Provide extra details in commit message for motivation of this patch
v2 -> v3
  Simplify the check condition
v3 -> v4
  Rebase to net-queue
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 7236f20..467f812 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -2105,7 +2105,7 @@ static void ixgbe_put_rx_buffer(struct ixgbe_ring *rx_ring,
 		/* hand second half of page back to the ring */
 		ixgbe_reuse_rx_page(rx_ring, rx_buffer);
 	} else {
-		if (!IS_ERR(skb) && IXGBE_CB(skb)->dma == rx_buffer->dma) {
+		if (skb && IXGBE_CB(skb)->dma == rx_buffer->dma) {
 			/* the page has been released from the ring */
 			IXGBE_CB(skb)->page_released = true;
 		} else {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-02-11  9:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-31 12:14 [PATCH iwl-next v4] ixgbe: Fix possible skb NULL pointer dereference Piotr Kwapulinski
2025-01-31 14:56 ` Simon Horman
2025-01-31 15:15 ` Simon Horman
2025-02-03 21:21 ` [Intel-wired-lan] " Tony Nguyen
2025-02-11  9:36 ` Sanigani, SarithaX

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).