From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384691; b=jxFszMWEeXnH7qBK+1REAJNNFM3hmxR2PcwxhW3PacPBAJ907mZQYwgR2hddZdfe4gWW ahxBcMFegW5RSvyeJgdJ+cfTINVCSccR9/zWrh/tw2VRzU4+Vt/aDsq4ppt3tnpYBuht/ H7Pf7jociEN0IVWWI0zKJc8sMuLnAqx4AitoTXzipko3pf8gHJfytPzd2DNPUFRgXygvt jWs8LN+MfBCxbr+EAiiGbeSTzv0ybO1BI8EjVJKhU/qekmj0hq8Nxkts/61DP6DPSC4NT D6bwfUvulh0WmWi8nqH42nZPE53PrsA+pLRxHgxmN04hiAMuntbV0MJWDUDmOWR1/yA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384691; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=PJqbTid6kyEfMGJMn6sLBsc8mwuebRZNA2lUJzdYfQw=; b=H7b+Qp7aJ2HIuUKrKqpNi6tcj9iRRBd/vWFEwdoL7hK+hZDSGqItQr2dFGkZsfds7brE ILpCDi9jRGQ1dxiV5YTVXbKRjgmQ875HRwsp3wda/rM3BvDKk5j3kU0gYl5ACKCpEctdL 7In9WZSqqK3P/4cn8ZoH13h7Lo+2Zve2X+WYuq9gARb6GYMvS5ihPIbk/3Ni9YdJHPzSZ 9olMilwFqZEfzkjraajdHBSgBozcL5O763yax5ePLN7PUkMHF5eoQFdWMZIXTis0+zsUC FZFovC4RzRJAuIpmkA0mkHV3qphKtOFXByuRD72c9KnRV5Lnllwb50cYJhbk2ijLW3g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=AAi3oixU; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD104606A32D; Fri, 4 Dec 2026 11:44:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=AAi3oixU Received: by smtp.kernel.org (Postfix) with ESMTPSA id 418501F000C2; Fri, 4 Dec 2026 11:44:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384691; bh=PJqbTid6kyEfMGJMn6sLBsc8mwuebRZNA2lUJzdYfQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=AAi3oixUeu/YPDWQJy3jihGv1qCxHzg/OmXHwV+qaIIrT+QYRlH53eAT4oxE/acam xjK8dak59SStSTStm8chES80PnRjPnbirhHD3ro1Ql7W3uLmMLg1hlOIIt2GeVlaTB Q5NQQUvOjduf7b5N2WxJMmy5MhFczKNUmOtoL7rE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Breno Leitao , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 0253/1167] net: ena: Keep the RX buffer mapped if skb allocation fails Date: Fri, 4 Dec 2026 18:54:40 +0900 Message-ID: <20261204100708.655078226@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Breno Leitao [ Upstream commit 3e8e22a1007a6337ba2400b3ea87077947005c20 ] We are seeing the following issue in production on arm64 EC2 hosts (m8g.metal-24xl, 64K pages, SMMUv3 in strict mode, 6.18 based kernel). Right after a global OOM, the SMMU reports F_TRANSLATION write faults from the ENA device, followed by a burst of: WARNING: CPU: 48 PID: 1656834 at drivers/iommu/dma-iommu.c:1242 iommu_dma_unmap_phys+0xf4/0x108 Call trace: iommu_dma_unmap_phys+0xf4/0x108 (P) dma_unmap_phys+0x194/0x2a8 dma_unmap_page_attrs+0x1c/0x38 ena_io_poll+0x7bc/0x1790 [ena] __napi_poll+0x54/0x220 net_rx_action+0x250/0x520 ena_rx_skb() unmaps the RX buffer, or takes an extra page reference to reuse it, before napi_build_skb() allocates the skb. If the allocation fails, it returns NULL with rx_info->page still set. ena_clean_rx_irq() then puts the req_id back on the free list, and ena_alloc_rx_buffer() treats the buffer as still mapped and posts its old DMA address to the device again. With the IOMMU in strict mode, the device then writes to an unmapped IOVA, and the next completion of that buffer unmaps it a second time. If the IOVA was handed to a new mapping in between, the device can write into that buffer instead. On the reuse path, the extra page reference is never dropped. Allocate the skb before touching rx_info, so that a failed allocation leaves the buffer mapped and unchanged for the refill. Fixes: 9e5269a915a8 ("net: ena: use build_skb() in RX path") Fixes: f7d625adeb7b ("net: ena: Add dynamic recycling mechanism for rx buffers") Signed-off-by: Breno Leitao Link: https://patch.msgid.link/20261109-ena-rx-skb-alloc-fail-v1-1-aee2927cb51f@debian.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/amazon/ena/ena_netdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c index 2242fb1f3e0d7..f3a8b2f432248 100644 --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c @@ -1006,6 +1006,10 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring, buf_len = SKB_DATA_ALIGN(len + buf_offset + tailroom); + skb = ena_alloc_skb(rx_ring, buf_addr, buf_len); + if (unlikely(!skb)) + return NULL; + /* If XDP isn't loaded try to reuse part of the RX buffer */ reuse_rx_buf_page = !is_xdp_loaded && ena_try_rx_buf_page_reuse(rx_info, buf_len, len, pkt_offset); @@ -1013,10 +1017,6 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring, if (!reuse_rx_buf_page) ena_unmap_rx_buff_attrs(rx_ring, rx_info, DMA_ATTR_SKIP_CPU_SYNC); - skb = ena_alloc_skb(rx_ring, buf_addr, buf_len); - if (unlikely(!skb)) - return NULL; - /* Populate skb's linear part */ skb_reserve(skb, buf_offset); skb_put(skb, len); -- 2.53.0