From mboxrd@z Thu Jan 1 00:00:00 1970 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 D9095C4332F for ; Mon, 12 Dec 2022 13:32:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232182AbiLLNcj (ORCPT ); Mon, 12 Dec 2022 08:32:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229923AbiLLNci (ORCPT ); Mon, 12 Dec 2022 08:32:38 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FABA287 for ; Mon, 12 Dec 2022 05:32:36 -0800 (PST) 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 sin.source.kernel.org (Postfix) with ESMTPS id DD854CE0F76 for ; Mon, 12 Dec 2022 13:32:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2281C433EF; Mon, 12 Dec 2022 13:32:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1670851953; bh=Jh2piPD20CzMS/ThY6FZ6rKFY8ViEP27FHzCG0vLpF4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MXEdIcgUcrpZ4f+0lVIdAy0k6a5D31CRr3s+kjK048Ef1ZeDf52ufHupaqqGJ1Vo1 QgQM0YJsvb9FL/0YOIXScEK+09LXKy2NWCQ6gAituEZVdt0Rz4lW89N+GBq5+n844s A4ONdu0EWeZnStt0RS0ysOzi1LTltKpnxoebpMM8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, YueHaibing , Paolo Abeni , Sasha Levin Subject: [PATCH 5.15 104/123] tipc: Fix potential OOB in tipc_link_proto_rcv() Date: Mon, 12 Dec 2022 14:17:50 +0100 Message-Id: <20221212130931.592672938@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221212130926.811961601@linuxfoundation.org> References: <20221212130926.811961601@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: YueHaibing [ Upstream commit 743117a997bbd4840e827295c07e59bcd7f7caa3 ] Fix the potential risk of OOB if skb_linearize() fails in tipc_link_proto_rcv(). Fixes: 5cbb28a4bf65 ("tipc: linearize arriving NAME_DISTR and LINK_PROTO buffers") Signed-off-by: YueHaibing Link: https://lore.kernel.org/r/20221203094635.29024-1-yuehaibing@huawei.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/tipc/link.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/tipc/link.c b/net/tipc/link.c index 115a4a7950f5..8fdd3b23bd12 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -2223,7 +2223,9 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb, if (tipc_own_addr(l->net) > msg_prevnode(hdr)) l->net_plane = msg_net_plane(hdr); - skb_linearize(skb); + if (skb_linearize(skb)) + goto exit; + hdr = buf_msg(skb); data = msg_data(hdr); -- 2.35.1