diff options
author | Allen Yu <alleny@nvidia.com> | 2014-06-29 01:43:42 +0800 |
---|---|---|
committer | Mandar Padmawar <mpadmawar@nvidia.com> | 2014-07-10 02:05:23 -0700 |
commit | bb5d260a38bb464f92876f68b7ce43d0e9c77cff (patch) | |
tree | 24ab7f3a2b5fffec429423af07453cecf6b49033 /drivers | |
parent | 9595d51ae204879b946b8b68a769d6730f1cdc68 (diff) |
staging: ozwpan: fix NULL pointer in stop_store
oz_pd_find() can return 0 if it fails to find any pd in g_pd_list
that matches the mac_addr. This could happen if oz_pd_stop() has been
called on the pd so that it's deleted from g_pd_list.
Change-Id: I6bedf242676d6cd316eae41dacd8a515dac296b8
Signed-off-by: Allen Yu <alleny@nvidia.com>
Reviewed-on: http://git-master/r/432534
(cherry picked from commit d6e48d6e4b3a5b378502137f2eda68009333e144)
Reviewed-on: http://git-master/r/435724
GVS: Gerrit_Virtual_Submit
Reviewed-by: Anshul Jain (SW) <anshulj@nvidia.com>
Tested-by: Anshul Jain (SW) <anshulj@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/ozwpan/ozkobject.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/staging/ozwpan/ozkobject.c b/drivers/staging/ozwpan/ozkobject.c index 9b85ef55da15..e7a991d2b755 100644 --- a/drivers/staging/ozwpan/ozkobject.c +++ b/drivers/staging/ozwpan/ozkobject.c @@ -94,11 +94,13 @@ static ssize_t stop_store(struct kobject *kobj, struct kobj_attribute *attr, } pd = oz_pd_find(mac_addr); - if (pd && (!(pd->state & OZ_PD_S_CONNECTED))) { + if (!pd) + return -EINVAL; + + if (!(pd->state & OZ_PD_S_CONNECTED)) oz_pd_stop(pd); - oz_pd_put(pd); - } else - oz_pd_put(pd); + + oz_pd_put(pd); } return count; |