* [PATCH] ath11k: Adding proper validation before accessing tx_stats
@ 2020-03-17 11:59 ` Pravas Kumar Panda
0 siblings, 0 replies; 4+ messages in thread
From: Pravas Kumar Panda @ 2020-03-17 11:59 UTC (permalink / raw)
To: ath11k; +Cc: linux-wireless, Pravas Kumar Panda
Before dumping tx_stats proper validation was not been taken care of.
Due to which we were encountering null pointer dereference(kernel panic).
This scenario will arise when a station is getting disconnected and
we are changing the STA state by ath11k_mac_op_sta_state and assigning
tx_stats as NULL and after this the mac80211 will destroy the
debugfs entry from where we are trying to read the stats.
If anyone tries to dump tx_stats for that STA in between setting
tx_stats to NULL and debugfs file removal without checking the NULL
value it will run into a NULL pointer exception.
Proceeding with the analysis of "ARM Kernel Panic".
The APSS crash happened due to OOPS on CPU 3.
Crash Signature : Unable to handle kernel NULL pointer dereference at
virtual address 00000360
During the crash,
PC points to "ath11k_debug_htt_stats_init+0x16ac/0x1acc [ath11k]"
LR points to "ath11k_debug_htt_stats_init+0x1688/0x1acc [ath11k]".
The Backtrace obtained is as follows:
[<ffffffbffcfd8590>] ath11k_debug_htt_stats_init+0x16ac/0x1acc [ath11k]
[<ffffffc000156320>] do_loop_readv_writev+0x60/0xa4
[<ffffffc000156a5c>] do_readv_writev+0xd8/0x19c
[<ffffffc000156b54>] vfs_readv+0x34/0x48
[<ffffffc00017d6f4>] default_file_splice_read+0x1a8/0x2e4
[<ffffffc00017c56c>] do_splice_to+0x78/0x98
[<ffffffc00017c63c>] splice_direct_to_actor+0xb0/0x1a4
[<ffffffc00017c7b4>] do_splice_direct+0x84/0xa8
[<ffffffc000156f40>] do_sendfile+0x160/0x2a4
[<ffffffc000157980>] SyS_sendfile64+0xb4/0xc8
Signed-off-by: Pravas Kumar Panda <kumarpan@codeaurora.org>
---
drivers/net/wireless/ath/ath11k/debugfs_sta.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/wireless/ath/ath11k/debugfs_sta.c b/drivers/net/wireless/ath/ath11k/debugfs_sta.c
index 872f3ef..389dac2 100644
--- a/drivers/net/wireless/ath/ath11k/debugfs_sta.c
+++ b/drivers/net/wireless/ath/ath11k/debugfs_sta.c
@@ -219,6 +219,9 @@ static ssize_t ath11k_dbg_sta_dump_tx_stats(struct file *file,
const int size = 2 * 4096;
char *buf;
+ if (!arsta->tx_stats)
+ return -ENOENT;
+
buf = kzalloc(size, GFP_KERNEL);
if (!buf)
return -ENOMEM;
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] ath11k: Adding proper validation before accessing tx_stats
@ 2020-03-17 11:59 ` Pravas Kumar Panda
0 siblings, 0 replies; 4+ messages in thread
From: Pravas Kumar Panda @ 2020-03-17 11:59 UTC (permalink / raw)
To: ath11k; +Cc: Pravas Kumar Panda, linux-wireless
Before dumping tx_stats proper validation was not been taken care of.
Due to which we were encountering null pointer dereference(kernel panic).
This scenario will arise when a station is getting disconnected and
we are changing the STA state by ath11k_mac_op_sta_state and assigning
tx_stats as NULL and after this the mac80211 will destroy the
debugfs entry from where we are trying to read the stats.
If anyone tries to dump tx_stats for that STA in between setting
tx_stats to NULL and debugfs file removal without checking the NULL
value it will run into a NULL pointer exception.
Proceeding with the analysis of "ARM Kernel Panic".
The APSS crash happened due to OOPS on CPU 3.
Crash Signature : Unable to handle kernel NULL pointer dereference at
virtual address 00000360
During the crash,
PC points to "ath11k_debug_htt_stats_init+0x16ac/0x1acc [ath11k]"
LR points to "ath11k_debug_htt_stats_init+0x1688/0x1acc [ath11k]".
The Backtrace obtained is as follows:
[<ffffffbffcfd8590>] ath11k_debug_htt_stats_init+0x16ac/0x1acc [ath11k]
[<ffffffc000156320>] do_loop_readv_writev+0x60/0xa4
[<ffffffc000156a5c>] do_readv_writev+0xd8/0x19c
[<ffffffc000156b54>] vfs_readv+0x34/0x48
[<ffffffc00017d6f4>] default_file_splice_read+0x1a8/0x2e4
[<ffffffc00017c56c>] do_splice_to+0x78/0x98
[<ffffffc00017c63c>] splice_direct_to_actor+0xb0/0x1a4
[<ffffffc00017c7b4>] do_splice_direct+0x84/0xa8
[<ffffffc000156f40>] do_sendfile+0x160/0x2a4
[<ffffffc000157980>] SyS_sendfile64+0xb4/0xc8
Signed-off-by: Pravas Kumar Panda <kumarpan@codeaurora.org>
---
drivers/net/wireless/ath/ath11k/debugfs_sta.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/wireless/ath/ath11k/debugfs_sta.c b/drivers/net/wireless/ath/ath11k/debugfs_sta.c
index 872f3ef..389dac2 100644
--- a/drivers/net/wireless/ath/ath11k/debugfs_sta.c
+++ b/drivers/net/wireless/ath/ath11k/debugfs_sta.c
@@ -219,6 +219,9 @@ static ssize_t ath11k_dbg_sta_dump_tx_stats(struct file *file,
const int size = 2 * 4096;
char *buf;
+ if (!arsta->tx_stats)
+ return -ENOENT;
+
buf = kzalloc(size, GFP_KERNEL);
if (!buf)
return -ENOMEM;
--
2.7.4
_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ath11k: Adding proper validation before accessing tx_stats
2020-03-17 11:59 ` Pravas Kumar Panda
(?)
@ 2020-03-18 11:53 ` Kalle Valo
-1 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2020-03-18 11:53 UTC (permalink / raw)
To: Pravas Kumar Panda; +Cc: linux-wireless, ath11k
Pravas Kumar Panda <kumarpan@codeaurora.org> wrote:
> Before dumping tx_stats proper validation was not been taken care of.
> Due to which we were encountering null pointer dereference(kernel panic).
> This scenario will arise when a station is getting disconnected and
> we are changing the STA state by ath11k_mac_op_sta_state and assigning
> tx_stats as NULL and after this the mac80211 will destroy the
> debugfs entry from where we are trying to read the stats.
>
> If anyone tries to dump tx_stats for that STA in between setting
> tx_stats to NULL and debugfs file removal without checking the NULL
> value it will run into a NULL pointer exception.
>
> Proceeding with the analysis of "ARM Kernel Panic".
> The APSS crash happened due to OOPS on CPU 3.
> Crash Signature : Unable to handle kernel NULL pointer dereference at
> virtual address 00000360
> During the crash,
> PC points to "ath11k_debug_htt_stats_init+0x16ac/0x1acc [ath11k]"
> LR points to "ath11k_debug_htt_stats_init+0x1688/0x1acc [ath11k]".
> The Backtrace obtained is as follows:
> [<ffffffbffcfd8590>] ath11k_debug_htt_stats_init+0x16ac/0x1acc [ath11k]
> [<ffffffc000156320>] do_loop_readv_writev+0x60/0xa4
> [<ffffffc000156a5c>] do_readv_writev+0xd8/0x19c
> [<ffffffc000156b54>] vfs_readv+0x34/0x48
> [<ffffffc00017d6f4>] default_file_splice_read+0x1a8/0x2e4
> [<ffffffc00017c56c>] do_splice_to+0x78/0x98
> [<ffffffc00017c63c>] splice_direct_to_actor+0xb0/0x1a4
> [<ffffffc00017c7b4>] do_splice_direct+0x84/0xa8
> [<ffffffc000156f40>] do_sendfile+0x160/0x2a4
> [<ffffffc000157980>] SyS_sendfile64+0xb4/0xc8
>
> Signed-off-by: Pravas Kumar Panda <kumarpan@codeaurora.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Patch applied to ath-next branch of ath.git, thanks.
fe0ebb51604f ath11k: Adding proper validation before accessing tx_stats
--
https://patchwork.kernel.org/patch/11442613/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ath11k: Adding proper validation before accessing tx_stats
2020-03-17 11:59 ` Pravas Kumar Panda
(?)
(?)
@ 2020-03-18 11:53 ` Kalle Valo
-1 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2020-03-18 11:53 UTC (permalink / raw)
To: Pravas Kumar Panda; +Cc: ath11k, linux-wireless, Pravas Kumar Panda
Pravas Kumar Panda <kumarpan@codeaurora.org> wrote:
> Before dumping tx_stats proper validation was not been taken care of.
> Due to which we were encountering null pointer dereference(kernel panic).
> This scenario will arise when a station is getting disconnected and
> we are changing the STA state by ath11k_mac_op_sta_state and assigning
> tx_stats as NULL and after this the mac80211 will destroy the
> debugfs entry from where we are trying to read the stats.
>
> If anyone tries to dump tx_stats for that STA in between setting
> tx_stats to NULL and debugfs file removal without checking the NULL
> value it will run into a NULL pointer exception.
>
> Proceeding with the analysis of "ARM Kernel Panic".
> The APSS crash happened due to OOPS on CPU 3.
> Crash Signature : Unable to handle kernel NULL pointer dereference at
> virtual address 00000360
> During the crash,
> PC points to "ath11k_debug_htt_stats_init+0x16ac/0x1acc [ath11k]"
> LR points to "ath11k_debug_htt_stats_init+0x1688/0x1acc [ath11k]".
> The Backtrace obtained is as follows:
> [<ffffffbffcfd8590>] ath11k_debug_htt_stats_init+0x16ac/0x1acc [ath11k]
> [<ffffffc000156320>] do_loop_readv_writev+0x60/0xa4
> [<ffffffc000156a5c>] do_readv_writev+0xd8/0x19c
> [<ffffffc000156b54>] vfs_readv+0x34/0x48
> [<ffffffc00017d6f4>] default_file_splice_read+0x1a8/0x2e4
> [<ffffffc00017c56c>] do_splice_to+0x78/0x98
> [<ffffffc00017c63c>] splice_direct_to_actor+0xb0/0x1a4
> [<ffffffc00017c7b4>] do_splice_direct+0x84/0xa8
> [<ffffffc000156f40>] do_sendfile+0x160/0x2a4
> [<ffffffc000157980>] SyS_sendfile64+0xb4/0xc8
>
> Signed-off-by: Pravas Kumar Panda <kumarpan@codeaurora.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Patch applied to ath-next branch of ath.git, thanks.
fe0ebb51604f ath11k: Adding proper validation before accessing tx_stats
--
https://patchwork.kernel.org/patch/11442613/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-18 11:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-17 11:59 [PATCH] ath11k: Adding proper validation before accessing tx_stats Pravas Kumar Panda
2020-03-17 11:59 ` Pravas Kumar Panda
2020-03-18 11:53 ` Kalle Valo
2020-03-18 11:53 ` Kalle Valo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.