From: Christoph Hellwig <hch@lst.de>
To: Carlos Maiolino <cem@kernel.org>
Cc: linux-xfs@vger.kernel.org, Hans Holmberg <Hans.Holmberg@wdc.com>,
Dan Carpenter <dan.carpenter@linaro.org>
Subject: [PATCH 2/4] xfs: remove NULL pointer checks in xfs_mru_cache_insert
Date: Thu, 5 Jun 2025 08:16:28 +0200 [thread overview]
Message-ID: <20250605061638.993152-3-hch@lst.de> (raw)
In-Reply-To: <20250605061638.993152-1-hch@lst.de>
Remove the check for a NULL mru or mru->list in xfs_mru_cache_insert
as this API misused lead to a direct NULL pointer dereference on first
use and is not user triggerable. As a smatch run by Dan points out
with the recent cleanup it would otherwise try to free the object we
just determined to be NULL for this impossible to reach case.
Fixes: 70b95cb86513 ("xfs: free the item in xfs_mru_cache_insert on failure")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_mru_cache.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/fs/xfs/xfs_mru_cache.c b/fs/xfs/xfs_mru_cache.c
index 08443ceec329..c95401de8397 100644
--- a/fs/xfs/xfs_mru_cache.c
+++ b/fs/xfs/xfs_mru_cache.c
@@ -425,10 +425,6 @@ xfs_mru_cache_insert(
{
int error = -EINVAL;
- ASSERT(mru && mru->lists);
- if (!mru || !mru->lists)
- goto out_free;
-
error = -ENOMEM;
if (radix_tree_preload(GFP_KERNEL))
goto out_free;
--
2.47.2
next prev parent reply other threads:[~2025-06-05 6:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-05 6:16 misc fixes Christoph Hellwig
2025-06-05 6:16 ` [PATCH 1/4] xfs: check for shutdown before going to sleep in xfs_select_zone Christoph Hellwig
2025-06-05 6:42 ` Shinichiro Kawasaki
2025-06-05 12:02 ` Hans Holmberg
2025-06-05 6:16 ` Christoph Hellwig [this message]
2025-06-05 12:04 ` [PATCH 2/4] xfs: remove NULL pointer checks in xfs_mru_cache_insert Hans Holmberg
2025-06-05 6:16 ` [PATCH 3/4] xfs: use xfs_readonly_buftarg in xfs_remount_rw Christoph Hellwig
2025-06-05 7:24 ` John Garry
2025-06-05 12:05 ` Hans Holmberg
2025-06-05 6:16 ` [PATCH 4/4] xfs: move xfs_submit_zoned_bio a bit Christoph Hellwig
2025-06-05 12:07 ` Hans Holmberg
2025-06-16 8:02 ` Carlos Maiolino
2025-06-16 12:31 ` misc fixes Carlos Maiolino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250605061638.993152-3-hch@lst.de \
--to=hch@lst.de \
--cc=Hans.Holmberg@wdc.com \
--cc=cem@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox