Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp505144pxj; Tue, 18 May 2021 08:11:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9JTBQfoRnArSWws2g2sPd1nI7GVcq/XIsPj//9DemmJt5cGXXQoMHot//30WyDE7a3J7o X-Received: by 2002:a17:906:b288:: with SMTP id q8mr6539054ejz.524.1621350689942; Tue, 18 May 2021 08:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621350689; cv=none; d=google.com; s=arc-20160816; b=pMF3FUoOdERUAnpnfdW2l0Jyt6dQcOFwvwL1O9MA7QEenyQ4GhGZZprA89ZaSAw1TW ftFfNVq/JOqXDSc5NxGLzGFQjKEFXbWuDDIusv8gVRpnjLiwmgZ+ijMNp5aiy+59ij4V UFIAnEneWmb4cgN7MFMkIsNFm0vAWaE1EufT30YkzJ34YKK6fr4oNPtnIjlJ5wanIAIQ 0vGLQT+7h5Hn4YuL9ABFK5/7CKw8pVTq/074Eq2X8BWYtwaBXAZ+faFu17E+of+Td/Qk Yk4LWfvpAHCSJlFtsgZSsf6XyIiWv6ovAyCgXkS9SI5D06Ve+KauVI4nSnj5Tsz7H0i3 Q7Rg== 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=s4a7cBzdb4xeteBIyLgrYoq2dy3ixe7o2kb+lFNxjEE=; b=RTiXBa/WBIJSINUxe+I42FhZTtGQvVmk3S5JsCEGaDLh3Xyh/NrbQD4Z/IOj2GPquQ M+ZC8TdqglCbxGvjurBfA0T6EBAE5Q5WDJq5vN1hNoNzndRL2x9aj2TPqVtmOe4rESu+ 0LGVp/PLoFBZ9rRjicKfYb3rWO58flTeCBpYLZCITszGpvJ6OUHQ2p2CYw57FUfBxV3R ThL1ItgxNZnN8PKdaY0kMLX/o1KzXM2RtYahcR+NnJrRmA4xEbhDsCQqXpgEeMUimQYj 1bF+Z8Cpu+E8/0vn+wVtvd8QY2u1eoxQ6kqj0pzGuWnrfFJL0YnKku5HfNutI4wm7oDH VfkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vhWuHMr7; 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 gq26si10450768ejb.113.2021.05.18.08.11.01; Tue, 18 May 2021 08:11:29 -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=vhWuHMr7; 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 S243339AbhEQPxQ (ORCPT + 99 others); Mon, 17 May 2021 11:53:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:42232 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243219AbhEQPf1 (ORCPT ); Mon, 17 May 2021 11:35:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E7D1061CE6; Mon, 17 May 2021 14:39:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262387; bh=bHYA8Dfl/fBT+THpRKXg/JP2T5wRvL428Kuetier2Xk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vhWuHMr7R/zZ0322CcCc/qRcgvOznpyxNCDexG7EAy8m5BCiXutv1c5oOHS60Pzvr iEPdEpw1FLN9kQSaqYxLg7B17R+tavamJ2Etjb3AWkifgLXFAGIa/TqS3FOpQ4pTJy lwxeGKAGa+UTZ4/AGMWzKwphC6FHU22AcHpEo/wU= 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.10 177/289] netfilter: nftables: Fix a memleak from userdata error path in new objects Date: Mon, 17 May 2021 16:01:42 +0200 Message-Id: <20210517140311.075308368@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 2e76935db2c8..7bf7bfa0c7d9 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -6015,9 +6015,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