diff mbox series

[01/13] scsi: iscsi: Fix HW conn removal use after free

Message ID 20220517222448.25612-2-michael.christie@oracle.com
State Superseded
Headers show
Series iscsi fixes, perf improvements and cleanups | expand

Commit Message

Mike Christie May 17, 2022, 10:24 p.m. UTC
If qla4xxx doesn't remove the connection before the session the iscsi
class tries to remove the connection for it. We were doing a
iscsi_put_conn in the iter function which is not needed and will result in
a use after free because iscsi_remove_conn will free the connection.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/scsi/scsi_transport_iscsi.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Lee Duncan May 18, 2022, 3:44 p.m. UTC | #1
On 5/17/22 15:24, Mike Christie wrote:
> If qla4xxx doesn't remove the connection before the session the iscsi
> class tries to remove the connection for it. We were doing a
> iscsi_put_conn in the iter function which is not needed and will result in
> a use after free because iscsi_remove_conn will free the connection.
> 
> Signed-off-by: Mike Christie <michael.christie@oracle.com>
> ---
>   drivers/scsi/scsi_transport_iscsi.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
> index 2c0dd64159b0..e6084e158cc0 100644
> --- a/drivers/scsi/scsi_transport_iscsi.c
> +++ b/drivers/scsi/scsi_transport_iscsi.c
> @@ -2138,8 +2138,6 @@ static int iscsi_iter_destroy_conn_fn(struct device *dev, void *data)
>   		return 0;
>   
>   	iscsi_remove_conn(iscsi_dev_to_conn(dev));
> -	iscsi_put_conn(iscsi_dev_to_conn(dev));
> -
>   	return 0;
>   }
>   
Reviewed-by: Lee Duncan <lduncan@suse.com>
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 2c0dd64159b0..e6084e158cc0 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -2138,8 +2138,6 @@  static int iscsi_iter_destroy_conn_fn(struct device *dev, void *data)
 		return 0;
 
 	iscsi_remove_conn(iscsi_dev_to_conn(dev));
-	iscsi_put_conn(iscsi_dev_to_conn(dev));
-
 	return 0;
 }