diff mbox

[5/6] ath6kl: Fix a debugfs crash for USB devices

Message ID 1360834689-11187-1-git-send-email-mohammed@qca.qualcomm.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Shajakhan, Mohammed Feb. 14, 2013, 9:38 a.m. UTC
From: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

Credit distribution stats is currently implemented
only for SDIO. This fixes a crash in debugfs for
USB interface.

BUG: unable to handle kernel NULL pointer dereference at   (null)
IP: [<f91c2048>] read_file_credit_dist_stats+0x38/0x330 [ath6kl_core]
*pde = b62bd067
Oops: 0000 [#1] SMP

EIP: 0060:[<f91c2048>] EFLAGS: 00210246 CPU: 0
EIP is at read_file_credit_dist_stats+0x38/0x330 [ath6kl_core]
EAX: 00000000 EBX: e6f7a9c0 ECX: e7b148b8 EDX: 00000000
ESI: 000000c8 EDI: e7b14000 EBP: e6e09f64 ESP: e6e09f30
DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
Process cat (pid: 4058, ti=e6e08000 task=e50cf230 task.ti=e6e08000)
Stack:
00008000 00000000 e6e09f64 c1132d3c 00004e71 e50cf230 00008000 089e4000
e7b148b8 00000000 e6f7a9c0 00008000 089e4000 e6e09f8c c11331fc e6e09f98
00000001 e6e09f7c f91c2010 e6e09fac e6f7a9c0 089e4877 089e4000 e6e09fac

	Call Trace:
	[<c1132d3c>] ? rw_verify_area+0x6c/0x120
	[<c11331fc>] vfs_read+0x8c/0x160
	[<f91c2010>] ? read_file_war_stats+0x130/0x130 [ath6kl_core]
	[<c113330d>] sys_read+0x3d/0x70
	[<c15755b4>] syscall_call+0x7/0xb
	[<c1570000>] ? fill_powernow_table_pstate+0x127/0x127

Cc: Ryan Hsu <ryanhsu@qca.qualcomm.com>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath6kl/debug.c |    3 +++
 1 file changed, 3 insertions(+)

Comments

Kalle Valo Feb. 15, 2013, 10:30 a.m. UTC | #1
Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com> writes:

> From: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
>
> Credit distribution stats is currently implemented
> only for SDIO. This fixes a crash in debugfs for
> USB interface.
>
> BUG: unable to handle kernel NULL pointer dereference at   (null)
> IP: [<f91c2048>] read_file_credit_dist_stats+0x38/0x330 [ath6kl_core]
> *pde = b62bd067
> Oops: 0000 [#1] SMP

[...]

> --- a/drivers/net/wireless/ath/ath6kl/debug.c
> +++ b/drivers/net/wireless/ath/ath6kl/debug.c
> @@ -658,6 +658,9 @@ static ssize_t read_file_credit_dist_stats(struct file *file,
>  	unsigned int buf_len, len = 0;
>  	ssize_t ret_cnt;
>  
> +	if (ar->hif_type != ATH6KL_HIF_TYPE_SDIO)
> +		return -EINVAL;

Actually I think it would be better not to even create the debugfs when
using sdio.
Shajakhan, Mohammed Feb. 15, 2013, 11:26 a.m. UTC | #2
Hi Kalle,

On 02/15/2013 04:00 PM, Kalle Valo wrote:
> Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com> writes:
>
>> From: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
>>
>> Credit distribution stats is currently implemented
>> only for SDIO. This fixes a crash in debugfs for
>> USB interface.
>>
>> BUG: unable to handle kernel NULL pointer dereference at   (null)
>> IP: [<f91c2048>] read_file_credit_dist_stats+0x38/0x330 [ath6kl_core]
>> *pde = b62bd067
>> Oops: 0000 [#1] SMP
>
> [...]
>
>> --- a/drivers/net/wireless/ath/ath6kl/debug.c
>> +++ b/drivers/net/wireless/ath/ath6kl/debug.c
>> @@ -658,6 +658,9 @@ static ssize_t read_file_credit_dist_stats(struct file *file,
>>   	unsigned int buf_len, len = 0;
>>   	ssize_t ret_cnt;
>>
>> +	if (ar->hif_type != ATH6KL_HIF_TYPE_SDIO)
>> +		return -EINVAL;
>
> Actually I think it would be better not to even create the debugfs when
> using sdio.

agreed, but looks bit ugly right ? thoughts.

>
Kalle Valo Feb. 15, 2013, 11:43 a.m. UTC | #3
Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com> writes:

>>> +	if (ar->hif_type != ATH6KL_HIF_TYPE_SDIO)
>>> +		return -EINVAL;
>>
>> Actually I think it would be better not to even create the debugfs when
>> using sdio.

Oops, meant of course s/debugfs/debugfs file/. There seems to be packet
loss between my brains and fingers...

> agreed, but looks bit ugly right ? thoughts.

Sorry, but I don't understand how not creating the debugfs file for usb
would be ugly? But this isn't that important, if you want we can do it
like you propose as well.
Shajakhan, Mohammed Feb. 15, 2013, 2 p.m. UTC | #4
On 02/15/2013 05:13 PM, Kalle Valo wrote:
> Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com> writes:
>
>>>> +	if (ar->hif_type != ATH6KL_HIF_TYPE_SDIO)
>>>> +		return -EINVAL;
>>>
>>> Actually I think it would be better not to even create the debugfs when
>>> using sdio.
>
> Oops, meant of course s/debugfs/debugfs file/. There seems to be packet
> loss between my brains and fingers...

yeah I think its USB and debugfs file :)

>
>> agreed, but looks bit ugly right ? thoughts.
>
> Sorry, but I don't understand how not creating the debugfs file for usb
> would be ugly? But this isn't that important, if you want we can do it
> like you propose as well.
>

I will cook up a new patch, please see if that's fine :)
diff mbox

Patch

diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
index 15cfe30..0dbb67b 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -658,6 +658,9 @@  static ssize_t read_file_credit_dist_stats(struct file *file,
 	unsigned int buf_len, len = 0;
 	ssize_t ret_cnt;
 
+	if (ar->hif_type != ATH6KL_HIF_TYPE_SDIO)
+		return -EINVAL;
+
 	buf_len = CREDIT_INFO_DISPLAY_STRING_LEN +
 		  get_queue_depth(&target->cred_dist_list) * CREDIT_INFO_LEN;
 	buf = kzalloc(buf_len, GFP_KERNEL);