From patchwork Mon Aug 17 15:16:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 266167 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61A7DC433E5 for ; Mon, 17 Aug 2020 18:42:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 43A1620578 for ; Mon, 17 Aug 2020 18:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597689767; bh=WlvDQtskn6xwf+z4ILMfovV5b5YPGWtu3a6oWPARq3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ye+Pq1XDcyvqX8a4fZ8rhJta1yNf05oY+W15+qkPe5Wxn65fCxxctp2V3i2QzsbHC Ncv8O3BzrwbJJV2LzySWI19BSMi7iUh0KBOs8FlPuzo+q1YUq39XN6nAd9AOYG07mT WWC6IiUDax3k6mX/p3zC/kYlWKWJBuQblqCHk5iI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731700AbgHQSmd (ORCPT ); Mon, 17 Aug 2020 14:42:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:44782 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388105AbgHQP5N (ORCPT ); Mon, 17 Aug 2020 11:57:13 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 1C19A206FA; Mon, 17 Aug 2020 15:57:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597679832; bh=WlvDQtskn6xwf+z4ILMfovV5b5YPGWtu3a6oWPARq3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Txm4JtHTyDoxkxct/nDlYKAxoSncqm5AX8rt1JkA/mwDA+k8DNAYGDSLw1ZMmfT4S OTmJW8nCfsrlo2+aCye7L42ap1tdUe+0I4TkcsP5mFwjfL7j5rOrFqFJcEPqps/hUC IVx3TJtci/JFp46wbppoI+MsX86t7K0QXrLAIE3M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaohe Lin , "David S. Miller" Subject: [PATCH 5.7 322/393] net: Set fput_needed iff FDPUT_FPUT is set Date: Mon, 17 Aug 2020 17:16:12 +0200 Message-Id: <20200817143835.219920420@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143819.579311991@linuxfoundation.org> References: <20200817143819.579311991@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Miaohe Lin [ Upstream commit ce787a5a074a86f76f5d3fd804fa78e01bfb9e89 ] We should fput() file iff FDPUT_FPUT is set. So we should set fput_needed accordingly. Fixes: 00e188ef6a7e ("sockfd_lookup_light(): switch to fdget^W^Waway from fget_light") Signed-off-by: Miaohe Lin Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/socket.c +++ b/net/socket.c @@ -500,7 +500,7 @@ static struct socket *sockfd_lookup_ligh if (f.file) { sock = sock_from_file(f.file, err); if (likely(sock)) { - *fput_needed = f.flags; + *fput_needed = f.flags & FDPUT_FPUT; return sock; } fdput(f);