Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3098437pxj; Mon, 17 May 2021 17:44:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVbtrLLoAVl6q2w6UW+mj/hGHEPNP6esC7LwMSHxQMU+b1Rz3lRmk3YVnADpQ6lo1/Gbdh X-Received: by 2002:a17:907:76d9:: with SMTP id kf25mr3018902ejc.340.1621298685290; Mon, 17 May 2021 17:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621298685; cv=none; d=google.com; s=arc-20160816; b=J3InCPKSIoaimbw9dPxxByP1YMP/0gD/DRi+Zf+IKRrut3ZgITEBAK08eqgp2V5kZk wAeMRodH2Gvl/3m4iodc4WboJWCi84B08kwfX6BwUaJgVTR0NT14VXuJcTnyiAnoq1ga SA+q19hI/ylaDEcNeNFIprIqzT2nfeFrLyQ4u9jP4cB+ZDVm/wS48tbl/ML9jgT6nmjx wIEhCGsZSwk1r3wMxP6dCVoLaYKTyXzwHzgo4ZAEBZxKy8tLHGJ4ERlAn0h4La2opoP+ 3kiTP9i7Emfbhv/JI3OZ8PfNa9FreoqgfddmsY3asZtba1M6evOzGlrZIXywwEk09ZhE JH4A== 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=7ilgM+ZZKLOh5ySuuxptRQIFEf32+fQMwLDIhyhWYNs=; b=YauWz/T+d1NJSbzQnTG9X0R/97UieZG7rfIb+pI87eHq27IDy4Fdxa26tDEL8Vz4j6 Gakf8TbRWx32Qib4CirklD7WbJPlBNNqZSoziK/iiIUb7nmKzXOc6DneZlkTJwub/8Hw M93sExcKjBpxxsxCT3b7sVTe8mfgToijll/T0GPoQsG1m52buO+Js+OsAm6PV+Nclpp2 MvWjCY/EcSjN8fOyTJNwLet2KdrwMPmrj8/grIOUoLRrYdcv53lqFdFRq9EAqAjfQX7V VNk/Q7juHL4aD/pWKMBq9KoeLVf4K/KESDKYd2LHs16sm+gvR5R873YmgFx7F4Kl8kMC sYMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y+EygB1r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kl25si15288379ejc.370.2021.05.17.17.44.22; Mon, 17 May 2021 17:44:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=Y+EygB1r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S239940AbhEQO3j (ORCPT + 99 others); Mon, 17 May 2021 10:29:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:55002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239761AbhEQOYq (ORCPT ); Mon, 17 May 2021 10:24:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F2F9C6147E; Mon, 17 May 2021 14:13:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260791; bh=ufV9rMDAVmS8BeePTzgExDdXBMoYaDazMRHBUnC0Ty4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y+EygB1r1zcpw8Sc8BCTsoCrgyS3hBanKYyHFJIkYneuVqPfCW1bJcLlMsaAdXlY1 lwJ5rEE26Kl55hxLCkYeCIW+OWJC5l5hrZvY8IeWUDbFWGJ5lXRwYkQpeP0xslfEH0 6IZMEtxraRAVTNd1nsfUdn49OArdSJbC47qQM7UM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Christian Brauner , Alexey Dobriyan , Andrew Morton , Linus Torvalds , Sasha Levin , Greg Kroah-Hartman Subject: [PATCH 5.12 237/363] fs/proc/generic.c: fix incorrect pde_is_permanent check Date: Mon, 17 May 2021 16:01:43 +0200 Message-Id: <20210517140310.603961199@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King [ Upstream commit f4bf74d82915708208bc9d0c9bd3f769f56bfbec ] Currently the pde_is_permanent() check is being run on root multiple times rather than on the next proc directory entry. This looks like a copy-paste error. Fix this by replacing root with next. Addresses-Coverity: ("Copy-paste error") Link: https://lkml.kernel.org/r/20210318122633.14222-1-colin.king@canonical.com Fixes: d919b33dafb3 ("proc: faster open/read/close with "permanent" files") Signed-off-by: Colin Ian King Acked-by: Christian Brauner Reviewed-by: Alexey Dobriyan Cc: Greg Kroah-Hartman Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- fs/proc/generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/proc/generic.c b/fs/proc/generic.c index bc86aa87cc41..5600da30e289 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -756,7 +756,7 @@ int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) while (1) { next = pde_subdir_first(de); if (next) { - if (unlikely(pde_is_permanent(root))) { + if (unlikely(pde_is_permanent(next))) { write_unlock(&proc_subdir_lock); WARN(1, "removing permanent /proc entry '%s/%s'", next->parent->name, next->name); -- 2.30.2