]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
xen/gntdev: fix gntdev_mmap() error exit path
authorJuergen Gross <jgross@suse.com>
Fri, 23 Apr 2021 05:40:38 +0000 (07:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 May 2021 08:29:55 +0000 (10:29 +0200)
commit323cda5fff437ecc37f353f36c85863253480a83
treee93c5bd038fa1161b9b52f76e4d3d759417b299f
parent9984778818e8cad44c835a1ebd68c39252a182ce
xen/gntdev: fix gntdev_mmap() error exit path

commit 970655aa9b42461f8394e4457307005bdeee14d9 upstream.

Commit d3eeb1d77c5d0af ("xen/gntdev: use mmu_interval_notifier_insert")
introduced an error in gntdev_mmap(): in case the call of
mmu_interval_notifier_insert_locked() fails the exit path should not
call mmu_interval_notifier_remove(), as this might result in NULL
dereferences.

One reason for failure is e.g. a signal pending for the running
process.

Fixes: d3eeb1d77c5d0af ("xen/gntdev: use mmu_interval_notifier_insert")
Cc: stable@vger.kernel.org
Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
Link: https://lore.kernel.org/r/20210423054038.26696-1-jgross@suse.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/xen/gntdev.c