Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3009015ybi; Mon, 17 Jun 2019 14:35:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxTiaz6XMUXPcDMLgADAjidW+D9AuFx1YshlbqH/9xmbgirQOn5MqSs7F+E5lkKaGh1ml3n X-Received: by 2002:a17:902:a516:: with SMTP id s22mr70125794plq.178.1560807314831; Mon, 17 Jun 2019 14:35:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560807314; cv=none; d=google.com; s=arc-20160816; b=hCDTDl4l1+X11s3xrFFOqzn+BNQZtPjeiQwV8dK3QtWkM1dPVcvS8vPKuAx3VSZlAl VxB26MFdl0CH0TcO3Obr6RG94miP64I/GNmvRl7twKVybz02fdZ3sT6K4dy1nDmeMieI i4CnZ2x1e9Hz8bngLCtdAgn59Q0NC+FkoQ38PmQPW6ZZULrsoEHdKibBP49pTDfgDTN4 dFcsnP40aZg8jHX/tVFI1VQD8EN+PvynGur3bNHThpcMZbOH95c2WtegNr974fjiN76o C7tMq6HT4GfTXMjFwAqG3YSXgBFWnMIYk9XLDkFmZxcQg9lMdi9sWswyroNXAki0Fd0t 1RPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=pqKnkFQB87FJwtqvB+xWL4QNw5FnLiYYApss6DAanIc=; b=oVK+UPHZ5ql3skP0Qbv968NgTYvVIDCyHEcckr6uBz4tqyfwWR0ytWZZ/txatLY1nL sSVt0hHtztkK88rZjINgrTaB1Iibrff4T0zYmmvx7+AQopPSEpVvt1hYgOUnQMzrLfF8 o4pFhFW+A98BgJE0tDX9tJkX9pm6qppkTgrS0aMW0nboW3yLroaW1/T9hmVpb67Zpq3x qrkkh64kPFidQBh5oGsmcN+q5ID4dZ01dNyr1yzr/ra6bb6RS4xjW2F/55FKWyuR9a+Z WHphqzHW6soL53i2dfbl51FM/TSHXak3dyCRIsvcihksJHICFNACr+aqTYfdH1wIgmcJ s0Cw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o4si11155026pgp.476.2019.06.17.14.35.00; Mon, 17 Jun 2019 14:35:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728833AbfFQVe6 (ORCPT + 99 others); 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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.