From mboxrd@z Thu Jan 1 00:00:00 1970 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 BF66EC433EF for ; Fri, 20 May 2022 19:04:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238298AbiETTEM (ORCPT ); Fri, 20 May 2022 15:04:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238016AbiETTEL (ORCPT ); Fri, 20 May 2022 15:04:11 -0400 Received: from out02.mta.xmission.com (out02.mta.xmission.com [166.70.13.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79323197F4A for ; Fri, 20 May 2022 12:04:10 -0700 (PDT) Received: from in02.mta.xmission.com ([166.70.13.52]:40898) by out02.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1ns7uz-007P6t-8T; Fri, 20 May 2022 13:04:09 -0600 Received: from ip68-227-174-4.om.om.cox.net ([68.227.174.4]:38890 helo=email.froward.int.ebiederm.org.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1ns7uy-00BJgy-FH; Fri, 20 May 2022 13:04:08 -0600 From: "Eric W. Biederman" To: Al Viro Cc: linux-fsdevel@vger.kernel.org References: Date: Fri, 20 May 2022 14:02:52 -0500 In-Reply-To: (Al Viro's message of "Fri, 20 May 2022 03:23:20 +0000") Message-ID: <87sfp410yr.fsf@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1ns7uy-00BJgy-FH;;;mid=<87sfp410yr.fsf@email.froward.int.ebiederm.org>;;;hst=in02.mta.xmission.com;;;ip=68.227.174.4;;;frm=ebiederm@xmission.com;;;spf=softfail X-XM-AID: U2FsdGVkX19hUt5PX5r2PctvKeDUOFTcDRpufrY4wtY= X-SA-Exim-Connect-IP: 68.227.174.4 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: Re: [PATCH] blob_to_mnt(): kern_unmount() is needed to undo kern_mount() X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Al Viro writes: > plain mntput() won't do. > > Signed-off-by: Al Viro Reviewed-by: "Eric W. Biederman" It is already performing kern_unmount on the happy path so I don't see how it will be a problem to call kern_unmount on a failure path. Do you want to merge this through your tree? > kernel/usermode_driver.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/usermode_driver.c b/kernel/usermode_driver.c > index 9dae1f648713..8303f4c7ca71 100644 > --- a/kernel/usermode_driver.c > +++ b/kernel/usermode_driver.c > @@ -28,7 +28,7 @@ static struct vfsmount *blob_to_mnt(const void *data, size_t len, const char *na > > file = file_open_root_mnt(mnt, name, O_CREAT | O_WRONLY, 0700); > if (IS_ERR(file)) { > - mntput(mnt); > + kern_unmount(mnt); > return ERR_CAST(file); > } > > @@ -38,7 +38,7 @@ static struct vfsmount *blob_to_mnt(const void *data, size_t len, const char *na > if (err >= 0) > err = -ENOMEM; > filp_close(file, NULL); > - mntput(mnt); > + kern_unmount(mnt); > return ERR_PTR(err); > }