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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 E0FD2C4743E for ; Tue, 8 Jun 2021 15:08:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE89760231 for ; Tue, 8 Jun 2021 15:08:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233813AbhFHPKg (ORCPT ); Tue, 8 Jun 2021 11:10:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:42574 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233740AbhFHPKe (ORCPT ); Tue, 8 Jun 2021 11:10:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623164921; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5hU1CMqJ4P0JXH4l8c0cSd/V5cHxhvWTupYmzCD3I2c=; b=eHKYetZzBvkRk5/U4/7DzBGz19n0at81HsLEzRpYZiePqQ4bQRKlCBrmKwwfGCu/Cf4KGa +nFVQayPnVgamHujB/wkNM3QjgYeGJ0dGxnLZV884TZ8Mi+2L9SrOR3d6DSRinUbNxcyNW Z9PoNKaeJCK1ZEUU1oD9h07pzbB44Eo= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-92-_-5FfqPxNSi6uE3fn6ONuQ-1; Tue, 08 Jun 2021 11:08:39 -0400 X-MC-Unique: _-5FfqPxNSi6uE3fn6ONuQ-1 Received: by mail-wr1-f71.google.com with SMTP id z4-20020adfe5440000b0290114f89c9931so9525202wrm.17 for ; Tue, 08 Jun 2021 08:08:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=5hU1CMqJ4P0JXH4l8c0cSd/V5cHxhvWTupYmzCD3I2c=; b=hgonS+prOKY0U+7StXGYFEWF5ZkUXHZs62WwE/AdoZuPrXZJfA3XEFwYudPnIujmIx vqltf8HMwBKKghuy01UDFWBM/+u/R45x/WfC7X3zFpB1eRjY8HZeAgtplZ0vwSCmeEvH ZblMD/4fQQ9r0KzVja8aqQV/crjf4Kw/VvFVczpxlzbpGIPCn0tKUmcpP4TIwHajtpXl I7FqyOpwUbwAdWaXxX/VJN9uV31c2EnBA5chzZcYNplac93VYsUpVESb0PFEoev12DGL z06Wly3JPcPHYFh/ZsgN3utQ+9UmzgvPfKLhcVbDIZ4tJVGdHvUC0DGf2ZXlU86mZ5Gl zThA== X-Gm-Message-State: AOAM530LYKeBE/zA6qpEPZ5V5EDD6wEBTSB3u+zhylPY7tQ3iFcYBSSE f/XO/nJMM+FtI0+5plStswFpG6eKuJwBIdQNflOe8Wq9xKrrU5QZd5V8u0HyD6oBlSSHJuzi+OE isNUFBi0zLtFZmq+p/X83oTED X-Received: by 2002:a1c:7c13:: with SMTP id x19mr4818689wmc.96.1623164918480; Tue, 08 Jun 2021 08:08:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziiUeOeVRaBQHznAWmWWEt/KVEstO5XqQa3xElfZkGfdt3L++vaw8Vnidve53mT64ljzbqQA== X-Received: by 2002:a1c:7c13:: with SMTP id x19mr4818667wmc.96.1623164918286; Tue, 08 Jun 2021 08:08:38 -0700 (PDT) Received: from dresden.str.redhat.com ([2a02:908:1e46:160:b272:8083:d5:bc7d]) by smtp.gmail.com with ESMTPSA id n1sm10560444wms.18.2021.06.08.08.08.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Jun 2021 08:08:37 -0700 (PDT) Subject: Re: [PATCH v2 2/7] fuse: Fix crash if superblock of submount gets killed early To: Greg Kurz , Miklos Szeredi Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, virtio-fs@redhat.com, Vivek Goyal References: <20210604161156.408496-1-groug@kaod.org> <20210604161156.408496-3-groug@kaod.org> From: Max Reitz Message-ID: <0daa30dc-ea49-dbe3-eac5-4b47dceb54eb@redhat.com> Date: Tue, 8 Jun 2021 17:08:37 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210604161156.408496-3-groug@kaod.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04.06.21 18:11, Greg Kurz wrote: > As soon as fuse_dentry_automount() does up_write(&sb->s_umount), the > superblock can theoretically be killed. If this happens before the > submount was added to the &fc->mounts list, fuse_mount_remove() later > crashes in list_del_init() because it assumes the submount to be > already there. > > Add the submount before dropping sb->s_umount to fix the inconsistency. > It is okay to nest fc->killsb under sb->s_umount, we already do this > on the ->kill_sb() path. > > Signed-off-by: Greg Kurz > --- > fs/fuse/dir.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) Reviewed-by: Max Reitz