public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] scsi: smartpqi: use shost_to_hba() in pqi_scan_finished()
       [not found] <20260415204850.799431-1-mwilck@suse.com>
@ 2026-04-15 20:48 ` Martin Wilck
  2026-04-16  5:56   ` Hannes Reinecke
  2026-04-16 14:10   ` Don.Brace
  0 siblings, 2 replies; 3+ messages in thread
From: Martin Wilck @ 2026-04-15 20:48 UTC (permalink / raw)
  To: Martin K. Petersen, Christoph Hellwig, Don Brace
  Cc: linux-scsi, Hannes Reinecke, Lee Duncan, Martin Wilck, storagedev,
	stable

shost_to_hba() is used everywhere except to obtain pqi_ctrl_info
from shosti, except in pqi_scan_finished(), where shost_priv() is used.
This causes one pointer dereference to be missed, as shost->hostdata
is a pointer in smartpqi. Fix it.

Fixes: 6c223761eb54 ("smartpqi: initial commit of Microsemi smartpqi driver")
Signed-off-by: Martin Wilck <mwilck@suse.com>
Cc: Don Brace <don.brace@microchip.com>
Cc: storagedev@microchip.com
Cc: stable@vger.kernel.org
---
 drivers/scsi/smartpqi/smartpqi_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index b4ed991..65ff509 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -2642,7 +2642,7 @@ static int pqi_scan_finished(struct Scsi_Host *shost,
 {
 	struct pqi_ctrl_info *ctrl_info;
 
-	ctrl_info = shost_priv(shost);
+	ctrl_info = shost_to_hba(shost);
 
 	return !mutex_is_locked(&ctrl_info->scan_mutex);
 }
-- 
2.51.0


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

* Re: [PATCH 1/2] scsi: smartpqi: use shost_to_hba() in pqi_scan_finished()
  2026-04-15 20:48 ` [PATCH 1/2] scsi: smartpqi: use shost_to_hba() in pqi_scan_finished() Martin Wilck
@ 2026-04-16  5:56   ` Hannes Reinecke
  2026-04-16 14:10   ` Don.Brace
  1 sibling, 0 replies; 3+ messages in thread
From: Hannes Reinecke @ 2026-04-16  5:56 UTC (permalink / raw)
  To: Martin Wilck, Martin K. Petersen, Christoph Hellwig, Don Brace
  Cc: linux-scsi, Lee Duncan, Martin Wilck, storagedev, stable

On 4/15/26 22:48, Martin Wilck wrote:
> shost_to_hba() is used everywhere except to obtain pqi_ctrl_info
> from shosti, except in pqi_scan_finished(), where shost_priv() is used.
> This causes one pointer dereference to be missed, as shost->hostdata
> is a pointer in smartpqi. Fix it.
> 
> Fixes: 6c223761eb54 ("smartpqi: initial commit of Microsemi smartpqi driver")
> Signed-off-by: Martin Wilck <mwilck@suse.com>
> Cc: Don Brace <don.brace@microchip.com>
> Cc: storagedev@microchip.com
> Cc: stable@vger.kernel.org
> ---
>   drivers/scsi/smartpqi/smartpqi_init.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
> index b4ed991..65ff509 100644
> --- a/drivers/scsi/smartpqi/smartpqi_init.c
> +++ b/drivers/scsi/smartpqi/smartpqi_init.c
> @@ -2642,7 +2642,7 @@ static int pqi_scan_finished(struct Scsi_Host *shost,
>   {
>   	struct pqi_ctrl_info *ctrl_info;
>   
> -	ctrl_info = shost_priv(shost);
> +	ctrl_info = shost_to_hba(shost);
>   
>   	return !mutex_is_locked(&ctrl_info->scan_mutex);
>   }
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare@suse.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich

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

* Re: [PATCH 1/2] scsi: smartpqi: use shost_to_hba() in pqi_scan_finished()
  2026-04-15 20:48 ` [PATCH 1/2] scsi: smartpqi: use shost_to_hba() in pqi_scan_finished() Martin Wilck
  2026-04-16  5:56   ` Hannes Reinecke
@ 2026-04-16 14:10   ` Don.Brace
  1 sibling, 0 replies; 3+ messages in thread
From: Don.Brace @ 2026-04-16 14:10 UTC (permalink / raw)
  To: martin.wilck, martin.petersen, hch
  Cc: linux-scsi, hare, lduncan, mwilck, storagedev, stable


________________________________________
From: Martin Wilck <martin.wilck@suse.com>
Sent: Wednesday, April 15, 2026 3:48 PM
To: Martin K. Petersen <martin.petersen@oracle.com>; Christoph Hellwig <hch@lst.de>; Don Brace - C33706 <Don.Brace@microchip.com>
Cc: linux-scsi@vger.kernel.org <linux-scsi@vger.kernel.org>; Hannes Reinecke <hare@suse.de>; Lee Duncan <lduncan@suse.com>; Martin Wilck <mwilck@suse.com>; storagedev <storagedev@microchip.com>; stable@vger.kernel.org <stable@vger.kernel.org>
Subject: [PATCH 1/2] scsi: smartpqi: use shost_to_hba() in pqi_scan_finished()
 

shost_to_hba() is used everywhere except to obtain pqi_ctrl_info
from shosti, except in pqi_scan_finished(), where shost_priv() is used.
This causes one pointer dereference to be missed, as shost->hostdata
is a pointer in smartpqi. Fix it.

Fixes: 6c223761eb54 ("smartpqi: initial commit of Microsemi smartpqi driver")
Signed-off-by: Martin Wilck <mwilck@suse.com>

Thanks for your patch. Makes sense.
Reviewed-by: Don Brace <don.brace@microchip.com>

Cc: Don Brace <don.brace@microchip.com>
Cc: storagedev@microchip.com
Cc: stable@vger.kernel.org
---
 drivers/scsi/smartpqi/smartpqi_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index b4ed991..65ff509 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -2642,7 +2642,7 @@ static int pqi_scan_finished(struct Scsi_Host *shost,
 {
        struct pqi_ctrl_info *ctrl_info;

-       ctrl_info = shost_priv(shost);
+       ctrl_info = shost_to_hba(shost);

        return !mutex_is_locked(&ctrl_info->scan_mutex);
 }
--
2.51.0

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

end of thread, other threads:[~2026-04-16 14:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260415204850.799431-1-mwilck@suse.com>
2026-04-15 20:48 ` [PATCH 1/2] scsi: smartpqi: use shost_to_hba() in pqi_scan_finished() Martin Wilck
2026-04-16  5:56   ` Hannes Reinecke
2026-04-16 14:10   ` Don.Brace

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox