Skip to content

Commit f4f82c5

Browse files
edumazetdavem330
authored andcommitted
scsi: iscsi_tcp: restrict to TCP sockets
Nothing prevents iscsi_sw_tcp_conn_bind() to receive file descriptor pointing to non TCP socket (af_unix for example). Return -EINVAL if this is attempted, instead of crashing the kernel. Fixes: 7ba2471 ("[SCSI] open-iscsi/linux-iscsi-5 Initiator: Initiator code") Signed-off-by: Eric Dumazet <[email protected]> Cc: Lee Duncan <[email protected]> Cc: Chris Leech <[email protected]> Cc: Mike Christie <[email protected]> Cc: "James E.J. Bottomley" <[email protected]> Cc: "Martin K. Petersen" <[email protected]> Cc: [email protected] Cc: [email protected] Reviewed-by: Mike Christie <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0113d9c commit f4f82c5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/scsi/iscsi_tcp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,10 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session,
724724
return -EEXIST;
725725
}
726726

727+
err = -EINVAL;
728+
if (!sk_is_tcp(sock->sk))
729+
goto free_socket;
730+
727731
err = iscsi_conn_bind(cls_session, cls_conn, is_leading);
728732
if (err)
729733
goto free_socket;

0 commit comments

Comments
 (0)