* [PATCH] Fix kernel panic issue after removing igb driver
@ 2023-08-11 12:02 marshall.shao
2023-08-11 16:12 ` Vadim Fedorenko
0 siblings, 1 reply; 2+ messages in thread
From: marshall.shao @ 2023-08-11 12:02 UTC (permalink / raw)
To: Jesse Brandeburg, Tony Nguyen, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Jacob Keller, Simon Horman,
Akihiko Odaki, Kees Cook, Bjorn Helgaas, Aleksandr Loktionov,
Lin Ma, intel-wired-lan, netdev, linux-kernel
Cc: Marshall Shao
From: Marshall Shao <Marshall.Shao@dell.com>
This patch fixes a kernel panic issue after removing the igb driver
from the usermode.
A delayed work will be schedule in igb_ptp_init(),
if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
INIT_DELAYED_WORK(&adapter->ptp_overflow_work,
igb_ptp_overflow_check);
If CONFIG_PTP_1588_CLOCK is not enabled, the delayed work cannot be
cancelled when igb_ptp_suspend is called.
Signed-off-by: Marshall Shao <Marshall.Shao@dell.com>
---
drivers/net/ethernet/intel/igb/igb_ptp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
index 405886ee5261..b21822ea1c7d 100644
--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
@@ -1435,12 +1435,12 @@ void igb_ptp_sdp_init(struct igb_adapter *adapter)
*/
void igb_ptp_suspend(struct igb_adapter *adapter)
{
- if (!(adapter->ptp_flags & IGB_PTP_ENABLED))
- return;
-
if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
cancel_delayed_work_sync(&adapter->ptp_overflow_work);
+ if (!(adapter->ptp_flags & IGB_PTP_ENABLED))
+ return;
+
cancel_work_sync(&adapter->ptp_tx_work);
if (adapter->ptp_tx_skb) {
dev_kfree_skb_any(adapter->ptp_tx_skb);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] Fix kernel panic issue after removing igb driver
2023-08-11 12:02 [PATCH] Fix kernel panic issue after removing igb driver marshall.shao
@ 2023-08-11 16:12 ` Vadim Fedorenko
0 siblings, 0 replies; 2+ messages in thread
From: Vadim Fedorenko @ 2023-08-11 16:12 UTC (permalink / raw)
To: marshall.shao, Jesse Brandeburg, Tony Nguyen, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Jacob Keller,
Simon Horman, Akihiko Odaki, Kees Cook, Bjorn Helgaas,
Aleksandr Loktionov, Lin Ma, intel-wired-lan, netdev,
linux-kernel
On 11/08/2023 13:02, marshall.shao@dell.com wrote:
> From: Marshall Shao <Marshall.Shao@dell.com>
>
> This patch fixes a kernel panic issue after removing the igb driver
> from the usermode.
>
> A delayed work will be schedule in igb_ptp_init(),
>
> if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
> INIT_DELAYED_WORK(&adapter->ptp_overflow_work,
> igb_ptp_overflow_check);
>
> If CONFIG_PTP_1588_CLOCK is not enabled, the delayed work cannot be
> cancelled when igb_ptp_suspend is called.
But should this work be inited in case there is no PTP support in the
kernel? Maybe it's better to avoid any driver threads in this case and
move the initialization to the if block where we know that PHC device
is created and working?
>
> Signed-off-by: Marshall Shao <Marshall.Shao@dell.com>
> ---
> drivers/net/ethernet/intel/igb/igb_ptp.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
> index 405886ee5261..b21822ea1c7d 100644
> --- a/drivers/net/ethernet/intel/igb/igb_ptp.c
> +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
> @@ -1435,12 +1435,12 @@ void igb_ptp_sdp_init(struct igb_adapter *adapter)
> */
> void igb_ptp_suspend(struct igb_adapter *adapter)
> {
> - if (!(adapter->ptp_flags & IGB_PTP_ENABLED))
> - return;
> -
> if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
> cancel_delayed_work_sync(&adapter->ptp_overflow_work);
>
> + if (!(adapter->ptp_flags & IGB_PTP_ENABLED))
> + return;
> +
> cancel_work_sync(&adapter->ptp_tx_work);
> if (adapter->ptp_tx_skb) {
> dev_kfree_skb_any(adapter->ptp_tx_skb);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-11 16:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-11 12:02 [PATCH] Fix kernel panic issue after removing igb driver marshall.shao
2023-08-11 16:12 ` Vadim Fedorenko
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).