Commit ce756daa authored by Tomas Henzl's avatar Tomas Henzl Committed by Martin K. Petersen

scsi: mpi3mr: Fix expander node leak in mpi3mr_remove()

Add a missing resource clean up in .remove.

Fixes: e22bae30 ("scsi: mpi3mr: Add expander devices to STL")
Signed-off-by: default avatarTomas Henzl <thenzl@redhat.com>
Link: https://lore.kernel.org/r/20230302234336.25456-7-thenzl@redhat.comAcked-by: default avatarSathya Prakash Veerichetty <sathya.prakash@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent c7983044
...@@ -1393,4 +1393,6 @@ void mpi3mr_flush_drv_cmds(struct mpi3mr_ioc *mrioc); ...@@ -1393,4 +1393,6 @@ void mpi3mr_flush_drv_cmds(struct mpi3mr_ioc *mrioc);
void mpi3mr_flush_cmds_for_unrecovered_controller(struct mpi3mr_ioc *mrioc); void mpi3mr_flush_cmds_for_unrecovered_controller(struct mpi3mr_ioc *mrioc);
void mpi3mr_free_enclosure_list(struct mpi3mr_ioc *mrioc); void mpi3mr_free_enclosure_list(struct mpi3mr_ioc *mrioc);
int mpi3mr_process_admin_reply_q(struct mpi3mr_ioc *mrioc); int mpi3mr_process_admin_reply_q(struct mpi3mr_ioc *mrioc);
void mpi3mr_expander_node_remove(struct mpi3mr_ioc *mrioc,
struct mpi3mr_sas_node *sas_expander);
#endif /*MPI3MR_H_INCLUDED*/ #endif /*MPI3MR_H_INCLUDED*/
...@@ -5079,6 +5079,7 @@ static void mpi3mr_remove(struct pci_dev *pdev) ...@@ -5079,6 +5079,7 @@ static void mpi3mr_remove(struct pci_dev *pdev)
unsigned long flags; unsigned long flags;
struct mpi3mr_tgt_dev *tgtdev, *tgtdev_next; struct mpi3mr_tgt_dev *tgtdev, *tgtdev_next;
struct mpi3mr_hba_port *port, *hba_port_next; struct mpi3mr_hba_port *port, *hba_port_next;
struct mpi3mr_sas_node *sas_expander, *sas_expander_next;
if (!shost) if (!shost)
return; return;
...@@ -5119,6 +5120,12 @@ static void mpi3mr_remove(struct pci_dev *pdev) ...@@ -5119,6 +5120,12 @@ static void mpi3mr_remove(struct pci_dev *pdev)
mpi3mr_cleanup_resources(mrioc); mpi3mr_cleanup_resources(mrioc);
spin_lock_irqsave(&mrioc->sas_node_lock, flags); spin_lock_irqsave(&mrioc->sas_node_lock, flags);
list_for_each_entry_safe_reverse(sas_expander, sas_expander_next,
&mrioc->sas_expander_list, list) {
spin_unlock_irqrestore(&mrioc->sas_node_lock, flags);
mpi3mr_expander_node_remove(mrioc, sas_expander);
spin_lock_irqsave(&mrioc->sas_node_lock, flags);
}
list_for_each_entry_safe(port, hba_port_next, &mrioc->hba_port_table_list, list) { list_for_each_entry_safe(port, hba_port_next, &mrioc->hba_port_table_list, list) {
ioc_info(mrioc, ioc_info(mrioc,
"removing hba_port entry: %p port: %d from hba_port list\n", "removing hba_port entry: %p port: %d from hba_port list\n",
......
...@@ -9,9 +9,6 @@ ...@@ -9,9 +9,6 @@
#include "mpi3mr.h" #include "mpi3mr.h"
static void mpi3mr_expander_node_remove(struct mpi3mr_ioc *mrioc,
struct mpi3mr_sas_node *sas_expander);
/** /**
* mpi3mr_post_transport_req - Issue transport requests and wait * mpi3mr_post_transport_req - Issue transport requests and wait
* @mrioc: Adapter instance reference * @mrioc: Adapter instance reference
...@@ -2164,7 +2161,7 @@ int mpi3mr_expander_add(struct mpi3mr_ioc *mrioc, u16 handle) ...@@ -2164,7 +2161,7 @@ int mpi3mr_expander_add(struct mpi3mr_ioc *mrioc, u16 handle)
* *
* Return nothing. * Return nothing.
*/ */
static void mpi3mr_expander_node_remove(struct mpi3mr_ioc *mrioc, void mpi3mr_expander_node_remove(struct mpi3mr_ioc *mrioc,
struct mpi3mr_sas_node *sas_expander) struct mpi3mr_sas_node *sas_expander)
{ {
struct mpi3mr_sas_port *mr_sas_port, *next; struct mpi3mr_sas_port *mr_sas_port, *next;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment