From patchwork Fri Dec 16 23:57:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 13075650 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA49EC4332F for ; Fri, 16 Dec 2022 23:58:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230262AbiLPX6F (ORCPT ); Fri, 16 Dec 2022 18:58:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230081AbiLPX56 (ORCPT ); Fri, 16 Dec 2022 18:57:58 -0500 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BF9665987; Fri, 16 Dec 2022 15:57:47 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 1C89EE0005; Fri, 16 Dec 2022 23:57:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1671235066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=hMDyExGWKF70lkZyRKRiFJFmtzAkcZU9Ie6RaEJDtZA=; b=DJKRPBrIS4J4fBK98qr8QDEoo6lB8+iQKCzZQLf/+uxx0WDM7T9kF8AAcPjoHo6ZPBhpAz YBySmdK6cfPVFiLfHWXrc4z7tSe0Z18bHtZFwCz3L2b8zgLNpWh0gnfiyYPwnvYYHpSs8d SAi8lJ7d9ss3jtg41233yEXvkocv43fWn7rBpiT3VElbdYmPqrxMye9W18IqzsLQe5GfQa i/Dn8Bq8ihrynvj/aF857RIdl5236mXoGv8cWVxA1/BRmunK91Cj494ivUrqWZnxni3FrR B4+jffeejKLIbwvlxVegmBXqlESIVpplCZ6WEsepWoURd2MW/VPLH6D9GL1KVQ== From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org Cc: David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Guilhem Imberton , Thomas Petazzoni , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , netdev@vger.kernel.org, Miquel Raynal , Dan Carpenter Subject: [PATCH wpan] mac802154: Fix possible double free upon parsing error Date: Sat, 17 Dec 2022 00:57:42 +0100 Message-Id: <20221216235742.646134-1-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org Commit 4d1c7d87030b ("mac802154: Move an skb free within the rx path") tried to simplify error handling within the receive path by moving the kfree_skb() call at the very end of the top-level function but missed one kfree_skb() called upon frame parsing error. Prevent this possible double free from happening. Fixes: 4d1c7d87030b ("mac802154: Move an skb free within the rx path") Reported-by: Dan Carpenter Signed-off-by: Miquel Raynal --- net/mac802154/rx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c index c2aae2a6d6a6..97bb4401dd3e 100644 --- a/net/mac802154/rx.c +++ b/net/mac802154/rx.c @@ -213,7 +213,6 @@ __ieee802154_rx_handle_packet(struct ieee802154_local *local, ret = ieee802154_parse_frame_start(skb, &hdr); if (ret) { pr_debug("got invalid frame\n"); - kfree_skb(skb); return; }