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 D6098847F for ; Fri, 10 Mar 2023 13:59:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50FB2C433EF; Fri, 10 Mar 2023 13:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678456755; bh=1mDhX9Oqb00SGeeSGRieKFuAmeVyAv5Huz4IP63BC8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2ZBU6kKl4bJMZ+SYpnqYM1Heyb47kWokK9PZbIutDf9LOzLpW8tJjKDN4ccdNnBRm aNQ6wTCm1mkMtxl6LNfFTqOUvBlPTEn2U59tnX8GACRMyw0BokUDtnqTa3BpV7uoi7 KuxtO0sT+ucUc2Z0sJO6YtLrqI6ca3ithc/QKts4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Dumazet , Yunsheng Lin , "David S. Miller" , Sasha Levin Subject: [PATCH 6.2 082/211] net: fix __dev_kfree_skb_any() vs drop monitor Date: Fri, 10 Mar 2023 14:37:42 +0100 Message-Id: <20230310133721.279279824@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310133718.689332661@linuxfoundation.org> References: <20230310133718.689332661@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Eric Dumazet [ Upstream commit ac3ad19584b26fae9ac86e4faebe790becc74491 ] dev_kfree_skb() is aliased to consume_skb(). When a driver is dropping a packet by calling dev_kfree_skb_any() we should propagate the drop reason instead of pretending the packet was consumed. Note: Now we have enum skb_drop_reason we could remove enum skb_free_reason (for linux-6.4) v2: added an unlikely(), suggested by Yunsheng Lin. Fixes: e6247027e517 ("net: introduce dev_consume_skb_any()") Signed-off-by: Eric Dumazet Cc: Yunsheng Lin Reviewed-by: Yunsheng Lin Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/core/dev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/core/dev.c b/net/core/dev.c index f23e287602b7e..fce980d531bdc 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3131,8 +3131,10 @@ void __dev_kfree_skb_any(struct sk_buff *skb, enum skb_free_reason reason) { if (in_hardirq() || irqs_disabled()) __dev_kfree_skb_irq(skb, reason); + else if (unlikely(reason == SKB_REASON_DROPPED)) + kfree_skb(skb); else - dev_kfree_skb(skb); + consume_skb(skb); } EXPORT_SYMBOL(__dev_kfree_skb_any); -- 2.39.2