netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] cxgb4: Fix kernel panic while accessing sge_info
@ 2019-12-13  1:09 Vishal Kulkarni
  2019-12-15 19:28 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Vishal Kulkarni @ 2019-12-13  1:09 UTC (permalink / raw)
  To: netdev, davem; +Cc: nirranjan, Vishal Kulkarni, Herat Ramani

The sge_info debugfs collects offload queue info even when offload capability
is disabled and leads to panic.

[  144.139871] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  144.139874] CR2: 0000000000000000 CR3: 000000082d456005 CR4: 00000000001606e0
[  144.139876] Call Trace:
[  144.139887]  sge_queue_start+0x12/0x30 [cxgb4]
[  144.139897]  seq_read+0x1d4/0x3d0
[  144.139906]  full_proxy_read+0x50/0x70
[  144.139913]  vfs_read+0x89/0x140
[  144.139916]  ksys_read+0x55/0xd0
[  144.139924]  do_syscall_64+0x5b/0x1d0
[  144.139933]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  144.139936] RIP: 0033:0x7f4b01493990

Fix this crash by skipping the offload queue access in sge_qinfo when
offload capability is disabled

Signed-off-by: Herat Ramani <herat@chelsio.com>
Signed-off-by: Vishal Kulkarni <vishal@chelsio.com>
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
index 93868dc..aca9f7a 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
@@ -3048,6 +3048,9 @@ static int sge_queue_entries(const struct adapter *adap)
 	int tot_uld_entries = 0;
 	int i;
 
+	if (!is_uld(adap))
+		goto lld_only;
+
 	mutex_lock(&uld_mutex);
 	for (i = 0; i < CXGB4_TX_MAX; i++)
 		tot_uld_entries += sge_qinfo_uld_txq_entries(adap, i);
@@ -3058,6 +3061,7 @@ static int sge_queue_entries(const struct adapter *adap)
 	}
 	mutex_unlock(&uld_mutex);
 
+lld_only:
 	return DIV_ROUND_UP(adap->sge.ethqsets, 4) +
 	       (adap->sge.eohw_txq ? DIV_ROUND_UP(adap->sge.eoqsets, 4) : 0) +
 	       tot_uld_entries +
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] cxgb4: Fix kernel panic while accessing sge_info
  2019-12-13  1:09 [PATCH net] cxgb4: Fix kernel panic while accessing sge_info Vishal Kulkarni
@ 2019-12-15 19:28 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2019-12-15 19:28 UTC (permalink / raw)
  To: Vishal Kulkarni; +Cc: netdev, davem, nirranjan, Herat Ramani

On Fri, 13 Dec 2019 06:39:39 +0530, Vishal Kulkarni wrote:
> The sge_info debugfs collects offload queue info even when offload capability
> is disabled and leads to panic.
> 
> [  144.139871] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [  144.139874] CR2: 0000000000000000 CR3: 000000082d456005 CR4: 00000000001606e0
> [  144.139876] Call Trace:
> [  144.139887]  sge_queue_start+0x12/0x30 [cxgb4]
> [  144.139897]  seq_read+0x1d4/0x3d0
> [  144.139906]  full_proxy_read+0x50/0x70
> [  144.139913]  vfs_read+0x89/0x140
> [  144.139916]  ksys_read+0x55/0xd0
> [  144.139924]  do_syscall_64+0x5b/0x1d0
> [  144.139933]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
> [  144.139936] RIP: 0033:0x7f4b01493990
> 
> Fix this crash by skipping the offload queue access in sge_qinfo when
> offload capability is disabled
> 
> Signed-off-by: Herat Ramani <herat@chelsio.com>
> Signed-off-by: Vishal Kulkarni <vishal@chelsio.com>

Applied, please provide Fixes tag in the future.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-15 19:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-13  1:09 [PATCH net] cxgb4: Fix kernel panic while accessing sge_info Vishal Kulkarni
2019-12-15 19:28 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).