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 X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_MUTT 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 81D1DC31E5B for ; Mon, 17 Jun 2019 21:35:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5DC7720673 for ; Mon, 17 Jun 2019 21:35:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728711AbfFQVe6 (ORCPT ); Mon, 17 Jun 2019 17:34:58 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:33698 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726248AbfFQVez (ORCPT ); Mon, 17 Jun 2019 17:34:55 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1hczH8-0008LW-Jk; Mon, 17 Jun 2019 21:34:50 +0000 Date: Mon, 17 Jun 2019 22:34:50 +0100 From: Al Viro To: Eric Biggers Cc: David Howells , linux-fsdevel@vger.kernel.org, Mark Rutland , linux-kernel@vger.kernel.org Subject: Re: [PATCH] vfs: fsmount: add missing mntget() Message-ID: <20190617213450.GW17978@ZenIV.linux.org.uk> References: <20190610183031.GE63833@gmail.com> <20190612184313.143456-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190612184313.143456-1-ebiggers@kernel.org> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Wed, Jun 12, 2019 at 11:43:13AM -0700, Eric Biggers wrote: > From: Eric Biggers > > sys_fsmount() needs to take a reference to the new mount when adding it > to the anonymous mount namespace. Otherwise the filesystem can be > unmounted while it's still in use, as found by syzkaller. > > Reported-by: Mark Rutland > Reported-by: syzbot+99de05d099a170867f22@syzkaller.appspotmail.com > Reported-by: syzbot+7008b8b8ba7df475fdc8@syzkaller.appspotmail.com > Fixes: 93766fbd2696 ("vfs: syscall: Add fsmount() to create a mount for a superblock") > Signed-off-by: Eric Biggers > --- > fs/namespace.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/fs/namespace.c b/fs/namespace.c > index b26778bdc236e..5dc137a22d406 100644 > --- a/fs/namespace.c > +++ b/fs/namespace.c > @@ -3445,6 +3445,7 @@ SYSCALL_DEFINE3(fsmount, int, fs_fd, unsigned int, flags, > ns->root = mnt; > ns->mounts = 1; > list_add(&mnt->mnt_list, &ns->list); > + mntget(newmount.mnt); > > /* Attach to an apparent O_PATH fd with a note that we need to unmount > * it, not just simply put it. Nice catch... Applied, with apologies for having been MIA lately.