mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 10:31:33 -04:00
qede: Fix NULL pointer dereference in TPA fragment processing
Under memory pressure, the qede driver encounters NULL pointer dereferences when processing TPA continuation fragments. Commit8a8633978b("qede: Add build_skb() support.") accidentally dropped the assignment of tpa_info->buffer.data in qede_tpa_start(). When memory pressure causes an SKB allocation failure in qede_tpa_start(), the driver sets tpa_start_fail = true and attempts to recycle the physical page later in qede_tpa_end() via qede_reuse_page(). However, because buffer.data was left uninitialized (NULL), qede_reuse_page() pushes a "ghost" BD (valid DMA mapping but NULL data pointer) back into the active Rx ring. The next time the hardware uses this ring slot, it passes a NULL page to qede_fill_frag_skb(), causing a kernel panic. Example crash from production system: BUG: unable to handle kernel NULL pointer dereference at 0x8 RIP: qede_fill_frag_skb+0x96/0x430 [qede] Call Trace: qede_rx_int+0xb06/0x1de0 qede_poll+0x2f4/0x6c0 __napi_poll+0x2d/0x130 Fix the root cause by restoring the tpa_info->buffer.data assignment in qede_tpa_start(), ensuring valid pages are correctly tracked and recycled. Additionally, update the stale comment for struct qede_agg_info::buffer to reflect its current usage. Fixes:8a8633978b("qede: Add build_skb() support.") Cc: stable@vger.kernel.org Signed-off-by: Vaibhav Nagare <vnagare@redhat.com> Link: https://patch.msgid.link/20260818073309.2266072-1-vnagare@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
7bf29145d7
commit
06aa3d2632
@@ -303,10 +303,10 @@ enum qede_agg_state {
|
||||
};
|
||||
|
||||
struct qede_agg_info {
|
||||
/* rx_buf is a data buffer that can be placed / consumed from rx bd
|
||||
* chain. It has two purposes: We will preallocate the data buffer
|
||||
* for each aggregation when we open the interface and will place this
|
||||
* buffer on the rx-bd-ring when we receive TPA_START. We don't want
|
||||
/* buffer is used to retain the Rx consumer descriptor when a TPA
|
||||
* session starts. If the SKB allocation fails during TPA_START,
|
||||
* we use this saved buffer to safely recycle the physical page
|
||||
* back into the rx-bd-ring via qede_reuse_page(). We don't want
|
||||
* to be in a state where allocation fails, as we can't reuse the
|
||||
* consumer buffer in the rx-chain since FW may still be writing to it
|
||||
* (since header needs to be modified for TPA).
|
||||
|
||||
@@ -850,6 +850,7 @@ static void qede_tpa_start(struct qede_dev *edev,
|
||||
pad, false);
|
||||
tpa_info->buffer.page_offset = sw_rx_data_cons->page_offset;
|
||||
tpa_info->buffer.mapping = sw_rx_data_cons->mapping;
|
||||
tpa_info->buffer.data = sw_rx_data_cons->data;
|
||||
|
||||
if (unlikely(!tpa_info->skb)) {
|
||||
DP_NOTICE(edev, "Failed to allocate SKB for gro\n");
|
||||
|
||||
Reference in New Issue
Block a user