Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp784683imm; Mon, 21 May 2018 14:23:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqHiUyy3Qe/Y3QdyLkZYpQLZgKZ08hDrTDmwzMZhbfGOpdVHAcAnp8VE4DzfubB289vka7u X-Received: by 2002:a17:902:8a91:: with SMTP id p17-v6mr7038454plo.18.1526937817010; Mon, 21 May 2018 14:23:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526937816; cv=none; d=google.com; s=arc-20160816; b=IFB2sJFvk9fsEO9b5JLI+DmI74l4VW1Or4GYghcQjMO0BHgSkYvrPK9Hietuf4LeFz YUAuGbYY1o9zajOFi7zWQfOj18g8qT1DWqeOOqkgklhx+IpooBZ1IcmjliowAsUyiSqa K3UHwia8Ewq4k7RqHDLzmdnS1/Cwim27TKq7YOZnnHAg79QYBMPi8XWOi+cPyJ9MOoK1 Og1UCvU7ySrn2nlULmDDwTTQAb1P0udUAzgr+BtrDyqMP247pX6jK7nH/qzvBmTOSnxF m0o2s+ruddIHpQlXhUCKWWSdzugp26RgzK9pUGDu+hoqfsvO+TQucNhXiZjz9INdLKIn EXow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=O1xiy+wiWyVYrlb1AOiMja60qOOZsUuc0pgWE5cyBoA=; b=iPKRu/13gccepBhI+FfZGKE+/czdGfSl9hF8C+O5OlqRAlI4NC4O5zuHP6lzAzuSLn EsPu8w7C2CLOVyYy9vQwXJklejZ2aecHM1MR8+oPvwWt8nnrjzp+gxI40PiHN5dZkR+A NaJVxMIC3E1Mp0ExGu9PqdwzuACpI/VkNkhKZh40PPnrWFZ+FsTQ2WxQtX1l7P0IXM0V GUI1Wktl3vplAugSdkggWpfTef+lOHfComRpOQG/NsdE85LPegn0gtAiyJRC39AUbev8 1nr8R5euw8qcmrwhIV5iz84F0VSMxDdeJi7OhAAsNURhP4023WezF3q/g9Yd/4A/wSnt tKlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=D/G00/Ki; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c13-v6si10557590pgq.616.2018.05.21.14.23.22; Mon, 21 May 2018 14:23:36 -0700 (PDT) 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=D/G00/Ki; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932130AbeEUVXQ (ORCPT + 99 others); Mon, 21 May 2018 17:23:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:38030 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932120AbeEUVXK (ORCPT ); Mon, 21 May 2018 17:23:10 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 0429720853; Mon, 21 May 2018 21:23:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1526937789; bh=MHb9a83HgN4aMZ8OQbI08Yv5nDvsDHNg3aMYrf8I4Tk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D/G00/Ki2neX50EmqTPt9eCxlq9VYNjyoUbFtVHhSwpVmg0uBIdFwo6fCHhJZhaWA kT/XbtjCguE5mZQGN3Vw/Zoai3cKcfsXa+ergLG/0GGbCGow6q7fqneDXnh6ykHOOt Ws+cLYqbZt6erDIWLkgQFIJkT2ghv2ef92I+IQz0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso Subject: [PATCH 4.16 026/110] netfilter: nf_tables: free set name in error path Date: Mon, 21 May 2018 23:11:23 +0200 Message-Id: <20180521210506.148651708@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180521210503.823249477@linuxfoundation.org> References: <20180521210503.823249477@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Westphal commit 2f6adf481527c8ab8033c601f55bfb5b3712b2ac upstream. set->name must be free'd here in case ops->init fails. Fixes: 387454901bd6 ("netfilter: nf_tables: Allow set names of up to 255 chars") Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nf_tables_api.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -3203,18 +3203,20 @@ static int nf_tables_newset(struct net * err = ops->init(set, &desc, nla); if (err < 0) - goto err2; + goto err3; err = nft_trans_set_add(&ctx, NFT_MSG_NEWSET, set); if (err < 0) - goto err3; + goto err4; list_add_tail_rcu(&set->list, &table->sets); table->use++; return 0; -err3: +err4: ops->destroy(set); +err3: + kfree(set->name); err2: kvfree(set); err1: