diff mbox series

target:iscsi:free conn_ops when zalloc_cpumask_var failed

Message ID 1553091284-4412-1-git-send-email-hndksztwj@163.com (mailing list archive)
State Accepted
Commit f55d0b40eccfcfb50f93cc7d03c95e25ab19917e
Headers show
Series target:iscsi:free conn_ops when zalloc_cpumask_var failed | expand

Commit Message

tangwenji March 20, 2019, 2:14 p.m. UTC
From: tangwenji <tang.wenji@zte.com.cn>

It should not free cpumask but free conn->conn_ops When zalloc_cpumask_var failed.

Signed-off-by: tangwenji <tang.wenji@zte.com.cn>
---
 drivers/target/iscsi/iscsi_target_login.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Mike Christie March 20, 2019, 4:35 p.m. UTC | #1
On 03/20/2019 09:14 AM, tangwenji wrote:
> From: tangwenji <tang.wenji@zte.com.cn>
> 
> It should not free cpumask but free conn->conn_ops When zalloc_cpumask_var failed.
> 
> Signed-off-by: tangwenji <tang.wenji@zte.com.cn>
> ---
>  drivers/target/iscsi/iscsi_target_login.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
> index ae3209e..c3e1d40 100644
> --- a/drivers/target/iscsi/iscsi_target_login.c
> +++ b/drivers/target/iscsi/iscsi_target_login.c
> @@ -1159,13 +1159,13 @@ static struct iscsi_conn *iscsit_alloc_conn(struct iscsi_np *np)
>  
>  	if (!zalloc_cpumask_var(&conn->conn_cpumask, GFP_KERNEL)) {
>  		pr_err("Unable to allocate conn->conn_cpumask\n");
> -		goto free_mask;
> +		goto free_conn_ops;
>  	}
>  
>  	return conn;
>  
> -free_mask:
> -	free_cpumask_var(conn->conn_cpumask);
> +free_conn_ops:
> +	kfree(conn->conn_ops);
>  put_transport:
>  	iscsit_put_transport(conn->conn_transport);
>  free_conn:
> 

Reviewed-by: Mike Christie <mchristi@redhat.com>
Martin K. Petersen March 21, 2019, 12:38 a.m. UTC | #2
tangwenji,

> It should not free cpumask but free conn->conn_ops When
> zalloc_cpumask_var failed.

Applied to 5.2/scsi-queue, thanks!
diff mbox series

Patch

diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
index ae3209e..c3e1d40 100644
--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -1159,13 +1159,13 @@  static struct iscsi_conn *iscsit_alloc_conn(struct iscsi_np *np)
 
 	if (!zalloc_cpumask_var(&conn->conn_cpumask, GFP_KERNEL)) {
 		pr_err("Unable to allocate conn->conn_cpumask\n");
-		goto free_mask;
+		goto free_conn_ops;
 	}
 
 	return conn;
 
-free_mask:
-	free_cpumask_var(conn->conn_cpumask);
+free_conn_ops:
+	kfree(conn->conn_ops);
 put_transport:
 	iscsit_put_transport(conn->conn_transport);
 free_conn: