Skip to content

Commit b9770b0

Browse files
pskrgagkraxel
authored andcommitted
udmabuf: fix general protection fault in udmabuf_create
Syzbot reported general protection fault in udmabuf_create. The problem was in wrong error handling. In commit 16c243e ("udmabuf: Add support for mapping hugepages (v4)") shmem_read_mapping_page() call was replaced with find_get_page_flags(), but find_get_page_flags() returns NULL on failure instead PTR_ERR(). Wrong error checking was causing GPF in get_page(), since passed page was equal to NULL. Fix it by changing if (IS_ER(!hpage)) to if (!hpage) Reported-by: [email protected] Fixes: 16c243e ("udmabuf: Add support for mapping hugepages (v4)") Signed-off-by: Pavel Skripkin <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
1 parent 83326a7 commit b9770b0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/dma-buf/udmabuf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ static long udmabuf_create(struct miscdevice *device,
227227
if (!hpage) {
228228
hpage = find_get_page_flags(mapping, pgoff,
229229
FGP_ACCESSED);
230-
if (IS_ERR(hpage)) {
231-
ret = PTR_ERR(hpage);
230+
if (!hpage) {
231+
ret = -EINVAL;
232232
goto err;
233233
}
234234
}

0 commit comments

Comments
 (0)