From 12dfcb15bbec3ca983da0a040766864899dfa15c Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Wed, 12 Sep 2018 06:50:16 +0200 Subject: udmabuf: add sanity check Check that flags has no unsupported bits set. Signed-off-by: Gerd Hoffmann Reported-by: Yann Droneaud --- drivers/dma-buf/udmabuf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index c35c7cd5516f..fb7a4c93f24e 100644 --- a/drivers/dma-buf/udmabuf.c +++ b/drivers/dma-buf/udmabuf.c @@ -213,6 +213,9 @@ static long udmabuf_create(struct miscdevice *device, int seals, ret = -EINVAL; u32 i, flags; + if (head->flags & ~UDMABUF_FLAGS_CLOEXEC) + return -EINVAL; + ubuf = kzalloc(sizeof(*ubuf), GFP_KERNEL); if (!ubuf) return -ENOMEM; -- cgit