* Re: [PATCH iwl-net] idpf: protect shutdown from reset
2025-04-10 11:52 [PATCH iwl-net] idpf: protect shutdown from reset Larysa Zaremba
@ 2025-04-11 18:29 ` Simon Horman
2025-04-16 17:03 ` Tantilov, Emil S
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2025-04-11 18:29 UTC (permalink / raw)
To: Larysa Zaremba
Cc: intel-wired-lan, Tony Nguyen, Michal Swiatkowski, Emil Tantilov,
Madhu Chittim, Josh Hay, Michal Kubiak, Przemek Kitszel,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netdev, linux-kernel
On Thu, Apr 10, 2025 at 01:52:23PM +0200, Larysa Zaremba wrote:
> Before the referenced commit, the shutdown just called idpf_remove(),
> this way IDPF_REMOVE_IN_PROG was protecting us from the serv_task
> rescheduling reset. Without this flag set the shutdown process is
> vulnerable to HW reset or any other triggering conditions (such as
> default mailbox being destroyed).
>
> When one of conditions checked in idpf_service_task becomes true,
> vc_event_task can be rescheduled during shutdown, this leads to accessing
> freed memory e.g. idpf_req_rel_vector_indexes() trying to read
> vport->q_vector_idxs. This in turn causes the system to become defunct
> during e.g. systemctl kexec.
>
> Considering using IDPF_REMOVE_IN_PROG would lead to more heavy shutdown
> process, instead just cancel the serv_task before cancelling
> adapter->serv_task before cancelling adapter->vc_event_task to ensure that
> reset will not be scheduled while we are doing a shutdown.
>
> Fixes: 4c9106f4906a ("idpf: fix adapter NULL pointer dereference on reboot")
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH iwl-net] idpf: protect shutdown from reset
2025-04-10 11:52 [PATCH iwl-net] idpf: protect shutdown from reset Larysa Zaremba
2025-04-11 18:29 ` Simon Horman
@ 2025-04-16 17:03 ` Tantilov, Emil S
2025-04-25 17:33 ` [Intel-wired-lan] " Salin, Samuel
2025-11-06 7:45 ` Loktionov, Aleksandr
2025-11-07 23:38 ` Jacob Keller
3 siblings, 1 reply; 6+ messages in thread
From: Tantilov, Emil S @ 2025-04-16 17:03 UTC (permalink / raw)
To: Larysa Zaremba, intel-wired-lan, Tony Nguyen
Cc: Michal Swiatkowski, Madhu Chittim, Josh Hay, Michal Kubiak,
Przemek Kitszel, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, netdev, linux-kernel
On 4/10/2025 4:52 AM, Larysa Zaremba wrote:
> Before the referenced commit, the shutdown just called idpf_remove(),
> this way IDPF_REMOVE_IN_PROG was protecting us from the serv_task
> rescheduling reset. Without this flag set the shutdown process is
> vulnerable to HW reset or any other triggering conditions (such as
> default mailbox being destroyed).
>
> When one of conditions checked in idpf_service_task becomes true,
> vc_event_task can be rescheduled during shutdown, this leads to accessing
> freed memory e.g. idpf_req_rel_vector_indexes() trying to read
> vport->q_vector_idxs. This in turn causes the system to become defunct
> during e.g. systemctl kexec.
>
> Considering using IDPF_REMOVE_IN_PROG would lead to more heavy shutdown
> process, instead just cancel the serv_task before cancelling
> adapter->serv_task before cancelling adapter->vc_event_task to ensure that
> reset will not be scheduled while we are doing a shutdown.
>
> Fixes: 4c9106f4906a ("idpf: fix adapter NULL pointer dereference on reboot")
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
> ---
> drivers/net/ethernet/intel/idpf/idpf_main.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_main.c b/drivers/net/ethernet/intel/idpf/idpf_main.c
> index bec4a02c5373..b35713036a54 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_main.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_main.c
> @@ -89,6 +89,7 @@ static void idpf_shutdown(struct pci_dev *pdev)
> {
> struct idpf_adapter *adapter = pci_get_drvdata(pdev);
>
> + cancel_delayed_work_sync(&adapter->serv_task);
> cancel_delayed_work_sync(&adapter->vc_event_task);
> idpf_vc_core_deinit(adapter);
> idpf_deinit_dflt_mbx(adapter);
Reviewed-by: Emil Tantilov <emil.s.tantilov@intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread* RE: [Intel-wired-lan] [PATCH iwl-net] idpf: protect shutdown from reset
2025-04-16 17:03 ` Tantilov, Emil S
@ 2025-04-25 17:33 ` Salin, Samuel
0 siblings, 0 replies; 6+ messages in thread
From: Salin, Samuel @ 2025-04-25 17:33 UTC (permalink / raw)
To: Tantilov, Emil S, Zaremba, Larysa,
intel-wired-lan@lists.osuosl.org, Nguyen, Anthony L
Cc: Michal Swiatkowski, Chittim, Madhu, Hay, Joshua A, Kubiak, Michal,
Kitszel, Przemyslaw, Andrew Lunn, David S. Miller, Dumazet, Eric,
Jakub Kicinski, Paolo Abeni, Simon Horman, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Tantilov, Emil S
> Sent: Wednesday, April 16, 2025 10:04 AM
> To: Zaremba, Larysa <larysa.zaremba@intel.com>; intel-wired-
> lan@lists.osuosl.org; Nguyen, Anthony L <anthony.l.nguyen@intel.com>
> Cc: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>; Chittim,
> Madhu <madhu.chittim@intel.com>; Hay, Joshua A
> <joshua.a.hay@intel.com>; Kubiak, Michal <michal.kubiak@intel.com>;
> Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>; Andrew Lunn
> <andrew+netdev@lunn.ch>; David S. Miller <davem@davemloft.net>;
> Dumazet, Eric <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>;
> Paolo Abeni <pabeni@redhat.com>; Simon Horman <horms@kernel.org>;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [Intel-wired-lan] [PATCH iwl-net] idpf: protect shutdown from
> reset
>
>
>
> On 4/10/2025 4:52 AM, Larysa Zaremba wrote:
> > Before the referenced commit, the shutdown just called idpf_remove(),
> > this way IDPF_REMOVE_IN_PROG was protecting us from the serv_task
> > rescheduling reset. Without this flag set the shutdown process is
> > vulnerable to HW reset or any other triggering conditions (such as
> > default mailbox being destroyed).
> >
> > When one of conditions checked in idpf_service_task becomes true,
> > vc_event_task can be rescheduled during shutdown, this leads to
> > accessing freed memory e.g. idpf_req_rel_vector_indexes() trying to
> > read
> > vport->q_vector_idxs. This in turn causes the system to become defunct
> > during e.g. systemctl kexec.
> >
> > Considering using IDPF_REMOVE_IN_PROG would lead to more heavy
> > shutdown process, instead just cancel the serv_task before cancelling
> > adapter->serv_task before cancelling adapter->vc_event_task to ensure
> > adapter->that
> > reset will not be scheduled while we are doing a shutdown.
> >
> > Fixes: 4c9106f4906a ("idpf: fix adapter NULL pointer dereference on
> > reboot")
> > Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> > Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
> > ---
> Reviewed-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Samuel Salin <Samuel.salin@intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [Intel-wired-lan] [PATCH iwl-net] idpf: protect shutdown from reset
2025-04-10 11:52 [PATCH iwl-net] idpf: protect shutdown from reset Larysa Zaremba
2025-04-11 18:29 ` Simon Horman
2025-04-16 17:03 ` Tantilov, Emil S
@ 2025-11-06 7:45 ` Loktionov, Aleksandr
2025-11-07 23:38 ` Jacob Keller
3 siblings, 0 replies; 6+ messages in thread
From: Loktionov, Aleksandr @ 2025-11-06 7:45 UTC (permalink / raw)
To: Zaremba, Larysa, intel-wired-lan@lists.osuosl.org,
Nguyen, Anthony L
Cc: Zaremba, Larysa, Michal Swiatkowski, Tantilov, Emil S,
Chittim, Madhu, Hay, Joshua A, Kubiak, Michal,
Kitszel, Przemyslaw, Andrew Lunn, David S. Miller, Dumazet, Eric,
Jakub Kicinski, Paolo Abeni, Simon Horman, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> Of Larysa Zaremba
> Sent: Thursday, April 10, 2025 1:52 PM
> To: intel-wired-lan@lists.osuosl.org; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>
> Cc: Zaremba, Larysa <larysa.zaremba@intel.com>; Michal Swiatkowski
> <michal.swiatkowski@linux.intel.com>; Tantilov, Emil S
> <emil.s.tantilov@intel.com>; Chittim, Madhu <madhu.chittim@intel.com>;
> Hay, Joshua A <joshua.a.hay@intel.com>; Kubiak, Michal
> <michal.kubiak@intel.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@intel.com>; Andrew Lunn <andrew+netdev@lunn.ch>;
> David S. Miller <davem@davemloft.net>; Dumazet, Eric
> <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
> <pabeni@redhat.com>; Simon Horman <horms@kernel.org>;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [Intel-wired-lan] [PATCH iwl-net] idpf: protect shutdown from
> reset
>
> Before the referenced commit, the shutdown just called idpf_remove(),
> this way IDPF_REMOVE_IN_PROG was protecting us from the serv_task
> rescheduling reset. Without this flag set the shutdown process is
> vulnerable to HW reset or any other triggering conditions (such as
> default mailbox being destroyed).
>
> When one of conditions checked in idpf_service_task becomes true,
> vc_event_task can be rescheduled during shutdown, this leads to
> accessing freed memory e.g. idpf_req_rel_vector_indexes() trying to
> read
> vport->q_vector_idxs. This in turn causes the system to become defunct
> during e.g. systemctl kexec.
>
> Considering using IDPF_REMOVE_IN_PROG would lead to more heavy
> shutdown process, instead just cancel the serv_task before cancelling
> adapter->serv_task before cancelling adapter->vc_event_task to ensure
> adapter->that
> reset will not be scheduled while we are doing a shutdown.
>
> Fixes: 4c9106f4906a ("idpf: fix adapter NULL pointer dereference on
> reboot")
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
> ---
> drivers/net/ethernet/intel/idpf/idpf_main.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_main.c
> b/drivers/net/ethernet/intel/idpf/idpf_main.c
> index bec4a02c5373..b35713036a54 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_main.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_main.c
> @@ -89,6 +89,7 @@ static void idpf_shutdown(struct pci_dev *pdev) {
> struct idpf_adapter *adapter = pci_get_drvdata(pdev);
>
> + cancel_delayed_work_sync(&adapter->serv_task);
> cancel_delayed_work_sync(&adapter->vc_event_task);
> idpf_vc_core_deinit(adapter);
> idpf_deinit_dflt_mbx(adapter);
> --
> 2.47.0
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [Intel-wired-lan] [PATCH iwl-net] idpf: protect shutdown from reset
2025-04-10 11:52 [PATCH iwl-net] idpf: protect shutdown from reset Larysa Zaremba
` (2 preceding siblings ...)
2025-11-06 7:45 ` Loktionov, Aleksandr
@ 2025-11-07 23:38 ` Jacob Keller
3 siblings, 0 replies; 6+ messages in thread
From: Jacob Keller @ 2025-11-07 23:38 UTC (permalink / raw)
To: Larysa Zaremba, intel-wired-lan, Tony Nguyen
Cc: Michal Swiatkowski, Emil Tantilov, Madhu Chittim, Josh Hay,
Michal Kubiak, Przemek Kitszel, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman, netdev,
linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 1921 bytes --]
On 4/10/2025 4:52 AM, Larysa Zaremba wrote:
> Before the referenced commit, the shutdown just called idpf_remove(),
> this way IDPF_REMOVE_IN_PROG was protecting us from the serv_task
> rescheduling reset. Without this flag set the shutdown process is
> vulnerable to HW reset or any other triggering conditions (such as
> default mailbox being destroyed).
>
> When one of conditions checked in idpf_service_task becomes true,
> vc_event_task can be rescheduled during shutdown, this leads to accessing
> freed memory e.g. idpf_req_rel_vector_indexes() trying to read
> vport->q_vector_idxs. This in turn causes the system to become defunct
> during e.g. systemctl kexec.
>
> Considering using IDPF_REMOVE_IN_PROG would lead to more heavy shutdown
> process, instead just cancel the serv_task before cancelling
> adapter->serv_task before cancelling adapter->vc_event_task to ensure that
> reset will not be scheduled while we are doing a shutdown.
>
> Fixes: 4c9106f4906a ("idpf: fix adapter NULL pointer dereference on reboot")
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
> ---
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> drivers/net/ethernet/intel/idpf/idpf_main.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_main.c b/drivers/net/ethernet/intel/idpf/idpf_main.c
> index bec4a02c5373..b35713036a54 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_main.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_main.c
> @@ -89,6 +89,7 @@ static void idpf_shutdown(struct pci_dev *pdev)
> {
> struct idpf_adapter *adapter = pci_get_drvdata(pdev);
>
> + cancel_delayed_work_sync(&adapter->serv_task);
> cancel_delayed_work_sync(&adapter->vc_event_task);
> idpf_vc_core_deinit(adapter);
> idpf_deinit_dflt_mbx(adapter);
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread