From patchwork Mon Oct 24 11:29:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8568 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp418044wru; Mon, 24 Oct 2022 05:14:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5QtFTog2iHMnAz3i/tyr6KILmIbV3GyEwb5gkfsHGBS3agw/7MYjI53sRpU/u+cnJ4rMFo X-Received: by 2002:a17:906:8451:b0:78d:d467:55a4 with SMTP id e17-20020a170906845100b0078dd46755a4mr27025846ejy.352.1666613641825; Mon, 24 Oct 2022 05:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613641; cv=none; d=google.com; s=arc-20160816; b=xPL1XGpfZ35hVPdq5BQJ2ChCk1uTsrFpq3S+LH1/DhBIoiSKdCrT57SfpDVf1MV2wP gCVXDESgwINP4SoM+HNiRmjVb8Ho1rnLdtr0yCBQnj1ZOQn52TOFF1zjRfsgNnAmu2/n 7dOHO0U0DNgYcX7K8XErzDKUF9o3kGTTlzfecuE2xsuIxce4ks6Uw0pqcvWieN+EvdPA COTRLCdPQTZxSjqDjbwq0NHZEbRQjj1ntYMeMPTAq/3mV3JgvKAJPepMHKPc8iPrQqp9 dCZDaqZYq8U5Oa5agPMJ4YmUfLpNsamhHWu8cdGHWSsazQlCs3MOk3WNy/90MLldlc61 YE3w== 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=qfgTcnZKFZZJTGpSGImM+5zOql8T6No8AYNSY1VULUE=; b=A4IQa4lY/AXb7Tn+JePph5/IEEbjUWPcZ8INO3A/vCqV6UaNRpQcUuImo1kYxCL9x9 lxrXmUwH48dccWMYSLzdInyzElIfiJ7bmK4pFcbf9VFPYT+fKQzDM8VGFVyzIKrWJxAE 9ZleK9l5+rh/EbCxNNpYBOR8FhnOY4W6zUo3AufRbSWidAlLRg3Ds8px2mSO+GGDkSL/ EimGHsBKdhcwG2NDEb4b0t/b6iN4ltjmNdatBFdPVq45Y6oofjykIlXFJhplyQi3iAdq gYR7s37CBWOzSjlCOzmmLKZ874cyIOoICKO6FP6G0KLWHvuA/CwXH3hJOlbIP6tPiA4c NPdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rWdKEX8m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di17-20020a170906731100b0078d8f2658e3si30829547ejc.833.2022.10.24.05.13.35; Mon, 24 Oct 2022 05:14:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rWdKEX8m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232405AbiJXMCb (ORCPT + 99 others); Mon, 24 Oct 2022 08:02:31 -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 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571066377329421?= X-GMAIL-MSGID: =?utf-8?q?1747571066377329421?= 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;