mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net v5 0/2] octeon_ep: Add SKB allocation failures handling in __octep_oq_process_rx()
@ 2024-10-17 10:06 Aleksandr Mishin
  2024-10-17 10:06 ` [PATCH net v5 1/2] octeon_ep: Implement helper for iterating packets in Rx queue Aleksandr Mishin
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Aleksandr Mishin @ 2024-10-17 10:06 UTC (permalink / raw)
  To: Veerasenareddy Burru, Abhijit Ayarekar, Satananda Burla, Sathesh Edara
  Cc: Aleksandr Mishin, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netdev, linux-kernel, lvc-project

__octep_oq_process_rx() is called during NAPI polling by the driver and
calls build_skb() which may return NULL as skb pointer in case of memory
allocation error. This pointer is dereferenced later without checking for
NULL.

In this series, we introduce two helpers to make the fix more readable and
avoid code duplication. Also we handle build_skb() errors inside
__octep_oq_process_rx() to avoid NULL pointer dereference.

A similar situation is present in the __octep_vf_oq_process_rx() of the
Octeon VF driver. First we want to try the fix on __octep_oq_process_rx().

Compile tested only.

Changelog:
v5:
  - Unmap paged buffer before the skb creation as suggested by Paolo
    (https://lore.kernel.org/all/cf656975-69b4-427e-8769-d16575774bba@redhat.com/)
v4: https://lore.kernel.org/all/20241012094950.9438-1-amishin@t-argos.ru/
  - Split patch up as suggested by Jakub
    (https://lore.kernel.org/all/20241004073311.223efca4@kernel.org/)
v3: https://lore.kernel.org/all/20240930053328.9618-1-amishin@t-argos.ru/
  - Implement helper which frees current packet resources and increase
    index and descriptor as suggested by Simon
    (https://lore.kernel.org/all/20240919134812.GB1571683@kernel.org/)
  - Optimize helper as suggested by Paolo
    (https://lore.kernel.org/all/b9ae8575-f903-425f-aa42-0c2a7605aa94@redhat.com/)
  - v3 has been reviewed-by Simon Horman
    (https://lore.kernel.org/all/20240930162622.GF1310185@kernel.org/)
v2: https://lore.kernel.org/all/20240916060212.12393-1-amishin@t-argos.ru/
  - Implement helper instead of adding multiple checks for '!skb' and
    remove 'rx_bytes' increasing in case of packet dropping as suggested
    by Paolo
    (https://lore.kernel.org/all/ba514498-3706-413b-a09f-f577861eef28@redhat.com/)
v1: https://lore.kernel.org/all/20240906063907.9591-1-amishin@t-argos.ru/

Aleksandr Mishin (2):
  octeon_ep: Implement helper for iterating packets in Rx queue
  octeon_ep: Add SKB allocation failures handling in
    __octep_oq_process_rx()

 .../net/ethernet/marvell/octeon_ep/octep_rx.c | 82 +++++++++++++------
 1 file changed, 59 insertions(+), 23 deletions(-)

-- 
2.30.2


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

end of thread, other threads:[~2024-10-20 14:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-17 10:06 [PATCH net v5 0/2] octeon_ep: Add SKB allocation failures handling in __octep_oq_process_rx() Aleksandr Mishin
2024-10-17 10:06 ` [PATCH net v5 1/2] octeon_ep: Implement helper for iterating packets in Rx queue Aleksandr Mishin
2024-10-17 18:08   ` Jacob Keller
2024-10-17 10:06 ` [PATCH net v5 2/2] octeon_ep: Add SKB allocation failures handling in __octep_oq_process_rx() Aleksandr Mishin
2024-10-17 18:09   ` Jacob Keller
2024-10-20 14:50 ` [PATCH net v5 0/2] " patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®