From patchwork Mon Feb 22 15:12:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 12098889 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CB59C433DB for ; Mon, 22 Feb 2021 15:18:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 046506148E for ; Mon, 22 Feb 2021 15:18:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231411AbhBVPRS (ORCPT ); Mon, 22 Feb 2021 10:17:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231420AbhBVPP2 (ORCPT ); Mon, 22 Feb 2021 10:15:28 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAEB7C0611C3 for ; Mon, 22 Feb 2021 07:12:59 -0800 (PST) Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lECtF-0007dv-15; Mon, 22 Feb 2021 16:12:49 +0100 Received: from ore by dude.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1lECtE-00075k-HH; Mon, 22 Feb 2021 16:12:48 +0100 From: Oleksij Rempel To: mkl@pengutronix.de, "David S. Miller" , Jakub Kicinski , Oliver Hartkopp , Robin van der Gracht , Johannes Berg Cc: Oleksij Rempel , kernel@pengutronix.de, linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Eric Dumazet , linux-wireless@vger.kernel.org Subject: [PATCH net v1 3/3] [RFC] mac80211: ieee80211_store_ack_skb(): make use of skb_clone_sk_optional() Date: Mon, 22 Feb 2021 16:12:47 +0100 Message-Id: <20210222151247.24534-4-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210222151247.24534-1-o.rempel@pengutronix.de> References: <20210222151247.24534-1-o.rempel@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This code is trying to clone the skb with optional skb->sk. But this will fail to clone the skb if socket was closed just after the skb was pushed into the networking stack. Fixes: a7528198add8 ("mac80211: support control port TX status reporting") Signed-off-by: Oleksij Rempel --- net/mac80211/tx.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 5d06de61047a..c0dd326db10d 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2439,11 +2439,7 @@ static u16 ieee80211_store_ack_skb(struct ieee80211_local *local, struct sk_buff *ack_skb; u16 info_id = 0; - if (skb->sk) - ack_skb = skb_clone_sk(skb); - else - ack_skb = skb_clone(skb, GFP_ATOMIC); - + ack_skb = skb_clone_sk_optional(skb); if (ack_skb) { unsigned long flags; int id;