Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3083641pxj; Mon, 17 May 2021 17:21:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmR6mYtsZ/UkVobFB7aeOnLHa58m3cdBTut5Nx9g0TtScy6lrFfRIgHLH2/ZD0Xnrrn8eS X-Received: by 2002:a05:6402:4313:: with SMTP id m19mr3354819edc.263.1621297265961; Mon, 17 May 2021 17:21:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621297265; cv=none; d=google.com; s=arc-20160816; b=WdNd5xiTd+EKS3s7U72tPOgLTYeA2S7BGBl+RWebhRuLzwa5oaS5bVLoQcwJSsEONG 6x/84cf+3XVlqLa68h4yNitUwqh+Y18cW6xRdATksKSXhr6zmtYwvPaGqFaRBMc79GSH cx/y/JHfON/QTjg/G7z/Pm8OaKXHmZduWVo1Yx9YNDL0A3fUHXKhnVHC7ad2CfnLCriA sjqfNWxFW4qcWUZrAaSjC28FMER8kvvndyW5Rd1VQ7RMgd9PP48JOLR3h0hBZe6s/htT o5hdVY2BI8A0A9bubv9uEUC8n+t7F3w/SlPmqsVpEMOBoCqLNnfe4IoUvGIYE8UOJXCU jV6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=q1R8AYZ4jSRzaa+LXQv6mu8wtAO4Ru5ffI7llTfgbT0=; b=NuLEEEY2q9peBpyM8YQ+DHvTlBSbPpC3bttoyjAl0cyrJpMO+uUq29NgcuteBVROT+ e6fBVAHHDgn3nGcXJAMG+wcLOc+QQqa5RI0InaUbJBZnNfaMOWjwTGP1gL2R+9x6ivkq mVFQf6Nr4Bg1s69FetoDMXgHqgLFRK8UJU3rK44/Z6bL+sWjbe4kncJUzWQhO+i0ypgH 09ssgWwXjm6Fg0CECcxnXLHUNjD9oDznueoBEnasy4P0lcn4+yWjvjR0SUAff7gjSVWW I/pfAwRDtMqj9vfgnhnZ3/XJ0XS5oP5c+0vCN7FQ7sOWMQoOA462lnXByEPhRK0y/RTu YUog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sh1Wn8nG; 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=pass (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 c14si4023128eds.262.2021.05.17.17.20.36; Mon, 17 May 2021 17:21:05 -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=@linuxfoundation.org header.s=korg header.b=sh1Wn8nG; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235151AbhEQO2W (ORCPT + 99 others); Mon, 17 May 2021 10:28:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:53274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239468AbhEQOYM (ORCPT ); Mon, 17 May 2021 10:24:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 67C3461490; Mon, 17 May 2021 14:12:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260760; bh=wuRt4dIozs2nkiRcydicwYoN/2uf7Z/ki0uZbwMB0qw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sh1Wn8nG0w2nKyxSrUlZp/AYC85knzELumGBu0FmW0zX83hKENbMWVXc4f+ZJKRkt rcT+7baAp0vtjCLw0e68JRoQqpe51qd8REsESVDmi6pPCMmWyhVismh5oET7joG5nB dEVIKB540xr24b3upfwGDp+VSrxTaoCh/EpvWI4I= 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 5.12 229/363] netfilter: nftables: Fix a memleak from userdata error path in new objects Date: Mon, 17 May 2021 16:01:35 +0200 Message-Id: <20210517140310.326390563@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pablo Neira Ayuso [ Upstream commit 85dfd816fabfc16e71786eda0a33a7046688b5b0 ] Release object name if userdata allocation fails. Fixes: b131c96496b3 ("netfilter: nf_tables: add userdata support for nft_object") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nf_tables_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 589d2f6978d3..878ed49d0c56 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -6246,9 +6246,9 @@ err_obj_ht: INIT_LIST_HEAD(&obj->list); return err; err_trans: - kfree(obj->key.name); -err_userdata: kfree(obj->udata); +err_userdata: + kfree(obj->key.name); err_strdup: if (obj->ops->destroy) obj->ops->destroy(&ctx, obj); -- 2.30.2