Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3410317rwa; Tue, 23 Aug 2022 04:26:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR6F/Xa8Y47/kS6oKcPXLCZwfjxT6snl6vO7/u6HXruQ88AxdSuqltpnHozR2V+nHXNQRjnc X-Received: by 2002:aa7:8696:0:b0:536:3e38:2d8b with SMTP id d22-20020aa78696000000b005363e382d8bmr16766218pfo.76.1661253846008; Tue, 23 Aug 2022 04:24:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253846; cv=none; d=google.com; s=arc-20160816; b=dAPHQkbKyndhLPSh1GKo1QmjPt6Lh4f/7HgJc3WC9nkSbfLbV7AGobeBuKP2KAFmOk pqyQVT/eMzgqcEJTIc6RuIKfRxf/FpaWwGa+xErAv4TtX6ZqfEHYh4WpLkQXemC8v2e2 OTyspCL2uoSUaBjZ4OkQpi2EmCe9rv4qzXRKJcOrSaElWpAkjc4Hfo37Pt82SR4pDs0g /EwpPjVjxCkrNNd+Qjntg/oy2W1P4U0oVJ0dnpEPL6/GCJ5A/9nJyXjEpCSuwNiyEabX +j0/W/rf1ZLY6D135bHT+bKKQUCHVHyec18P58JZBlSZvWUQ9F4pUOaxt5N/zMzL4tpJ 23hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=as8Qf50QlM+Lnxx/BUknDRgyGuy8mIc4M7eSBMKZLfw=; b=QfBOlVVPUt7HCUztRTsH5TToWRFMmB/JTGaS2ri4ciY2W/lf/DuCmBlD2KBhwaJD5P ktiv1Rx3EQqG0bXKzGQkpSC6ulD2ywU6VU0eTLQWKCfMz5H4dKieTP7nNXuQ82e/DHMH oTOIxz5MmV7xnarcoMCgycNR3rNOLd2Fkgz6P7ODJn+GHhv8uzmwmc0QUHf27TLqpYdJ XYoDlaZ+rLoUzfsRLVfzEshOT7mHUKgguI+vhi9rrk+acw0yEfTbfxtXsOKFql1hTSdR SyTmswSF/Xt7v0e/TxF+/sPRyldLgaX7EwOtegSzIsT3T/goPWEIUNh1RoUIEwIiRFRZ 70Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JPSpM8u6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o12-20020a1709026b0c00b001728fede5c1si11898502plk.174.2022.08.23.04.23.55; Tue, 23 Aug 2022 04:24:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JPSpM8u6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355363AbiHWKbt (ORCPT + 99 others); Tue, 23 Aug 2022 06:31:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353717AbiHWKPr (ORCPT ); Tue, 23 Aug 2022 06:15:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1199974343; Tue, 23 Aug 2022 02:00:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 208D2B81C1C; Tue, 23 Aug 2022 09:00:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AF57C433C1; Tue, 23 Aug 2022 09:00:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245251; bh=NWppDAppclIIelcwHTi7iypa3FSdoMiyO4BC8w4uwr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JPSpM8u6rAACmaLvjKqFAp9nCwcLFfzcRaIJoza+4kNitAzTq/u9AgpOvS7JgSG54 se/LTz79YSu/Llb2RVlYeXccStOjWyhNpFlsV3XxLOBhZri1ywfFU9B6jD6PKvqJlz MQNLksJmhzBMDoNL2z2Y74El7m8+fIwGXU3GAzV0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hongbo Yin , Jiachen Zhang , Tianci Zhang , Miklos Szeredi Subject: [PATCH 4.19 020/287] ovl: drop WARN_ON() dentry is NULL in ovl_encode_fh() Date: Tue, 23 Aug 2022 10:23:09 +0200 Message-Id: <20220823080100.961392451@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiachen Zhang commit dd524b7f317de8d31d638cbfdc7be4cf9b770e42 upstream. Some code paths cannot guarantee the inode have any dentry alias. So WARN_ON() all !dentry may flood the kernel logs. For example, when an overlayfs inode is watched by inotifywait (1), and someone is trying to read the /proc/$(pidof inotifywait)/fdinfo/INOTIFY_FD, at that time if the dentry has been reclaimed by kernel (such as echo 2 > /proc/sys/vm/drop_caches), there will be a WARN_ON(). The printed call stack would be like: ? show_mark_fhandle+0xf0/0xf0 show_mark_fhandle+0x4a/0xf0 ? show_mark_fhandle+0xf0/0xf0 ? seq_vprintf+0x30/0x50 ? seq_printf+0x53/0x70 ? show_mark_fhandle+0xf0/0xf0 inotify_fdinfo+0x70/0x90 show_fdinfo.isra.4+0x53/0x70 seq_show+0x130/0x170 seq_read+0x153/0x440 vfs_read+0x94/0x150 ksys_read+0x5f/0xe0 do_syscall_64+0x59/0x1e0 entry_SYSCALL_64_after_hwframe+0x44/0xa9 So let's drop WARN_ON() to avoid kernel log flooding. Reported-by: Hongbo Yin Signed-off-by: Jiachen Zhang Signed-off-by: Tianci Zhang Fixes: 8ed5eec9d6c4 ("ovl: encode pure upper file handles") Cc: # v4.16 Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman --- fs/overlayfs/export.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/overlayfs/export.c +++ b/fs/overlayfs/export.c @@ -277,7 +277,7 @@ static int ovl_encode_fh(struct inode *i return FILEID_INVALID; dentry = d_find_any_alias(inode); - if (WARN_ON(!dentry)) + if (!dentry) return FILEID_INVALID; type = ovl_dentry_to_fh(dentry, fid, max_len);