Received: by 2002:a17:90a:88:0:0:0:0 with SMTP id a8csp4589134pja; Thu, 21 Nov 2019 22:24:21 -0800 (PST) X-Google-Smtp-Source: APXvYqyWl116pLQLgwnY2awxaSi/dhVP1J5Dh5I/ucm2o8qIBe7OZKoakpeIQ45n9nQgD3OOt8/V X-Received: by 2002:a17:906:1b41:: with SMTP id p1mr19638025ejg.65.1574403861691; Thu, 21 Nov 2019 22:24:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574403861; cv=none; d=google.com; s=arc-20160816; b=tLYyNLU/LTPCArowmzhxGhgv7/b8mLZMCSxZ7MZOeI1Yxct6VcHtNtMeJNZrFCghLR hiLrkps4AcOdCKepO8ZJ3NONQZS4wdkyXHg+RN2RjhyKa2CzWv+bT/5VGkihCRM82Uaa gaHekqjIA/qNuBFRgHUiGkGlevtP46tNHJWMGdgmypY/E2mx4PoKKgr7Fu/OGws2vTCC swN2BzSvEgI+rhBePv0Nrdl+Clm+10+oXChWI2mjADWi+UvMkvkr+tAuAuuebxRYHuEL rAGvHC/5R6CZWfwFVCtwRJBFEjkUNCCz9EKPvARSouooitL7zaWWgccVH9d6DADc2Gt6 0yxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cx1N/YHM6+smXizB5Zb+1W5TIsNpcwTZjGwi0IIVr/8=; b=d21M6ct6IBdOOeZ7xAX9yDmv4aso8Lrq1rGp6zz7aMSaKMDvZajE5bNTY1OzWcOKau SMXmCRBcxaTrpfpfxdM55fAYkvP61F/EnX5kpvWhSUnDtehSPHaaWkI0aFUKJgB6ffWL OkgMS6l2U2BOz0N01DDh+tCSB0Hg0z5x/PMiQvH8jDBsUdag8tWUVKvGo5L0mSwBYs3a ct3nR7lNFNjDP3m3w8dBaSZW87SWOGcrtOFJvJ6/gt3NGeqVeSSWtdpr/fNhR/sRQmhL Hr6ZqJWqAWmhPEyk3ntNaE1BqRtJa1WTwArM37+66hRbrPv4AvLZPtHT0JDqwgg8uD/M LO1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ejXSKt8l; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q8si3582994ejt.321.2019.11.21.22.23.58; Thu, 21 Nov 2019 22:24:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ejXSKt8l; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729507AbfKVGVp (ORCPT + 99 others); Fri, 22 Nov 2019 01:21:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:57766 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728442AbfKVFwN (ORCPT ); Fri, 22 Nov 2019 00:52:13 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 89E892084B; Fri, 22 Nov 2019 05:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574401932; bh=MBxeDnP2vJ6YQSAW4kvOLr2ixbZPyUPv7eGEKXCsK1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ejXSKt8lgPc8c3+6bJPLR1zllH7ErlFYereR1p0lfrqdRBG43An9XLdKqZ44JD+tl rMoD3uvXsYT95LwPj3RNo40r0WzYFQjqmywq1ZKPb5d1b4Df6deF6H//pTDTiUwS7B b64GM4prghzxpsEcIDMXxm+olrEg97zHMkp37C9A= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kangjie Lu , Pablo Neira Ayuso , Sasha Levin , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 158/219] netfilter: nf_tables: fix a missing check of nla_put_failure Date: Fri, 22 Nov 2019 00:48:10 -0500 Message-Id: <20191122054911.1750-151-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191122054911.1750-1-sashal@kernel.org> References: <20191122054911.1750-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kangjie Lu [ Upstream commit eb8950861c1bfd3eecc8f6faad213e3bca0dc395 ] If nla_nest_start() may fail. The fix checks its return value and goes to nla_put_failure if it fails. Signed-off-by: Kangjie Lu Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nf_tables_api.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 24fddf0322790..4c1a88b7ba285 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -5735,6 +5735,8 @@ static int nf_tables_fill_flowtable_info(struct sk_buff *skb, struct net *net, goto nla_put_failure; nest = nla_nest_start(skb, NFTA_FLOWTABLE_HOOK); + if (!nest) + goto nla_put_failure; if (nla_put_be32(skb, NFTA_FLOWTABLE_HOOK_NUM, htonl(flowtable->hooknum)) || nla_put_be32(skb, NFTA_FLOWTABLE_HOOK_PRIORITY, htonl(flowtable->priority))) goto nla_put_failure; -- 2.20.1