]> git.baikalelectronics.ru Git - kernel.git/commit
udmabuf: fix general protection fault in udmabuf_create
authorPavel Skripkin <paskripkin@gmail.com>
Wed, 11 Aug 2021 17:50:52 +0000 (20:50 +0300)
committerGerd Hoffmann <kraxel@redhat.com>
Thu, 12 Aug 2021 07:27:22 +0000 (09:27 +0200)
commit2cff8b28086f3c73d40e27d4f542f7f3e54c39ea
tree37c0c51100ab841911453d60f4531a75b96c150f
parent2fcad9359903254f76175120bc2d80817655cd7c
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 9aa3505f2687 ("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: syzbot+e9cd3122a37c5d6c51e8@syzkaller.appspotmail.com
Fixes: 9aa3505f2687 ("udmabuf: Add support for mapping hugepages (v4)")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20210811175052.21254-1-paskripkin@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
drivers/dma-buf/udmabuf.c