From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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 6B0A21C5F34 for ; Thu, 23 Jan 2025 22:04:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737669853; cv=none; b=Cx/1DD83unlDdFN7UJQecplAp+hosxFHgNswGxJn8ni9BxuiBlI8IILUr1et3JLGlloy96StujQEd4uQvnnoLKk+kaHVFLz5ACXaYfEW0HdbrYE7x7Z9EgMWXk4nvb8AmXLHoouqr51bijMvwlsEw/51RPOZ5MkiqLu68H1EXQ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737669853; c=relaxed/simple; bh=Daovpr/JM5wVesqoj8hdcUQtgIMSiTij0WAnKbp3MEs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=RgezpqU4C1alj2Gr2ET85n5nYL514vUdIxC5QufJcqZq/NMEnaUIAeNJ5oGO6oxAdXXNcYB+v8rHHE0JiRHwVXKTnLgsdw2SyxHMckmVzHvZogCygReJ3Qk+DK8Ei4l3Z6WNzEDyefUJUH2nvm9ptHAMLQqpk5cUttVyVigqR0g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=grimberg.me; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=grimberg.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-43622267b2eso14924725e9.0 for ; Thu, 23 Jan 2025 14:04:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737669849; x=1738274649; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Q5xAV9fitT92C+lFysFScC50QvwNXIQ5wMPuKIOKP8E=; b=j+EtZdNAO1MO2ua11alaMuDdJJpEAuc2b7pQ7J48uMKQCNQiY/lAsRUsWyDLcfJj3/ +xzReNa0vL5Vxn5zxXuWa06udQTf1NPRjCSBgg2C0lCWM7Ke0gJIN1nwDwsToNhpNuqT IiWnwf8rvoiX5dXUvtzhajE5+arAbYa2IxoM3HJCNigrnx2IwZ/i/LnWZQsF4Az1GsYg biDBQy7N4oHgCr89TMQ5iHntlQxrQ8ijJVNsCVIzLV0DoQll949CslBvYwhapynWmgq7 oiHgLtnl2eDp40YZ9HvozvYQoFAFoj/S8FZRY+nqWgdji9cZpIAL9ikzYSAbKkOCSufZ REzA== X-Forwarded-Encrypted: i=1; AJvYcCX+AvkokGJO3CIZr8PcOYaO26YrYl1QIsf3IIL3/8a4j+K8hQwBkfM0I1F5XgC1iRBg2sMpJ3Y9Uf3bJmU=@vger.kernel.org X-Gm-Message-State: AOJu0YwZ8ZapE5hKjPGeMxtTH6OsEFjL/28Gvzvr4tcKvTVGOia6v7MR 2qAyzGwPxU6L8ufdejI+ljTjFhSAdWJPN6C+cSVDRuRMaPzlsbbE X-Gm-Gg: ASbGncts9qFGFiJHnq14ppLoZgEG3dwfqKI25I782QRkBeB33hIagKkP119PM+w3RXJ fE+rFUeVsgPJamYS+bsO0rI1vR3J46qvIm70l+oM50zvamC68XUEApGSv4INgAFCQhbonQKqkfu YZKctmDgHpiRy0CwI5MZfqYEh7gjkScYcxlCcVYW8LpvosOqYxdnBrCbebypUshkj15CwadxDdE rIlkEeHVGTdNO8bQEAI7zXe3xIbomOBLfuKfiPpfAVu3LnoWvX4RZU596VoKId0yuHne/y8kcEP QQrMyV/kjXh2djxUwOvnzWimPnA8iIFtYVMcXOur X-Google-Smtp-Source: AGHT+IF2k6JSdC0vJlDs9HGm7BeOsvNGFct+BwnXU9w4q0VGHDPVkD21Bg5hPa+Ns8oTg+GIg0oGsw== X-Received: by 2002:a05:600c:4511:b0:435:9ed3:5698 with SMTP id 5b1f17b1804b1-4389143753bmr239891855e9.24.1737669848307; Thu, 23 Jan 2025 14:04:08 -0800 (PST) Received: from [10.100.102.74] (89-138-75-149.bb.netvision.net.il. [89.138.75.149]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd4b9977sm4984415e9.25.2025.01.23.14.04.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Jan 2025 14:04:07 -0800 (PST) Message-ID: <7fe8282a-8fc4-47e7-b7bf-b1686d78e9ef@grimberg.me> Date: Fri, 24 Jan 2025 00:04:06 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] nvme-tcp: check that full ICResp is received To: Caleb Sander Mateos , Keith Busch , Jens Axboe , Christoph Hellwig Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org References: <20250123174905.1252949-1-csander@purestorage.com> Content-Language: en-US From: Sagi Grimberg In-Reply-To: <20250123174905.1252949-1-csander@purestorage.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 23/01/2025 19:48, Caleb Sander Mateos wrote: > nvme_tcp_init_connection() attempts to receive an ICResp PDU but only > checks that the return value from recvmsg() is non-negative. If the > sender closes the TCP connection or sends fewer than 128 bytes, this > check will pass even though the full PDU wasn't received. > > Ensure the full ICResp PDU is received by checking that recvmsg() > returns the expected 128 bytes. > > Additionally set the MSG_WAITALL flag for recvmsg(), as a sender could > split the ICResp over multiple TCP frames. Without MSG_WAITALL, > recvmsg() could return prematurely with only part of the PDU. Thanks Caleb, this looks good. I think we want to adjust the title to express that this is a bug fix, as well as adding a fixes tag - so it can be picked up by stable kernels as back as possible. The title can perhaps be: nvme-tcp: Fix possible connection establishment failure when receiving partial ICResp PDUs