diff mbox series

[-next] scsi: target: iscsi: Fix NULL pointer dereference in iscsi_conn_auth_required()

Message ID 20220613014321.107045-1-yang.lee@linux.alibaba.com (mailing list archive)
State Accepted
Commit 35bf020bd8ab41849871645d8fa83c86cddfe7eb
Headers show
Series [-next] scsi: target: iscsi: Fix NULL pointer dereference in iscsi_conn_auth_required() | expand

Commit Message

Yang Li June 13, 2022, 1:43 a.m. UTC
Fix following coccicheck error:
./drivers/target/iscsi/iscsi_target_nego.c:831:13-26: ERROR: se_nacl is
NULL but dereferenced.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 drivers/target/iscsi/iscsi_target_nego.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Mike Christie June 13, 2022, 3:11 p.m. UTC | #1
On 6/12/22 8:43 PM, Yang Li wrote:
> Fix following coccicheck error:
> ./drivers/target/iscsi/iscsi_target_nego.c:831:13-26: ERROR: se_nacl is
> NULL but dereferenced.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>

This was just added in Martin's 5.20 tree in:

a75fcb0912a549c6c1da8395f33271ce06e84acd

scsi: target: iscsi: Extract auth functions

Do we need a Fixes or should the original patch be fixed?

Patch looks ok to me, so if we just add it:

Reviewed-by: Mike Christie <michael.christie@oracle.com>

> ---
>  drivers/target/iscsi/iscsi_target_nego.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
> index 9ce35a59962b..fb93a1173954 100644
> --- a/drivers/target/iscsi/iscsi_target_nego.c
> +++ b/drivers/target/iscsi/iscsi_target_nego.c
> @@ -827,8 +827,7 @@ static bool iscsi_conn_auth_required(struct iscsit_conn *conn)
>  	 */
>  	se_nacl = conn->sess->se_sess->se_node_acl;
>  	if (!se_nacl) {
> -		pr_debug("Unknown ACL %s is trying to connect\n",
> -			 se_nacl->initiatorname);
> +		pr_debug("Unknown ACL is trying to connect\n");
>  		return true;
>  	}
>
Martin K. Petersen June 14, 2022, 2:07 a.m. UTC | #2
Yang,

> Fix following coccicheck error:
> ./drivers/target/iscsi/iscsi_target_nego.c:831:13-26: ERROR: se_nacl is
> NULL but dereferenced.

Applied to 5.20/scsi-staging, thanks!
Martin K. Petersen June 17, 2022, 2:21 a.m. UTC | #3
On Mon, 13 Jun 2022 09:43:21 +0800, Yang Li wrote:

> Fix following coccicheck error:
> ./drivers/target/iscsi/iscsi_target_nego.c:831:13-26: ERROR: se_nacl is
> NULL but dereferenced.
> 
> 

Applied to 5.20/scsi-queue, thanks!

[1/1] scsi: target: iscsi: Fix NULL pointer dereference in iscsi_conn_auth_required()
      https://git.kernel.org/mkp/scsi/c/35bf020bd8ab
diff mbox series

Patch

diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
index 9ce35a59962b..fb93a1173954 100644
--- a/drivers/target/iscsi/iscsi_target_nego.c
+++ b/drivers/target/iscsi/iscsi_target_nego.c
@@ -827,8 +827,7 @@  static bool iscsi_conn_auth_required(struct iscsit_conn *conn)
 	 */
 	se_nacl = conn->sess->se_sess->se_node_acl;
 	if (!se_nacl) {
-		pr_debug("Unknown ACL %s is trying to connect\n",
-			 se_nacl->initiatorname);
+		pr_debug("Unknown ACL is trying to connect\n");
 		return true;
 	}