Greg Kroah-Hartman
unread,Oct 4, 2023, 2:12:48 PM10/4/23Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sta...@vger.kernel.org, Greg Kroah-Hartman, pat...@lists.linux.dev, Eric Dumazet, Lee Duncan, Chris Leech, Mike Christie, James E.J. Bottomley, Martin K. Petersen, open-...@googlegroups.com, linux...@vger.kernel.org, David S. Miller, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <
edum...@google.com>
[ Upstream commit f4f82c52a0ead5ab363d207d06f81b967d09ffb8 ]
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: 7ba247138907 ("[SCSI] open-iscsi/linux-iscsi-5 Initiator: Initiator code")
Signed-off-by: Eric Dumazet <
edum...@google.com>
Cc: Lee Duncan <
ldu...@suse.com>
Cc: Chris Leech <
cle...@redhat.com>
Cc: Mike Christie <
michael....@oracle.com>
Cc: "James E.J. Bottomley" <
je...@linux.ibm.com>
Cc: "Martin K. Petersen" <
martin....@oracle.com>
Cc:
open-...@googlegroups.com
Cc:
linux...@vger.kernel.org
Reviewed-by: Mike Christie <
michael....@oracle.com>
Signed-off-by: David S. Miller <
da...@davemloft.net>
Signed-off-by: Sasha Levin <
sas...@kernel.org>
---
drivers/scsi/iscsi_tcp.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 8009eab3b7bee..56ade46309707 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -724,6 +724,10 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session,
return -EEXIST;
}
+ err = -EINVAL;
+ if (!sk_is_tcp(sock->sk))
+ goto free_socket;
+
err = iscsi_conn_bind(cls_session, cls_conn, is_leading);
if (err)
goto free_socket;
--
2.40.1