summaryrefslogtreecommitdiff
path: root/drivers/dma-buf
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2018-09-11 15:42:12 +0200
committerGerd Hoffmann <kraxel@redhat.com>2018-09-12 08:21:31 +0200
commit7a1c67d78094236e8ba0c5f6f83a8baf33a53860 (patch)
treedf1a5915f10e8a51d9ce893b1f5b97947b81417c /drivers/dma-buf
parent0d17455ca85ecbc757bf7a2fefed6ca9cfae5054 (diff)
udmabuf: use EBADFD in case we didn't got a memfd
Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20180911134216.9760-10-kraxel@redhat.com
Diffstat (limited to 'drivers/dma-buf')
-rw-r--r--drivers/dma-buf/udmabuf.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index a3d225fd4d90..e0465a9bf3f9 100644
--- a/drivers/dma-buf/udmabuf.c
+++ b/drivers/dma-buf/udmabuf.c
@@ -154,14 +154,17 @@ static long udmabuf_create(const struct udmabuf_create_list *head,
pgbuf = 0;
for (i = 0; i < head->count; i++) {
+ ret = -EBADFD;
memfd = fget(list[i].memfd);
if (!memfd)
goto err;
if (!shmem_mapping(file_inode(memfd)->i_mapping))
goto err;
seals = memfd_fcntl(memfd, F_GET_SEALS, 0);
- if (seals == -EINVAL ||
- (seals & SEALS_WANTED) != SEALS_WANTED ||
+ if (seals == -EINVAL)
+ goto err;
+ ret = -EINVAL;
+ if ((seals & SEALS_WANTED) != SEALS_WANTED ||
(seals & SEALS_DENIED) != 0)
goto err;
pgoff = list[i].offset >> PAGE_SHIFT;