Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp101523pxb; Fri, 15 Oct 2021 01:22:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8HCy+S9ghM8TktP5HfnqijhzzgLCugO9rx1yAf93H0B2lEwPNmDLOeTRdcD2bXvWeiYF3 X-Received: by 2002:a05:6a00:2294:b0:44d:92e:1d4d with SMTP id f20-20020a056a00229400b0044d092e1d4dmr10199105pfe.26.1634286129690; Fri, 15 Oct 2021 01:22:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634286129; cv=none; d=google.com; s=arc-20160816; b=0x14P+ysOHA3V7zu6bEYYwqXyH+ZAflqY7WCK6ldIUSSsQgqBbBq9YBoj0ZF2ZoKcX XL0mhY5XsItVlfIiBsGA/LjF7DgzkFuylFhxelqFllr5FBNh920aJe7KaX6OS8QiJO/w lVn4KLBh6uKi9RBYcYTEKmbSLQRR/Pf2zt+uJeLdRMqBXX5rLbBh4J+lfei/hugNIF9r xW+u8578Ub5luu0ng2jYFKKSS0f9mqWOT00k4despsJRaemCFwSlwJvlJ4XxmLUXhLb2 ioDGxnLPkKsOKbHqLb7le9WgAHp7XwGk3GaLHfDkXebIMZV0EZgGJ2wSIGMFayRGaLF6 5olg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=KtSR2tvDzCNz1RXAdUkMqN1214rU3gzhBqVCW7f8teA=; b=nJi1z7xmDdk7KFkee4E1wh55Lz8GzcC7shd9Vz+K9E7x+J1Hu7OLhzDOJxSOGsTOv2 qCu03V1vVMJ3qrEh1aixltlbY30L46u23XCb5qDxTY+F6eUBsS5tbxawADjkRZvsiKTD TnXXDBIqIQsGkIEcQ0C2aMh6ELfPchKHcvlA/qA+RMR2/0WqPowjHRubO2Upezkdv08C SRVGAuDBRfz8jwsJNUBu6rVQmA24m8fusTcAjvD20xetPBJgwu87N5r3UtC8qAc/ur4E E2c3IJtULgw+8BXikF7tO/NwU5/PIaXN/wWY8nlHe3S+OZM29lNckCS11HiV63KGJn4R qxwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OcW6z5+r; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id im22si6812466plb.331.2021.10.15.01.21.55; Fri, 15 Oct 2021 01:22:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OcW6z5+r; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233976AbhJOFvT (ORCPT + 99 others); Fri, 15 Oct 2021 01:51:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229706AbhJOFvS (ORCPT ); Fri, 15 Oct 2021 01:51:18 -0400 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0D80C061570; Thu, 14 Oct 2021 22:49:12 -0700 (PDT) Received: by mail-il1-x131.google.com with SMTP id i11so5953901ila.12; Thu, 14 Oct 2021 22:49:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KtSR2tvDzCNz1RXAdUkMqN1214rU3gzhBqVCW7f8teA=; b=OcW6z5+rot60yxdedv/Au44PSchJgC4IJNCHB+zwlk6MWhlmEE3hfoVkO2SKjpNKLD IKICKC/owR1kIEFJra4chM9hEc+dVYQwMB+H1G3plv/xjPEX2OPDOIz5LFlBXD2jXEl0 dNthO0esLVxWTPS25caEbVpxlWyoFIGi5cC4QrGmYetz0rK3nDRAjcdzLMm89q3Qq0nS bOYEVSq/+bFSvi4vPKdA+IMU1ls/Q3OMgGzggGEKMPfWpJBTBu2fWgbxdVzJxGPZF7DQ h7y3XR4H6akyd6YiV/eMZwHLJAo6MjEhYGbbuEtNICHfFMQdNlYPEojXqM8uTnoOQNa8 UBCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KtSR2tvDzCNz1RXAdUkMqN1214rU3gzhBqVCW7f8teA=; b=SDCTbVtyaiNRbnhbo8tIMrFNX3gAJAf8+LfE2N5TzxCszYMMf2iEPelz0GAKtsXQGQ I5OUonknTNuHow68GaZcxwgGHwBPIHRpgIu4na8N1bj23sqbEHfNTUsaNYS4DmOHVb9x yhZ+TgmCcBgV33na+85h8Okdl7tOcpy2pefkdPH0Af1XZcz0fCa+TmANsbaBcm9l4hjK lUYx02ymnzi5JKjll66cF5Pg+diC4TsYAmsOcfnc7FrspZw7NyUrrauF0CSDsRdJd01b GGNveNaqonS7MlmsW7S3X+vK+YN5L/ln7tgSgxNevZ9Tba6ALdzR7xS59pvv9Nsvpoec r6YA== X-Gm-Message-State: AOAM5326LvzS/n/e4rl2NBP//G4W95AS+NZnKJg6ipb150iyOGMVLtjF 0ESECr2ymGGw/oaROykQMHhQCgkzPPbBM14Sv7Q= X-Received: by 2002:a05:6e02:160e:: with SMTP id t14mr2539077ilu.107.1634276952113; Thu, 14 Oct 2021 22:49:12 -0700 (PDT) MIME-Version: 1.0 References: <20211014213646.1139469-1-krisman@collabora.com> <20211014213646.1139469-13-krisman@collabora.com> In-Reply-To: <20211014213646.1139469-13-krisman@collabora.com> From: Amir Goldstein Date: Fri, 15 Oct 2021 08:49:01 +0300 Message-ID: Subject: Re: [PATCH v7 12/28] fanotify: Support null inode event in fanotify_dfid_inode To: Gabriel Krisman Bertazi Cc: Jan Kara , "Darrick J. Wong" , Theodore Tso , David Howells , Khazhismel Kumykov , linux-fsdevel , Ext4 , Linux API , Matthew Bobrowski , kernel@collabora.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, Oct 15, 2021 at 12:38 AM Gabriel Krisman Bertazi wrote: > > FAN_FS_ERROR doesn't support DFID, but this function is still called for > every event. The problem is that it is not capable of handling null > inodes, which now can happen in case of superblock error events. For > this case, just returning dir will be enough. > > Signed-off-by: Gabriel Krisman Bertazi Reviewed-by: Amir Goldstein Please also fortify fsnotify_handle_inode_event() against calling ->handle_inode_event() with NULL inode. > --- > fs/notify/fanotify/fanotify.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c > index c620b4f6fe12..397ee623ff1e 100644 > --- a/fs/notify/fanotify/fanotify.c > +++ b/fs/notify/fanotify/fanotify.c > @@ -452,7 +452,7 @@ static struct inode *fanotify_dfid_inode(u32 event_mask, const void *data, > if (event_mask & ALL_FSNOTIFY_DIRENT_EVENTS) > return dir; > > - if (S_ISDIR(inode->i_mode)) > + if (inode && S_ISDIR(inode->i_mode)) > return inode; > > return dir; > -- > 2.33.0 >