mm: mmap: fix fput in error path v2
authorChristian König <christian.koenig@amd.com>
Fri, 9 Oct 2020 13:08:55 +0000 (15:08 +0200)
committerChristian König <christian.koenig@amd.com>
Thu, 5 Nov 2020 12:03:43 +0000 (13:03 +0100)
commit0227da01f2559626396af5f6c7453360db86c1f6
tree4bd2c28e4a1de36378eb7a45be3e81b52318f043
parentea86f3defd55f141a44146e66cbf8ffb683d60da
mm: mmap: fix fput in error path v2

Patch "495c10cc1c0c CHROMIUM: dma-buf: restore args..."
adds a workaround for a bug in mmap_region.

As the comment states ->mmap() callback can change
vma->vm_file and so we might call fput() on the wrong file.

Revert the workaround and proper fix this in mmap_region.

v2: drop the extra if in dma_buf_mmap as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/394772/
drivers/dma-buf/dma-buf.c
mm/mmap.c