summaryrefslogtreecommitdiff
path: root/drivers/media/platform/vivid/vivid-kthread-out.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2018-10-29 13:15:31 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-23 10:10:55 +0300
commit63f7a4a68e8de3b438a76fec14f25079a24ed1b9 (patch)
tree81644a83e090a9e04e590cee63913413ae6166cd /drivers/media/platform/vivid/vivid-kthread-out.c
parentf5a7973c32a39b2e16ef31f0f95ba47fcdac5b76 (diff)
downloadlinux-63f7a4a68e8de3b438a76fec14f25079a24ed1b9.tar.xz
media: vivid: fix error handling of kthread_run
commit 701f49bc028edb19ffccd101997dd84f0d71e279 upstream. kthread_run returns an error pointer, but elsewhere in the code dev->kthread_vid_cap/out is checked against NULL. If kthread_run returns an error, then set the pointer to NULL. I chose this method over changing all kthread_vid_cap/out tests elsewhere since this is more robust. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reported-by: syzbot+53d5b2df0d9744411e2e@syzkaller.appspotmail.com Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/media/platform/vivid/vivid-kthread-out.c')
-rw-r--r--drivers/media/platform/vivid/vivid-kthread-out.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/media/platform/vivid/vivid-kthread-out.c b/drivers/media/platform/vivid/vivid-kthread-out.c
index 98eed5889bc1..7c8d75852816 100644
--- a/drivers/media/platform/vivid/vivid-kthread-out.c
+++ b/drivers/media/platform/vivid/vivid-kthread-out.c
@@ -248,8 +248,11 @@ int vivid_start_generating_vid_out(struct vivid_dev *dev, bool *pstreaming)
"%s-vid-out", dev->v4l2_dev.name);
if (IS_ERR(dev->kthread_vid_out)) {
+ int err = PTR_ERR(dev->kthread_vid_out);
+
+ dev->kthread_vid_out = NULL;
v4l2_err(&dev->v4l2_dev, "kernel_thread() failed\n");
- return PTR_ERR(dev->kthread_vid_out);
+ return err;
}
*pstreaming = true;
vivid_grab_controls(dev, true);