projects
/
platform
/
kernel
/
linux-rpi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
794e20e
)
iio: core: check 'info' value before registering the device
author
Andi Shyti
<andi@etezian.org>
Sun, 2 Dec 2018 18:30:31 +0000
(20:30 +0200)
committer
Jonathan Cameron
<Jonathan.Cameron@huawei.com>
Sat, 8 Dec 2018 11:06:41 +0000
(11:06 +0000)
When the 'info' structure inside indio_dev is left uninitialized,
a segmentation fault occurs.
Check the 'info' value before using it and if it is equal to
NULL, return with -EINVAL.
Signed-off-by: Andi Shyti <andi@etezian.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/industrialio-core.c
patch
|
blob
|
history
diff --git
a/drivers/iio/industrialio-core.c
b/drivers/iio/industrialio-core.c
index a062cfddc5af76da66a14bcf4178ee8487925099..4f5cd9f60870720819d347db697242c8d3282742 100644
(file)
--- a/
drivers/iio/industrialio-core.c
+++ b/
drivers/iio/industrialio-core.c
@@
-1671,6
+1671,9
@@
int __iio_device_register(struct iio_dev *indio_dev, struct module *this_mod)
if (ret < 0)
return ret;
+ if (!indio_dev->info)
+ return -EINVAL;
+
/* configure elements for the chrdev */
indio_dev->dev.devt = MKDEV(MAJOR(iio_devt), indio_dev->id);