summaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/gspca
diff options
context:
space:
mode:
authorPan Bian <bianpan2016@163.com>2017-04-23 06:26:45 -0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-06-06 07:28:36 -0300
commit13174c388a76005c1abe454e47a37cd57edd8c8d (patch)
treebc00553242f1e97190bc4627c93596e45f2152a9 /drivers/media/usb/gspca
parentd90b336f3f652ff0441e631a06236f785581c8f7 (diff)
downloadlinux-13174c388a76005c1abe454e47a37cd57edd8c8d.tar.bz2
[media] m5602_s5k83a: check return value of kthread_create
Function kthread_create() returns an ERR_PTR on error. However, in function s5k83a_start(), its return value is used without validation. This may result in a bad memory access bug. This patch fixes the bug. Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/usb/gspca')
-rw-r--r--drivers/media/usb/gspca/m5602/m5602_s5k83a.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/media/usb/gspca/m5602/m5602_s5k83a.c b/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
index be5e25d1a2e8..6ad8d4849680 100644
--- a/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
+++ b/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
@@ -345,6 +345,11 @@ int s5k83a_start(struct sd *sd)
to assume that there is no better way of accomplishing this */
sd->rotation_thread = kthread_create(rotation_thread_function,
sd, "rotation thread");
+ if (IS_ERR(sd->rotation_thread)) {
+ err = PTR_ERR(sd->rotation_thread);
+ sd->rotation_thread = NULL;
+ return err;
+ }
wake_up_process(sd->rotation_thread);
/* Preinit the sensor */