From nobody Mon Dec 15 18:18:10 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E37DFA373E for ; Mon, 24 Oct 2022 12:02:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232533AbiJXMCd (ORCPT ); Mon, 24 Oct 2022 08:02:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232671AbiJXL7c (ORCPT ); Mon, 24 Oct 2022 07:59:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A46A7C324; Mon, 24 Oct 2022 04:48:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E963061290; Mon, 24 Oct 2022 11:48:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05CB8C433D6; Mon, 24 Oct 2022 11:48:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612091; bh=31mqhKt9Gn0j2CERCn74MGBZCFxUFX+32ob2F+G9/y8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rWdKEX8mYUfeGOn7NAjKix1fuqrEvaD4+kLZePuehEeCLEmFrCrQPW56l60TNzJst ikt2ZFTdbKzYURhhLGBxdNklbKOlahhoR6CAinsVtRcA09jp9xi1RJSXXq/4W6/5Wb X1N/Vbyqky9sAblxYXc7r+HQfE4L4qByhyzdmbGA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , "fw@strlen.de, avimalin@gmail.com, Vimal Agrawal" , Florian Westphal , Vimal Agrawal Subject: [PATCH 4.14 035/210] netfilter: nf_queue: fix socket leak Date: Mon, 24 Oct 2022 13:29:12 +0200 Message-Id: <20221024112958.115275475@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vimal Agrawal Removal of the sock_hold got lost when backporting commit 4d05239203fa ("netfilter: nf_queue: fix possible use-after-free") to 4.14 This was causing a socket leak and was caught by kmemleak. Tested by running kmemleak again with this fix. Fixes: ef97921ccdc2 ("netfilter: nf_queue: fix possible use-after-free") in= 4.14 Signed-off-by: Vimal Agrawal Reviewed-by: Florian Westphal --- net/netfilter/nf_queue.c | 2 -- 1 file changed, 2 deletions(-) --- a/net/netfilter/nf_queue.c +++ b/net/netfilter/nf_queue.c @@ -91,8 +91,6 @@ bool nf_queue_entry_get_refs(struct nf_q dev_hold(state->in); if (state->out) dev_hold(state->out); - if (state->sk) - sock_hold(state->sk); #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) if (entry->skb->nf_bridge) { struct net_device *physdev;