diff mbox

[RESEND] mwifiex: fix NULL pointer dereference error

Message ID 1459332895-4563-1-git-send-email-wnhuang@chromium.org (mailing list archive)
State Accepted
Delegated to: Kalle Valo
Headers show

Commit Message

Wei-Ning Huang March 30, 2016, 10:14 a.m. UTC
In mwifiex_enable_hs, we need to check if
priv->wdev.wiphy->wowlan_config is NULL before accessing it's member.
This sometimes cause kernel panic when suspend/resume.

Signed-off-by: Wei-Ning Huang <wnhuang@chromium.org>
---
 drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Sedat Dilek March 30, 2016, 10:26 a.m. UTC | #1
On Wed, Mar 30, 2016 at 12:14 PM, Wei-Ning Huang <wnhuang@chromium.org> wrote:
> In mwifiex_enable_hs, we need to check if
> priv->wdev.wiphy->wowlan_config is NULL before accessing it's member.

it's... its member (not it's) :-).

- Sedat -

> This sometimes cause kernel panic when suspend/resume.
>
> Signed-off-by: Wei-Ning Huang <wnhuang@chromium.org>
> ---
>  drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
> index d5c56eb..d8de432 100644
> --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
> +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
> @@ -509,7 +509,8 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
>
>         if (priv && priv->sched_scanning) {
>  #ifdef CONFIG_PM
> -               if (!priv->wdev.wiphy->wowlan_config->nd_config) {
> +               if (priv->wdev.wiphy->wowlan_config &&
> +                   !priv->wdev.wiphy->wowlan_config->nd_config) {
>  #endif
>                         mwifiex_dbg(adapter, CMD, "aborting bgscan!\n");
>                         mwifiex_stop_bg_scan(priv);
> --
> 2.1.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wei-Ning Huang March 30, 2016, 10:38 a.m. UTC | #2
ah.. thanks.

Kalle, can you help amend the message if this patch is accepted?
Thanks a lot.

Wei-Ning

On Wed, Mar 30, 2016 at 6:26 PM, Sedat Dilek <sedat.dilek@gmail.com> wrote:
> On Wed, Mar 30, 2016 at 12:14 PM, Wei-Ning Huang <wnhuang@chromium.org> wrote:
>> In mwifiex_enable_hs, we need to check if
>> priv->wdev.wiphy->wowlan_config is NULL before accessing it's member.
>
> it's... its member (not it's) :-).
>
> - Sedat -
>
>> This sometimes cause kernel panic when suspend/resume.
>>
>> Signed-off-by: Wei-Ning Huang <wnhuang@chromium.org>
>> ---
>>  drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
>> index d5c56eb..d8de432 100644
>> --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
>> +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
>> @@ -509,7 +509,8 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
>>
>>         if (priv && priv->sched_scanning) {
>>  #ifdef CONFIG_PM
>> -               if (!priv->wdev.wiphy->wowlan_config->nd_config) {
>> +               if (priv->wdev.wiphy->wowlan_config &&
>> +                   !priv->wdev.wiphy->wowlan_config->nd_config) {
>>  #endif
>>                         mwifiex_dbg(adapter, CMD, "aborting bgscan!\n");
>>                         mwifiex_stop_bg_scan(priv);
>> --
>> 2.1.2
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sedat Dilek March 30, 2016, 10:40 a.m. UTC | #3
On Wed, Mar 30, 2016 at 12:38 PM, Wei-Ning Huang <wnhuang@google.com> wrote:
> ah.. thanks.
>
> Kalle, can you help amend the message if this patch is accepted?
> Thanks a lot.
>

http://its-not-its.info/

- Sedat -

> Wei-Ning
>
> On Wed, Mar 30, 2016 at 6:26 PM, Sedat Dilek <sedat.dilek@gmail.com> wrote:
>> On Wed, Mar 30, 2016 at 12:14 PM, Wei-Ning Huang <wnhuang@chromium.org> wrote:
>>> In mwifiex_enable_hs, we need to check if
>>> priv->wdev.wiphy->wowlan_config is NULL before accessing it's member.
>>
>> it's... its member (not it's) :-).
>>
>> - Sedat -
>>
>>> This sometimes cause kernel panic when suspend/resume.
>>>
>>> Signed-off-by: Wei-Ning Huang <wnhuang@chromium.org>
>>> ---
>>>  drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
>>> index d5c56eb..d8de432 100644
>>> --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
>>> +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
>>> @@ -509,7 +509,8 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
>>>
>>>         if (priv && priv->sched_scanning) {
>>>  #ifdef CONFIG_PM
>>> -               if (!priv->wdev.wiphy->wowlan_config->nd_config) {
>>> +               if (priv->wdev.wiphy->wowlan_config &&
>>> +                   !priv->wdev.wiphy->wowlan_config->nd_config) {
>>>  #endif
>>>                         mwifiex_dbg(adapter, CMD, "aborting bgscan!\n");
>>>                         mwifiex_stop_bg_scan(priv);
>>> --
>>> 2.1.2
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
>
> --
> Wei-Ning Huang, ??? | Software Engineer, Google Inc., Taiwan |
> wnhuang@google.com | Cell: +886 910-380678
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kalle Valo March 30, 2016, noon UTC | #4
Wei-Ning Huang <wnhuang@google.com> writes:

> Kalle, can you help amend the message if this patch is accepted?

Sure, I'll fix the typo in the commit log.

But please try to avoid top posting, it makes it more difficult to
follow the threads.
Wei-Ning Huang March 30, 2016, 12:11 p.m. UTC | #5
On Wed, Mar 30, 2016 at 8:00 PM, Kalle Valo <kvalo@codeaurora.org> wrote:
> Wei-Ning Huang <wnhuang@google.com> writes:
>
>> Kalle, can you help amend the message if this patch is accepted?
>
> Sure, I'll fix the typo in the commit log.
>
> But please try to avoid top posting, it makes it more difficult to
> follow the threads.
>
> --
> Kalle Valo

Noted, thanks for the reminder :)

Wei-Ning
Kalle Valo April 7, 2016, 4:40 p.m. UTC | #6
> In mwifiex_enable_hs, we need to check if
> priv->wdev.wiphy->wowlan_config is NULL before accessing its member.
> This sometimes cause kernel panic when suspend/resume.
> 
> Signed-off-by: Wei-Ning Huang <wnhuang@chromium.org>

Thanks, applied to wireless-drivers-next.git.

Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
index d5c56eb..d8de432 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
@@ -509,7 +509,8 @@  int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
 
 	if (priv && priv->sched_scanning) {
 #ifdef CONFIG_PM
-		if (!priv->wdev.wiphy->wowlan_config->nd_config) {
+		if (priv->wdev.wiphy->wowlan_config &&
+		    !priv->wdev.wiphy->wowlan_config->nd_config) {
 #endif
 			mwifiex_dbg(adapter, CMD, "aborting bgscan!\n");
 			mwifiex_stop_bg_scan(priv);