Linux-SCSI Archive mirror
 help / color / mirror / Atom feed
From: Khazhismel Kumykov <khazhy@chromium.org>
To: Lee Duncan <lduncan@suse.com>, Chris Leech <cleech@redhat.com>,
	Mike Christie <michael.christie@oracle.com>,
	"James E . J . Bottomley" <jejb@linux.ibm.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Khazhismel Kumykov <khazhy@google.com>
Subject: [PATCH 2/2] iscsi_tcp: disallow binding the same connection twice
Date: Mon, 18 Mar 2024 12:49:02 -0700	[thread overview]
Message-ID: <20240318194902.3290795-2-khazhy@google.com> (raw)
In-Reply-To: <20240318194902.3290795-1-khazhy@google.com>

iscsi_sw_tcp_conn_bind does not check or cleanup previously bound
sockets, nor should we allow binding the same connection twice.

Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
---
 drivers/scsi/iscsi_tcp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index e8ed60b777c6..8cf5dc203a82 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -716,6 +716,9 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session,
 	struct socket *sock;
 	int err;
 
+	if (tcp_sw_conn->sock)
+		return -EINVAL;
+
 	/* lookup for existing socket */
 	sock = sockfd_lookup((int)transport_eph, &err);
 	if (!sock) {
-- 
2.44.0.291.gc1ea87d7ee-goog


  reply	other threads:[~2024-03-18 19:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-18 19:49 [PATCH 1/2] iscsi_tcp: do not bind sockets that already have extra callbacks Khazhismel Kumykov
2024-03-18 19:49 ` Khazhismel Kumykov [this message]
2024-03-19 19:33   ` [PATCH 2/2] iscsi_tcp: disallow binding the same connection twice Mike Christie
2024-05-23 22:25     ` Khazhy Kumykov
2024-03-19 19:28 ` [PATCH 1/2] iscsi_tcp: do not bind sockets that already have extra callbacks Mike Christie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240318194902.3290795-2-khazhy@google.com \
    --to=khazhy@chromium.org \
    --cc=cleech@redhat.com \
    --cc=jejb@linux.ibm.com \
    --cc=khazhy@google.com \
    --cc=lduncan@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michael.christie@oracle.com \
    --cc=open-iscsi@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).