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=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 49D44ECE599 for ; Thu, 17 Oct 2019 03:15:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0B3272053B for ; Thu, 17 Oct 2019 03:15:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389117AbfJQDPs (ORCPT ); Wed, 16 Oct 2019 23:15:48 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:60134 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387811AbfJQDPs (ORCPT ); Wed, 16 Oct 2019 23:15:48 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iKwGQ-0002Uj-91; Thu, 17 Oct 2019 03:15:46 +0000 Date: Thu, 17 Oct 2019 04:15:46 +0100 From: Al Viro To: Eric Biggers Cc: linux-fsdevel@vger.kernel.org, Deepa Dinamani , Arnd Bergmann , Jeff Layton Subject: Re: [PATCH v2] fs/namespace.c: fix use-after-free of mount in mnt_warn_timestamp_expiry() Message-ID: <20191017031546.GT26530@ZenIV.linux.org.uk> References: <20191017024814.61980-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191017024814.61980-1-ebiggers@kernel.org> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Wed, Oct 16, 2019 at 07:48:14PM -0700, Eric Biggers wrote: > From: Eric Biggers > > After do_add_mount() returns success, the caller doesn't hold a > reference to the 'struct mount' anymore. So it's invalid to access it > in mnt_warn_timestamp_expiry(). > > Fix it by calling mnt_warn_timestamp_expiry() before do_add_mount() > rather than after, and adjusting the warning message accordingly. > > Reported-by: syzbot+da4f525235510683d855@syzkaller.appspotmail.com > Fixes: f8b92ba67c5d ("mount: Add mount warning for impending timestamp expiry") > Signed-off-by: Eric Biggers Applied to #fixes and pushed