media: vivid: use vfree() instead of kfree() for dev->bitmap_cap
authorAlexander Potapenko <glider@google.com>
Thu, 4 Apr 2019 14:56:46 +0000 (10:56 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 May 2019 13:48:12 +0000 (06:48 -0700)
commit dad7e270ba712ba1c99cd2d91018af6044447a06 upstream.

syzkaller reported crashes on kfree() called from
vivid_vid_cap_s_selection(). This looks like a simple typo, as
dev->bitmap_cap is allocated with vzalloc() throughout the file.

Fixes: ef834f7836ec0 ("[media] vivid: add the video capture and output
parts")

Signed-off-by: Alexander Potapenko <glider@google.com>
Reported-by: Syzbot <syzbot+6c0effb5877f6b0344e2@syzkaller.appspotmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/platform/vivid/vivid-vid-cap.c

index 25d4fd4f4c0b2a48a517d2579dc3520284ae8fd8..a72982df4777cbb21b19679825ea31510e720ada 100644 (file)
@@ -984,7 +984,7 @@ int vivid_vid_cap_s_selection(struct file *file, void *fh, struct v4l2_selection
                v4l2_rect_map_inside(&s->r, &dev->fmt_cap_rect);
                if (dev->bitmap_cap && (compose->width != s->r.width ||
                                        compose->height != s->r.height)) {
-                       kfree(dev->bitmap_cap);
+                       vfree(dev->bitmap_cap);
                        dev->bitmap_cap = NULL;
                }
                *compose = s->r;