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 9A36C28ED for ; Mon, 12 Dec 2022 13:17:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAFEFC433D2; Mon, 12 Dec 2022 13:17:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1670851037; bh=bCN6cv5/ItPsYZLFOCQI7M2+btaScRh43UXzrkj45Kw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OOrxIj2uaFJwHpcV746rxn13XUwRGKhGGgeUimMnXNGe7Ej8jKovBVOsapeVQFYh3 9KTc8zTbU9Ywdp2g19cxzrB6ug5AYnSx8JJ9q69iX+1w41gRF+b8vdef9ICLG5eAsz aJmETTnk+o6hsD6UQelnBqrMBZz4C68qAH0CE00g= 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.10 095/106] tipc: Fix potential OOB in tipc_link_proto_rcv() Date: Mon, 12 Dec 2022 14:10:38 +0100 Message-Id: <20221212130929.008675825@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221212130924.863767275@linuxfoundation.org> References: <20221212130924.863767275@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: 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 064fdb8e50e1..c1e56d1f21b3 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -2188,7 +2188,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