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 3F147C6FD1F for ; Mon, 20 Mar 2023 00:53:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229757AbjCTAxP (ORCPT ); Sun, 19 Mar 2023 20:53:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229497AbjCTAxG (ORCPT ); Sun, 19 Mar 2023 20:53:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3DA719F31; Sun, 19 Mar 2023 17:53:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3EC5B61152; Mon, 20 Mar 2023 00:53:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59B95C4339E; Mon, 20 Mar 2023 00:53:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679273584; bh=eG+a1Q+h3eRWaHORW/ALPgQfchAXi4bvlCKXTEmWzoc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S6zFVtxaigTQjCacjPBhlcErae0L0xs/gU246eri5VVhN/wGiThCB4l5OrvcJSjqu 3BbPsWeEqLHJ7IL1o9OIuHK70YJgZXvk5h3Ph0y9FP3w/lqylsHcm48udBEYduDefI tZHDx5OY5A68kjhLOPWug0jWLU6JTRpHE6gTKrhfgYnZ7yoTG3v+0zmn80bmMBkQPO 7LYf28tt6Yl7cp0ocu3hCNEgMciWAuA4OiHnYUsoyMR2fQF16HUWtfE5rYpXZeBoAh uozCzuO8TBLipCbSxgMk7TYI5zWoXJNShWgu941UqYYjYK9sakJQ+IZAcjGXKbHpeS ah1AU9YcLk/IA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alexander Aring , lianhui tang , Stefan Schmidt , Sasha Levin , alex.aring@gmail.com, miquel.raynal@bootlin.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 6.2 03/30] ca8210: fix mac_len negative array access Date: Sun, 19 Mar 2023 20:52:28 -0400 Message-Id: <20230320005258.1428043-3-sashal@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230320005258.1428043-1-sashal@kernel.org> References: <20230320005258.1428043-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Aring [ Upstream commit 6c993779ea1d0cccdb3a5d7d45446dd229e610a3 ] This patch fixes a buffer overflow access of skb->data if ieee802154_hdr_peek_addrs() fails. Reported-by: lianhui tang Signed-off-by: Alexander Aring Link: https://lore.kernel.org/r/20230217042504.3303396-1-aahringo@redhat.com Signed-off-by: Stefan Schmidt Signed-off-by: Sasha Levin --- drivers/net/ieee802154/ca8210.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c index e1a569b99e4a6..0b0c6c0764fe9 100644 --- a/drivers/net/ieee802154/ca8210.c +++ b/drivers/net/ieee802154/ca8210.c @@ -1913,6 +1913,8 @@ static int ca8210_skb_tx( * packet */ mac_len = ieee802154_hdr_peek_addrs(skb, &header); + if (mac_len < 0) + return mac_len; secspec.security_level = header.sec.level; secspec.key_id_mode = header.sec.key_id_mode; -- 2.39.2