public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: qla4xxx: Prevent a potential error pointer dereference
@ 2025-08-13  5:49 Dan Carpenter
  2025-08-13 21:03 ` Chris Leech
  2025-08-15  3:38 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2025-08-13  5:49 UTC (permalink / raw)
  To: Mike Christie
  Cc: Nilesh Javali, Manish Rangankar, GR-QLogic-Storage-Upstream,
	James E.J. Bottomley, Martin K. Petersen, James Bottomley,
	Ravi Anand, linux-scsi, linux-kernel, kernel-janitors

The qla4xxx_get_ep_fwdb() function is supposed to return NULL on error,
but qla4xxx_ep_connect() returns error pointers.  Propagating the error
pointers will lead to an Oops in the caller, so change the error
pointers to NULL.

Fixes: 13483730a13b ("[SCSI] qla4xxx: fix flash/ddb support")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/scsi/qla4xxx/ql4_os.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index a39f1da4ce47..a761c0aa5127 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -6606,6 +6606,8 @@ static struct iscsi_endpoint *qla4xxx_get_ep_fwdb(struct scsi_qla_host *ha,
 
 	ep = qla4xxx_ep_connect(ha->host, (struct sockaddr *)dst_addr, 0);
 	vfree(dst_addr);
+	if (IS_ERR(ep))
+		return NULL;
 	return ep;
 }
 
-- 
2.47.2


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

* Re: [PATCH] scsi: qla4xxx: Prevent a potential error pointer dereference
  2025-08-13  5:49 [PATCH] scsi: qla4xxx: Prevent a potential error pointer dereference Dan Carpenter
@ 2025-08-13 21:03 ` Chris Leech
  2025-08-15  3:38 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Leech @ 2025-08-13 21:03 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Mike Christie, Nilesh Javali, Manish Rangankar,
	GR-QLogic-Storage-Upstream, James E.J. Bottomley,
	Martin K. Petersen, James Bottomley, Ravi Anand, linux-scsi,
	linux-kernel, kernel-janitors

On Wed, Aug 13, 2025 at 08:49:08AM +0300, Dan Carpenter wrote:
> The qla4xxx_get_ep_fwdb() function is supposed to return NULL on error,
> but qla4xxx_ep_connect() returns error pointers.  Propagating the error
> pointers will lead to an Oops in the caller, so change the error
> pointers to NULL.

Looks right to me.

Reviewed-by: Chris Leech <cleech@redhat.com>

> Fixes: 13483730a13b ("[SCSI] qla4xxx: fix flash/ddb support")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/scsi/qla4xxx/ql4_os.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
> index a39f1da4ce47..a761c0aa5127 100644
> --- a/drivers/scsi/qla4xxx/ql4_os.c
> +++ b/drivers/scsi/qla4xxx/ql4_os.c
> @@ -6606,6 +6606,8 @@ static struct iscsi_endpoint *qla4xxx_get_ep_fwdb(struct scsi_qla_host *ha,
>  
>  	ep = qla4xxx_ep_connect(ha->host, (struct sockaddr *)dst_addr, 0);
>  	vfree(dst_addr);
> +	if (IS_ERR(ep))
> +		return NULL;
>  	return ep;
>  }
>  
> -- 
> 2.47.2
> 


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

* Re: [PATCH] scsi: qla4xxx: Prevent a potential error pointer dereference
  2025-08-13  5:49 [PATCH] scsi: qla4xxx: Prevent a potential error pointer dereference Dan Carpenter
  2025-08-13 21:03 ` Chris Leech
@ 2025-08-15  3:38 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2025-08-15  3:38 UTC (permalink / raw)
  To: Mike Christie, Dan Carpenter
  Cc: Martin K . Petersen, Nilesh Javali, Manish Rangankar,
	GR-QLogic-Storage-Upstream, James E.J. Bottomley, James Bottomley,
	Ravi Anand, linux-scsi, linux-kernel, kernel-janitors

On Wed, 13 Aug 2025 08:49:08 +0300, Dan Carpenter wrote:

> The qla4xxx_get_ep_fwdb() function is supposed to return NULL on error,
> but qla4xxx_ep_connect() returns error pointers.  Propagating the error
> pointers will lead to an Oops in the caller, so change the error
> pointers to NULL.
> 
> 

Applied to 6.17/scsi-fixes, thanks!

[1/1] scsi: qla4xxx: Prevent a potential error pointer dereference
      https://git.kernel.org/mkp/scsi/c/9dcf111dd3e7

-- 
Martin K. Petersen

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

end of thread, other threads:[~2025-08-15  3:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-13  5:49 [PATCH] scsi: qla4xxx: Prevent a potential error pointer dereference Dan Carpenter
2025-08-13 21:03 ` Chris Leech
2025-08-15  3:38 ` Martin K. Petersen

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