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 96BB9C47071 for ; Thu, 16 Nov 2023 08:52:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344538AbjKPIwh (ORCPT ); Thu, 16 Nov 2023 03:52:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229806AbjKPIwf (ORCPT ); Thu, 16 Nov 2023 03:52:35 -0500 Received: from out30-124.freemail.mail.aliyun.com (out30-124.freemail.mail.aliyun.com [115.124.30.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 374CC182; Thu, 16 Nov 2023 00:52:32 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VwVkHLC_1700124749; Received: from 30.221.146.6(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VwVkHLC_1700124749) by smtp.aliyun-inc.com; Thu, 16 Nov 2023 16:52:29 +0800 Message-ID: <345e0d5c-b01b-361d-fbb1-a0c6b093431e@linux.alibaba.com> Date: Thu, 16 Nov 2023 16:52:23 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH] fs: fuse: dax: set fc->dax to NULL in fuse_dax_conn_free() Content-Language: en-US To: Hangyu Hua , miklos@szeredi.hu, vgoyal@redhat.com Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231116075726.28634-1-hbh25y@gmail.com> From: Jingbo Xu In-Reply-To: <20231116075726.28634-1-hbh25y@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/16/23 3:57 PM, Hangyu Hua wrote: > fuse_dax_conn_free() will be called when fuse_fill_super_common() fails > after fuse_dax_conn_alloc(). Then deactivate_locked_super() in > virtio_fs_get_tree() will call virtio_kill_sb() to release the discarded > superblock. This will call fuse_dax_conn_free() again in fuse_conn_put(), > resulting in a possible double free. > > Fixes: 1dd539577c42 ("virtiofs: add a mount option to enable dax") > Signed-off-by: Hangyu Hua Reviewed-by: Jingbo Xu > --- > fs/fuse/dax.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c > index 23904a6a9a96..12ef91d170bb 100644 > --- a/fs/fuse/dax.c > +++ b/fs/fuse/dax.c > @@ -1222,6 +1222,7 @@ void fuse_dax_conn_free(struct fuse_conn *fc) > if (fc->dax) { > fuse_free_dax_mem_ranges(&fc->dax->free_ranges); > kfree(fc->dax); > + fc->dax = NULL; > } > } > -- Thanks, Jingbo