Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp458464lqt; Mon, 18 Mar 2024 12:50:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX3ioX/phrrKy/TfV02HTtlyBydgkyeBFQHUXijxPG86TnZnJezCOtG3Gz/2iIRNlmNTiB6PN7uo9ohvav9ctJwnBakdJG2PegeoakNzQ== X-Google-Smtp-Source: AGHT+IF5jRN1DKAD629OcWNVC8yOkAz9XNdHz/YN0PyDrr+opvzITajfd/Irtr3dVbqQiUaMV8VI X-Received: by 2002:a05:622a:64c:b0:430:9ff8:50aa with SMTP id a12-20020a05622a064c00b004309ff850aamr12932126qtb.10.1710791429589; Mon, 18 Mar 2024 12:50:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710791429; cv=pass; d=google.com; s=arc-20160816; b=TZVOqqcYlN1mhQRo10QVOT4v76ZHslyJNjHEeVxCp5Be/84RNMuqX/Bx9R9v5ncDs6 926TqVHeFH/U3m8n7q+NjLPNH2d9hjypZyZcWD9vifiAzgOzlxjFPsMo5Ce2fdK8pUDL FcK6EA8/dRXrf07A0czLQKuhhxgehiNn+UcJikB0Ld+h3GSEa5us6QxsUs6+Cp1ueKTG QIMoYbnATEGngg6JAXtaZ2NfcAaON4Xk1xCfeUmUuBVrNKTVKdbidnSLKPkgBaCniXpl 9AjIqQiTCUvM9FDwJ3yneT0A4ozCiT+uHwiQzzUnIfirvUWoJS4T6dGnUDZ5hwcTxzvA y4DA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=zC1qwydc9xH+y2vdl2+XzzOC/d+jLN+PsRUWImtjlRY=; fh=cPf0HlGvuUKpKg2cnIuhBfAm3NjNSuGCcgUiE+Gk0t8=; b=e3uRHB5SMpWdl5B84CKUUhCKPHCGEwr+Zrw7fal3j7O1UfQ72kZ7iyFPu7+SulJNbb fl1JqwmZ7+jIpQohzuDt+sPsTzkf6gAqPlE7jB+VWNgQNBZYRPVJow3EV7mWkeUyYKXU Xc1orYAv5gXpMkqL9etOLe0p7Q1qi7q6gVasQy3BonxHsMQG0bLPDuCddxV2l8QtxSaW Ehwtvx15Q+g7ZxVI6JYl/5RsooDHeH33VyJPNu7uR85gUxITkysIDGuLZIO0xe9Jg4Nr 34pcEo670ULur19vYP9QD34AETWgxtNNc6FgJPOcd/eAvgy7Ha6RxCHLYnWRzo6rYyKP cQ/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kCCzlCrM; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-106579-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106579-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bb20-20020a05622a1b1400b00430e2cfcd5bsi712492qtb.497.2024.03.18.12.50.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 12:50:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106579-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kCCzlCrM; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-106579-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106579-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 51C4F1C21BF2 for ; Mon, 18 Mar 2024 19:50:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 74C6D58101; Mon, 18 Mar 2024 19:50:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="kCCzlCrM" Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E97C57866 for ; Mon, 18 Mar 2024 19:50:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710791420; cv=none; b=udQ+TlkvX3rnNl+9r1Ez20iPWR/nD0swYwHsPzwwZ5Ex7n8yZq3vLZTmujBQv2/FueKeJz69b7sCfsL6O/PVGs2q71t1eNTIaLPHEBTrMZvTRY16/E0FQbhU0TsaV8ZFYuYLyWExIT8JXLO7hTdOR3h4/0G+aAIe0bMVPmx8Qsw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710791420; c=relaxed/simple; bh=KZ3rIV5HMKqyM/bNYA6ICEqFK4FA1/+/ftfgAoqZXqc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AUfinkxQf5EjAI+Ec6f9cFurgNOJOLMb+XcDVDoHRye2UI8vKfasRalgkW6SDfjWyC30oXgbu7/No4PmG7XAiIQan0NRKHj5Jt+pirBwzVJLQ+BL2TpFjK9vLURL71/5GHWnSLD4VM6Ss5W+ZEUzSvs6JidsGR7TaLO4XzBUUPI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=kCCzlCrM; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1e0000cdf99so16719605ad.0 for ; Mon, 18 Mar 2024 12:50:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1710791418; x=1711396218; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zC1qwydc9xH+y2vdl2+XzzOC/d+jLN+PsRUWImtjlRY=; b=kCCzlCrMkngQZmLTnbmxT1k3erbm3ZoRwY7dgZGHhF/thIF12hyhj0jZgGLf5Pi174 p2yUFodtX9LTr1u4cDNolJk2H/PkLXBh7/ULIRWBgJu/5EYn8NemJT00NJR8kT7Idd+C LU4jLJcVeIo125iPz1Kj7BrD/9hzuejZslDlE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710791418; x=1711396218; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zC1qwydc9xH+y2vdl2+XzzOC/d+jLN+PsRUWImtjlRY=; b=f+Y81TB2IW5/VzMXZEfmoJncIvkwU6F3zVGKuS4QBWRxxdt6r+FLzx6Tt63R4hmMG3 Gn+ScXjgFkx3BSfIxe0mIED9ZiQ08IYxLdMNhnWhhtOI1hLylX1vD7ztdWEpXpReAHKf DO+qABeODjMswLlRXgW3+ja0/ZsJj5hiUbPPLrFRojTVSGpeyJTAAFT3b1i/nDwNVp6v uoHNSA68KlVR2Kh4boIDdIwOj9Pvlbw5AldqomzH4x8xrGc5Go+czALBLrpmykQ0ZgIR br6vwwnsrw1El9DA0DSSexk0Fo43DgNeRAy56kNgVRUmlfNU8mivbREozYMHlI5U/8Rg mr7Q== X-Forwarded-Encrypted: i=1; AJvYcCV+dIJEWbkU3+G65zWl5t0f+a6pvGE97o+7phwnzpRRSTGTGbpcNhPLs9zNaoa/QEz9VaehhiD7Eer9Pfd3/3vGOMZXTaVWkGNnCRa9 X-Gm-Message-State: AOJu0YxehoWyLRwvtX27FAsEu7zJT0cpHQqBj9pCBe/CjI9uHU7/CFfS 6mh3x/bdtpWYIOXVQCYTks6STr7tH5VoooBcyR0mfxkQ1jSigCIpwPf6+RD58g== X-Received: by 2002:a17:902:e5c2:b0:1de:e026:1b8e with SMTP id u2-20020a170902e5c200b001dee0261b8emr16615202plf.41.1710791418685; Mon, 18 Mar 2024 12:50:18 -0700 (PDT) Received: from khazhy-linux.svl.corp.google.com ([2620:15c:2a3:200:5620:6f64:dfac:61dc]) by smtp.gmail.com with ESMTPSA id k4-20020a170902c40400b001defa98b03fsm6476916plk.101.2024.03.18.12.50.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 12:50:18 -0700 (PDT) From: Khazhismel Kumykov X-Google-Original-From: Khazhismel Kumykov To: Lee Duncan , Chris Leech , Mike Christie , "James E . J . Bottomley" , "Martin K . Petersen" Cc: open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Khazhismel Kumykov Subject: [PATCH 2/2] iscsi_tcp: disallow binding the same connection twice Date: Mon, 18 Mar 2024 12:49:02 -0700 Message-ID: <20240318194902.3290795-2-khazhy@google.com> X-Mailer: git-send-email 2.44.0.291.gc1ea87d7ee-goog In-Reply-To: <20240318194902.3290795-1-khazhy@google.com> References: <20240318194902.3290795-1-khazhy@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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