From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44FFA31D36F; Mon, 27 Oct 2025 18:52:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761591148; cv=none; b=I/HSZ1DxmnIRlh+htqjkvH0YKcZz7lTcPCVJyCzBD71hhCxf66cHhXFL3JFjKtKO5xMofX6nQhHawQeKcpfRDtFLptibYwjwL+7LShBhStV3a6BEIQLLwkxGWgnSn9ASSrBLNHSHK+IqjyXBn+mnsoXvOZ7xirC4M+HXmbHp8Oc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761591148; c=relaxed/simple; bh=gYpGORed7g1xFJjjYbzaS7o3OdfaWdJ3ZPbdRpMfU0Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=f+uHgHkyApFvX5FFvvyWTskJtyjr2qtS56plmw1AOuvHm2xsZLSeIFY0/QyYPVZAlfvM/7zZNIVFxaTX+bcHsMPSuSVPWrgQVWxGhaYWW21pBOJEWU6HRfYsklxKN2A6SOIIL26Ak++mgO/51l3wpHKPIQQiizx631LPcuupFuY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lAx/ZJy6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="lAx/ZJy6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA4BEC4CEF1; Mon, 27 Oct 2025 18:52:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1761591148; bh=gYpGORed7g1xFJjjYbzaS7o3OdfaWdJ3ZPbdRpMfU0Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lAx/ZJy6T6s+QIehIw+riQKQ3eqNbwQZJa1Ix/gYE9OBazmKStVPiD790gLNGOraF ZZANJiSV7kTU4Ny4HYQU43d045UnOEVR7tcKJ08CbMf7K9ON+X1ykTiT/ySsLZnPPF wlLo9XBPpgqoqqyGSU5PZGN3pBRCjFvR6hdtD5Ek= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jakub Kicinski , Yeounsu Moon , Andrew Lunn , Sasha Levin Subject: [PATCH 5.10 086/332] net: dlink: handle copy_thresh allocation failure Date: Mon, 27 Oct 2025 19:32:19 +0100 Message-ID: <20251027183526.892436787@linuxfoundation.org> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251027183524.611456697@linuxfoundation.org> References: <20251027183524.611456697@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yeounsu Moon [ Upstream commit 8169a6011c5fecc6cb1c3654c541c567d3318de8 ] The driver did not handle failure of `netdev_alloc_skb_ip_align()`. If the allocation failed, dereferencing `skb->protocol` could lead to a NULL pointer dereference. This patch tries to allocate `skb`. If the allocation fails, it falls back to the normal path. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Suggested-by: Jakub Kicinski Tested-on: D-Link DGE-550T Rev-A3 Signed-off-by: Yeounsu Moon Reviewed-by: Andrew Lunn Link: https://patch.msgid.link/20250928190124.1156-1-yyyynoom@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/dlink/dl2k.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/dlink/dl2k.c b/drivers/net/ethernet/dlink/dl2k.c index af1e96e0209fc..0af58c4dcebc1 100644 --- a/drivers/net/ethernet/dlink/dl2k.c +++ b/drivers/net/ethernet/dlink/dl2k.c @@ -957,15 +957,18 @@ receive_packet (struct net_device *dev) } else { struct sk_buff *skb; + skb = NULL; /* Small skbuffs for short packets */ - if (pkt_len > copy_thresh) { + if (pkt_len <= copy_thresh) + skb = netdev_alloc_skb_ip_align(dev, pkt_len); + if (!skb) { dma_unmap_single(&np->pdev->dev, desc_to_dma(desc), np->rx_buf_sz, DMA_FROM_DEVICE); skb_put (skb = np->rx_skbuff[entry], pkt_len); np->rx_skbuff[entry] = NULL; - } else if ((skb = netdev_alloc_skb_ip_align(dev, pkt_len))) { + } else { dma_sync_single_for_cpu(&np->pdev->dev, desc_to_dma(desc), np->rx_buf_sz, -- 2.51.0