This is a note to let you know that I've just added the patch titled hostfs: Fix the NULL vs IS_ERR() bug for __filemap_get_folio() to the 6.12-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: hostfs-fix-the-null-vs-is_err-bug-for-__filemap_get_.patch and it can be found in the queue-6.12 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit f45511d60f62e1d9f6b0953ce0484bde9bd69dfb Author: ZhangPeng <zhangpeng362@xxxxxxxxxx> Date: Mon Nov 4 20:34:40 2024 +0800 hostfs: Fix the NULL vs IS_ERR() bug for __filemap_get_folio() [ Upstream commit bed2cc482600296fe04edbc38005ba2851449c10 ] The __filemap_get_folio() function returns error pointers. It never returns NULL. So use IS_ERR() to check it. Fixes: 1da86618bdce ("fs: Convert aops->write_begin to take a folio") Signed-off-by: ZhangPeng <zhangpeng362@xxxxxxxxxx> Acked-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx> Signed-off-by: Richard Weinberger <richard@xxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 6d1cf2436ead6..084f6ed2dd7a6 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -471,8 +471,8 @@ static int hostfs_write_begin(struct file *file, struct address_space *mapping, *foliop = __filemap_get_folio(mapping, index, FGP_WRITEBEGIN, mapping_gfp_mask(mapping)); - if (!*foliop) - return -ENOMEM; + if (IS_ERR(*foliop)) + return PTR_ERR(*foliop); return 0; }