diff options
author | Christian Gromm <christian.gromm@microchip.com> | 2017-11-21 15:05:17 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-11-27 09:20:37 +0100 |
commit | 3ba5515bf4eecbec08fedde5e35bdabb153c83be (patch) | |
tree | 972a415f09c6e0fc40234deab94b897765b07ee5 /drivers | |
parent | 4e6d561d51f91ad465e127b6b5fabf1f1db01fc5 (diff) | |
download | linux-stable-3ba5515bf4eecbec08fedde5e35bdabb153c83be.tar.gz linux-stable-3ba5515bf4eecbec08fedde5e35bdabb153c83be.tar.bz2 linux-stable-3ba5515bf4eecbec08fedde5e35bdabb153c83be.zip |
staging: most: core: check value returned by match function
This patch adds a check for the pointer returned by the function
match_component. It is needed to prevent a NULL pointer dereference in
case the provided component name does not match any list entry.
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/most/core.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c index 839e6cf4fbc0..6e7dcb5999bd 100644 --- a/drivers/staging/most/core.c +++ b/drivers/staging/most/core.c @@ -711,6 +711,8 @@ static ssize_t add_link_store(struct device_driver *drv, if (ret) return ret; comp = match_component(comp_name); + if (!comp) + return -ENODEV; if (!comp_param || *comp_param == 0) { snprintf(devnod_buf, sizeof(devnod_buf), "%s-%s", mdev, mdev_ch); @@ -754,6 +756,8 @@ static ssize_t remove_link_store(struct device_driver *drv, if (ret) return ret; comp = match_component(comp_name); + if (!comp) + return -ENODEV; c = get_channel(mdev, mdev_ch); if (!c) return -ENODEV; |