This is a note to let you know that I've just added the patch titled erofs: put metabuf in error path in fscache mode to the 6.0-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: erofs-put-metabuf-in-error-path-in-fscache-mode.patch and it can be found in the queue-6.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 2f1a8d4cadcdbd29e6bf38a6d16e5c4490087236 Author: Jingbo Xu <jefflexu@xxxxxxxxxxxxxxxxx> Date: Fri Nov 4 13:40:27 2022 +0800 erofs: put metabuf in error path in fscache mode [ Upstream commit 75e43355cbe4d5948a79bd592f2ffecb9f75f75d ] For tail packing layout, put metabuf when error is encountered. Fixes: 1ae9470c3e14 ("erofs: clean up .read_folio() and .readahead() in fscache mode") Signed-off-by: Jingbo Xu <jefflexu@xxxxxxxxxxxxxxxxx> Reviewed-by: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx> Reviewed-by: Jia Zhu <zhujia.zj@xxxxxxxxxxxxx> Reviewed-by: Chao Yu <chao@xxxxxxxxxx> Link: https://lore.kernel.org/r/20221104054028.52208-2-jefflexu@xxxxxxxxxxxxxxxxx Signed-off-by: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c index 8585e324298c..79af25f0a56c 100644 --- a/fs/erofs/fscache.c +++ b/fs/erofs/fscache.c @@ -281,8 +281,10 @@ static int erofs_fscache_data_read(struct address_space *mapping, return PTR_ERR(src); iov_iter_xarray(&iter, READ, &mapping->i_pages, pos, PAGE_SIZE); - if (copy_to_iter(src + offset, size, &iter) != size) + if (copy_to_iter(src + offset, size, &iter) != size) { + erofs_put_metabuf(&buf); return -EFAULT; + } iov_iter_zero(PAGE_SIZE - size, &iter); erofs_put_metabuf(&buf); return PAGE_SIZE;