Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4154878pxk; Tue, 8 Sep 2020 12:05:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFivF9h2oNygtg9WkbqGwWjvbgVz7eQ4KGbnvEia2NY+cK15gTsST00mB+vTGpvqkeGxm4 X-Received: by 2002:a05:6402:1612:: with SMTP id f18mr465378edv.166.1599591903519; Tue, 08 Sep 2020 12:05:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599591903; cv=none; d=google.com; s=arc-20160816; b=MMppAcr7fOPzZDLjIYp9eisACUyIYxVogim8RGISnaS0XNC2/UYvSW2lp4k0VXgdCg adC/Gxv8NJcGuZU6A4N3GhkIBvhucA3A0IQcHXLOalIZTvkpmuB5dL5BNuJQE3kVRJ+U +phOUz8yJ9n9mcL7KTkq9+10DRegx9z1RE30qXIZMWCza6DwPUMDDW9W0xEH+DUNs56Y c+5ofdBdmxkyQA53s7ud4UwsnvWYysTEkAyHpCFan/9DVHGNeH/WH0dxHqUEUpRaHy1J KPm/xZLSxpLeAC11kiBusGsikrfTJPxBpYXiVd5aZ2tFiJfviZg45/EZPpHrF5IeqYDn WFrg== 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=QO9Mt8aIUNqOHTAt3wlProbHaFt9gjcxGCiHLcwuT9A=; b=vd9OuKhyPbug8wo//r7o99LYWstonJ1CXv0NXNzNrY9IwRv56TwPOa3e2WrafyPF+E PaBo2zzNyTWDYffLs+XLsSXVEcYRDo0ltALWqelgmme8a5MQWXc1UOB7qCGOh3BHVORx kBNHgF9SZcb/rLu829exrIQmWk6azjke0WaIqVTrxHGa9f5JZvLna08PPcwU1ZNTZIDY Srd4Hl4EdcUAULpt3A0nlWFsjXLGoLnpDzTKGOneEO64oji49SEmtSIxbZHthQg9JpXt bT0nYD+HZ2mc6Z9JN/jPFGLrhUAGIrTDKEV2hFbxo9kXb+9hltIXuyQG5fv3twc6xQNj wCWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TFBkf6HV; 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 ay17si13415962ejb.345.2020.09.08.12.04.41; Tue, 08 Sep 2020 12:05:03 -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=TFBkf6HV; 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 S1731620AbgIHTCC (ORCPT + 99 others); Tue, 8 Sep 2020 15:02:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:55370 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731299AbgIHQIC (ORCPT ); Tue, 8 Sep 2020 12:08:02 -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 86B1D23F29; Tue, 8 Sep 2020 15:47:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599580077; bh=0LqWoAMTDVTi6P5umePYj3H33FsjHcOlTcZezQbEpS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TFBkf6HVXUQs7RqxbZD6eypg0B9fDf2oaWpzjC3vRuyhjH9ueAYB4uYFY0FzsoZnD KmiJjkG1bz2b3nMmAq5aupO9Z8TtRoKM5n7fB1+chrr5mgAzrfonyDFyEdwgfatd49 H41hetkAZfq9goNxLOwEnl0E7uv5SNxz2EHBdVMo= 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.19 22/88] netfilter: nf_tables: add NFTA_SET_USERDATA if not null Date: Tue, 8 Sep 2020 17:25:23 +0200 Message-Id: <20200908152222.183987749@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152221.082184905@linuxfoundation.org> References: <20200908152221.082184905@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 1b8a53081632f..159ec1533c980 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -3204,7 +3204,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