public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: iscsi_tcp: restrict to TCP sockets
@ 2023-09-15 17:11 Eric Dumazet
  2023-09-15 20:55 ` Mike Christie
  2023-09-17 16:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2023-09-15 17:11 UTC (permalink / raw)
  To: Lee Duncan, Mike Christie, Chris Leech
  Cc: linux-kernel, netdev, Eric Dumazet, Eric Dumazet,
	James E.J. Bottomley, Martin K. Petersen, open-iscsi, linux-scsi

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 <edumazet@google.com>
Cc: Lee Duncan <lduncan@suse.com>
Cc: Chris Leech <cleech@redhat.com>
Cc: Mike Christie <michael.christie@oracle.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: open-iscsi@googlegroups.com
Cc: linux-scsi@vger.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 9ab8555180a3a0bd159b621a57c99bcb8f0413ae..8e14cea15f980829e99afa2c43bf6872fcfd965c 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.42.0.459.ge4e396fd5e-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: iscsi_tcp: restrict to TCP sockets
  2023-09-15 17:11 [PATCH] scsi: iscsi_tcp: restrict to TCP sockets Eric Dumazet
@ 2023-09-15 20:55 ` Mike Christie
  2023-09-17 16:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Christie @ 2023-09-15 20:55 UTC (permalink / raw)
  To: Eric Dumazet, Lee Duncan, Chris Leech
  Cc: linux-kernel, netdev, Eric Dumazet, James E.J. Bottomley,
	Martin K. Petersen, open-iscsi, linux-scsi

On 9/15/23 12:11 PM, Eric Dumazet wrote:
> 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.
> 

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: iscsi_tcp: restrict to TCP sockets
  2023-09-15 17:11 [PATCH] scsi: iscsi_tcp: restrict to TCP sockets Eric Dumazet
  2023-09-15 20:55 ` Mike Christie
@ 2023-09-17 16:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-09-17 16:50 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: lduncan, michael.christie, cleech, linux-kernel, netdev,
	eric.dumazet, jejb, martin.petersen, open-iscsi, linux-scsi

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Fri, 15 Sep 2023 17:11:11 +0000 you wrote:
> 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 <edumazet@google.com>
> Cc: Lee Duncan <lduncan@suse.com>
> Cc: Chris Leech <cleech@redhat.com>
> Cc: Mike Christie <michael.christie@oracle.com>
> Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
> Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
> Cc: open-iscsi@googlegroups.com
> Cc: linux-scsi@vger.kernel.org
> 
> [...]

Here is the summary with links:
  - scsi: iscsi_tcp: restrict to TCP sockets
    https://git.kernel.org/netdev/net/c/f4f82c52a0ea

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-17 16:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-15 17:11 [PATCH] scsi: iscsi_tcp: restrict to TCP sockets Eric Dumazet
2023-09-15 20:55 ` Mike Christie
2023-09-17 16:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox