Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp422102pxk; Fri, 11 Sep 2020 10:25:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwr/mi+DLvm5gziak9D+vn+afagt2kFHa5ZsnlGzywkB/pyouvXqafY6Gi4tuQWWr4MbsEw X-Received: by 2002:a17:906:4101:: with SMTP id j1mr2923646ejk.473.1599845148336; Fri, 11 Sep 2020 10:25:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599845148; cv=none; d=google.com; s=arc-20160816; b=vpxiHZbCokAHUxlZkNToFEPBvHPOnEjlv59eAczwDF1lpooSrJExK8fmEclS6hMklM 5ZgGs0G4NX8lIWWyfFyMfrM0ZdyY65beMRsUVr6ppEoFqgSDqkIIeASSw38x/20JaBqw Q4dDkHABxOw15Gmgy/E/ADVHk8kJwOEv6/RTu7SVKopmZNlJqVTx4ode74APqNtDB6eU sQgbF5bwmguB6SV/ukVBbhVn2P8aQo8sRFFayog1z3PMMH2VzH4/9bCTskGCvw2RrI2R Yj4gvE7/AqwYUCtL53JB3jFR1Cgurp0g08PWK6obo1/HyRZlY0ogjAUB/IxkE8aunyN1 foow== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JCWzXeyjb2Jx8O9sF1SOC78lPd4ul75udHR45WlmuSQ=; b=z15vZhMde7g2wifwnOKlUNNuNc0Ecb/vlNZthBgtf85ZkTLNlHJLOl24EhMvvVv4/n 0reZZgmb0xqUXESYufCXGoYuv7YwSO9ONzOyYFkxpRu5SfIz+k5aJneiXXB6UaMQ0tPZ 2lcY2Fh5VnSmjn76o+/ZQ5sgLD24BjjEYG0LlTQgOZhWtLJL8oBnfQiIeo4iqH/rxrjJ 2GJ7pcn+Lq9oWCZI+epy+c2JDFAY0ifPIxsrhDVDhq4s5YyIVD9q3tCeh/I2UkNqibJr OSIvDysu98iFsmY0MljTDSlVfOHlZ8K216saWMEaJhjRkLiSTVwSx4UnvZ09qzluevnk lSlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Kz2XP1OA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y3si1726544edr.538.2020.09.11.10.25.25; Fri, 11 Sep 2020 10:25:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Kz2XP1OA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726412AbgIKRYe (ORCPT + 99 others); Fri, 11 Sep 2020 13:24:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:52674 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbgIKNAK (ORCPT ); Fri, 11 Sep 2020 09:00:10 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7D30222263; Fri, 11 Sep 2020 12:56:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599828969; bh=tutpJv4yPcYQeyqt2c+UyoR8XdKN6VrrzXnEMfV574s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kz2XP1OAQGuOKO4KF0LQu56cP4N+MpVabhdkkTcNWlaDynDj3bJOqfTg+NNvl9UTS HXT5GFEPzYIbQDIsz1zyBRjcUnh2q0QXnUD7+F9xMAvr9q9oMuRDvuJaamEkT+87Gd 3m4u/5Z/1lNGL9wmQoRqrb43easQZB/DXNnZZZk4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 4.9 15/71] netfilter: nf_tables: add NFTA_SET_USERDATA if not null Date: Fri, 11 Sep 2020 14:45:59 +0200 Message-Id: <20200911122505.705776891@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200911122504.928931589@linuxfoundation.org> References: <20200911122504.928931589@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pablo Neira Ayuso [ Upstream commit 6f03bf43ee05b31d3822def2a80f11b3591c55b3 ] Kernel sends an empty NFTA_SET_USERDATA attribute with no value if userspace adds a set with no NFTA_SET_USERDATA attribute. Fixes: e6d8ecac9e68 ("netfilter: nf_tables: Add new attributes into nft_set to store user data.") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nf_tables_api.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 2fa1c4f2e94e0..ec460aedfc617 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -2592,7 +2592,8 @@ static int nf_tables_fill_set(struct sk_buff *skb, const struct nft_ctx *ctx, goto nla_put_failure; } - if (nla_put(skb, NFTA_SET_USERDATA, set->udlen, set->udata)) + if (set->udata && + nla_put(skb, NFTA_SET_USERDATA, set->udlen, set->udata)) goto nla_put_failure; desc = nla_nest_start(skb, NFTA_SET_DESC); -- 2.25.1