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 B0CF28BE0 for ; Tue, 28 Mar 2023 15:09:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35601C433EF; Tue, 28 Mar 2023 15:09:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1680016161; bh=mOFnK39nTnfrFT3jQSzhgey0Tg79FNj4N/ndzPnBFzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UEs/swgEx+az2dMwkHUMZnrm3PRig8VPSXSVnTMwfzdIGnvqaeB7pc+jNIVSA3xaY JsvT7D9+LsZH4sS/rLoqNRpb5roHgGEfETrPQBn8ul35yj/cU+fBiXI2AH8/SntDr/ ngdC5h3irsYWZ+DO9kjPCuGYa1eJv/2aEWjoPp3Q= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, lianhui tang , Alexander Aring , Stefan Schmidt , Sasha Levin Subject: [PATCH 5.15 087/146] ca8210: fix mac_len negative array access Date: Tue, 28 Mar 2023 16:42:56 +0200 Message-Id: <20230328142606.314325030@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230328142602.660084725@linuxfoundation.org> References: <20230328142602.660084725@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: 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 0362917fce7a9..e2322bc3a4e9a 100644 --- a/drivers/net/ieee802154/ca8210.c +++ b/drivers/net/ieee802154/ca8210.c @@ -1956,6 +1956,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