]> www.infradead.org Git - users/jedix/linux-maple.git/commit
fuse: Set *nbytesp=0 in fuse_get_user_pages on allocation failure
authorBernd Schubert <bschubert@ddn.com>
Mon, 2 Dec 2024 23:01:10 +0000 (00:01 +0100)
committerMiklos Szeredi <mszeredi@redhat.com>
Fri, 13 Dec 2024 15:43:36 +0000 (16:43 +0100)
commit78f2560fc9fa5ccaaf23ac78edb732c08bad7a92
treeaf3e4c412a53917c22e19fade73ac88109cc0216
parent7a4f541873734f41f9645ec147cfae72ef3ffd00
fuse: Set *nbytesp=0 in fuse_get_user_pages on allocation failure

In fuse_get_user_pages(), set *nbytesp to 0 when struct page **pages
allocation fails. This prevents the caller (fuse_direct_io) from making
incorrect assumptions that could lead to NULL pointer dereferences
when processing the request reply.

Previously, *nbytesp was left unmodified on allocation failure, which
could cause issues if the caller assumed pages had been added to
ap->descs[] when they hadn't.

Reported-by: syzbot+87b8e6ed25dbc41759f7@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=87b8e6ed25dbc41759f7
Fixes: 3b97c3652d91 ("fuse: convert direct io to use folios")
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
Reviewed-by: Joanne Koong <joannelkoong@gmail.com>
Tested-by: Dmitry Antipov <dmantipov@yandex.ru>
Tested-by: David Howells <dhowells@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/file.c