Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1627507iob; Thu, 5 May 2022 05:27:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbPT03f6nI8wlvMJYau3ygnpZO5qSulVCwSUNloDaCfMjrlmzVq3Khk/lvzeup+Tk7CKgU X-Received: by 2002:a17:906:6a29:b0:6f4:3389:9094 with SMTP id qw41-20020a1709066a2900b006f433899094mr22182167ejc.323.1651753638733; Thu, 05 May 2022 05:27:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651753638; cv=none; d=google.com; s=arc-20160816; b=LLiM6OH31Cl44WYv6e/vTIZg02f03slzqPzVSjJ5qXb++wNItxTcAHZeQPvfr2w8MD X0hAPNZD+KFOTX5+KHAckNNHexRZl1Lgx7CIsT2z97OcS7tB3UW2UG0+UQ7MFHQ7ME0i hH2AkKCyijg6LuAOoCMVjxo+wuEytK2shh/A/yK3NJYfZt90r66AfZ1JenLPFWE0ACTS afIeeSH+s+eVtIiz6Io+jJ29q2HcE5lHiPxkjEF///jt3TV7ubbi3nmnjsF5YgiE8PeM ER6Qv8o2W5PBSPcUXOeEspE3p+j7F/P5sJ5QhOqnC5gga5UM3EUwiQk/azkaQIIWTmrY PAmw== 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=DZ70NBNVUBQF3JXk1Fv/uFb0XUCn3KBuAJAecl3A+N8=; b=klwO4/mCLDbT3oABYGNtgAFYK6jRN/drjfc4I0tz8fUMk1yilmeDO9SQzAtrSPHwjh D4hziWbx2JdkHACobw1w82eIeZc30cSma7XnqNlylqycWWDfziF67SI8ErfyHYH6YkB7 tNleDPoXqBi7N8mDiRMXCKGCxOOInnGksITYt7F+tmXkyI/nsETmBAfDsIEBIge3qD9+ SACyQDCvF8mRXNdQmUVGmsG9fdkh37OOZenYWd64prvMJK3isUQFm13qylW7ygD+ttM2 GevMnBjIVtIyS34l8UbIkS5HUuof1Kfb3Zd6zshEgQDixo5DanT+KTv47ABloOIdf9IN bpgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vZ+7BeYA; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v11-20020a50f08b000000b0042824992221si1854918edl.132.2022.05.05.05.26.52; Thu, 05 May 2022 05:27:18 -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=vZ+7BeYA; 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 S1358472AbiEDRea (ORCPT + 99 others); Wed, 4 May 2022 13:34:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355854AbiEDRIx (ORCPT ); Wed, 4 May 2022 13:08:53 -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 CE84D517EF; Wed, 4 May 2022 09:54:39 -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 54005617DE; Wed, 4 May 2022 16:54:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2186C385A4; Wed, 4 May 2022 16:54:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683278; bh=pH8kHLg29q84DA3lAKF1knzAlPKUewGQtsmALlQhDkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vZ+7BeYAlPHdnlzNgC7qPe+tcOz9IRzGJ0j/Mdum+OMtQltGTr6pTY+871Gy6yY4l c0r6NhMZ18xPK4Y8TidQMZm0oN0kuBWU99JfByTlsYqrgbNNsO+R0VkjjSKwnLAbQW 8moYuBYy9EhvAbffbO6IkQRdF56+4bAVbEpt8Mz0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namjae Jeon , Hyunchul Lee , Steve French , Sasha Levin Subject: [PATCH 5.15 131/177] ksmbd: increment reference count of parent fp Date: Wed, 4 May 2022 18:45:24 +0200 Message-Id: <20220504153104.887434253@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153053.873100034@linuxfoundation.org> References: <20220504153053.873100034@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 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,T_SCC_BODY_TEXT_LINE 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 From: Namjae Jeon [ Upstream commit 8510a043d334ecdf83d4604782f288db6bf21d60 ] Add missing increment reference count of parent fp in ksmbd_lookup_fd_inode(). Signed-off-by: Namjae Jeon Reviewed-by: Hyunchul Lee Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/ksmbd/smb2pdu.c | 2 ++ fs/ksmbd/vfs_cache.c | 1 + 2 files changed, 3 insertions(+) diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c index 192d8308afc2..a9fdb47c2791 100644 --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -5768,8 +5768,10 @@ static int set_rename_info(struct ksmbd_work *work, struct ksmbd_file *fp, if (parent_fp) { if (parent_fp->daccess & FILE_DELETE_LE) { pr_err("parent dir is opened with delete access\n"); + ksmbd_fd_put(work, parent_fp); return -ESHARE; } + ksmbd_fd_put(work, parent_fp); } next: return smb2_rename(work, fp, user_ns, rename_info, diff --git a/fs/ksmbd/vfs_cache.c b/fs/ksmbd/vfs_cache.c index 29c1db66bd0f..8b873d92d785 100644 --- a/fs/ksmbd/vfs_cache.c +++ b/fs/ksmbd/vfs_cache.c @@ -497,6 +497,7 @@ struct ksmbd_file *ksmbd_lookup_fd_inode(struct inode *inode) list_for_each_entry(lfp, &ci->m_fp_list, node) { if (inode == file_inode(lfp->filp)) { atomic_dec(&ci->m_count); + lfp = ksmbd_fp_get(lfp); read_unlock(&ci->m_lock); return lfp; } -- 2.35.1