Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2296427pxb; Fri, 5 Mar 2021 12:01:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxCuJeUnSvEcJCnqRymaUo/2TFgCTaKU+i4VQcHl+NJ2VTHHKsQI0EY3LPRwAtQ8NO/KEfa X-Received: by 2002:a17:906:2710:: with SMTP id z16mr3181828ejc.176.1614974476353; Fri, 05 Mar 2021 12:01:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614974476; cv=none; d=google.com; s=arc-20160816; b=ekK6E1Ux2YCDcxUc96GLvlPb+vcRd3q6d9U7qeUdmRnD2W3XwvMnoGZccFzon3/tXy qkNrXvpTx1RovXbx2vp5ofb88fb+Ae99VnHfDRZpMB8sP3T7Z855n1N2v1S6yM0rFmV7 wzhxHlShNudl6KMgFhJe6oYsniaTzDEnu4HFSVmg3xptsQaOJYJQQYCddMaNHasal1UL n0yMs03B27mlpVicZ4gh4QdgId2OeRbdtliHJN11mHWmMZ9TWymNJGRbWveB0Qr1kTiA kSv+w/geHn6QzwbimpjHYD4rBbWqLVSyJ0+asXsFVTm2yjgeW/oHRQaaaF66eSpfVwMR UzBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=BvXqs9Un/8ft9bW8S9EkC2iye0k2IA9jrybCCvql2JM=; b=OL0c5M8TzrkJugO4EPafFeqUnVfLv7jC+65Qkti57091sjGkqebMd18Jtnrq+pJZDv E2H4+JkiHVvRRQ2eHAMdfKAffSyVd/PhGj50OAuVrP5ay52NfsGdmtsLvEUWDEr0CzCo +z0tGXWaxceNl1uTsMtFLd37fovnEYonJaRBjyGMfJnRA8nIKMbrLu5IVip+F8BE2HaE iBOwXeZyZ7pqSZYpCFg6hpXuOzVMIjsQBNQUENmHlmy/IHtGKAqui4xx0CBN1u3UYSS4 pmDHvqoa/1xChfkEPNpHRtErWiUKrbc3g/0+aPX+CIjUtoAaA3tKeT+GRrQBSRZTBbNk ZSxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k5si1885363ejc.134.2021.03.05.12.00.52; Fri, 05 Mar 2021 12:01:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229493AbhCET5n (ORCPT + 99 others); Fri, 5 Mar 2021 14:57:43 -0500 Received: from mail-oi1-f170.google.com ([209.85.167.170]:34856 "EHLO mail-oi1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbhCET5d (ORCPT ); Fri, 5 Mar 2021 14:57:33 -0500 Received: by mail-oi1-f170.google.com with SMTP id i21so3819115oii.2 for ; Fri, 05 Mar 2021 11:57:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=BvXqs9Un/8ft9bW8S9EkC2iye0k2IA9jrybCCvql2JM=; b=k9zbcL19AHObDLIbfBmeAPw+m3GwZiziFtJanF5TmspcUuz8py3t/P4eJRmAiDI64N b0BDNWGEq78iwsmCQrjFvMEsxgfIeN0EUPgJfiE8/Cn1Vei7+UzA0hoW4y0/hNb8opCV aGhBD+CWAyDJmOwW5QQbQ9naUADLgNwyym2bsis2t01tJVV7NtUuIc5YhOJOtcEveyI5 FHFOgksl4WddMbre7XCEyHRnPR5hM3UM2IVGuwRpJk0uwX26trgydjwHvmpaZlT5RTcC JOofrDxoK3UMLEl2nZDv7+8bgP/cmXtYyq1jh+5WaQs719brfUvN/Lkr7x+P01gnzBJ5 Seig== X-Gm-Message-State: AOAM53280Hg8Gzvs0ZkZfoYIPzKxcQ25cLEpXEp3K0WKRlalPCHECWGs TWy2p5FO2Cdf883FYH929cw= X-Received: by 2002:aca:d708:: with SMTP id o8mr8354457oig.12.1614974252695; Fri, 05 Mar 2021 11:57:32 -0800 (PST) Received: from ?IPv6:2600:1700:65a0:78e0:e55e:67c6:e7ec:9? ([2600:1700:65a0:78e0:e55e:67c6:e7ec:9]) by smtp.gmail.com with ESMTPSA id w15sm783647otp.29.2021.03.05.11.57.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Mar 2021 11:57:32 -0800 (PST) Subject: Re: [PATCH v2] nvme-tcp: Check if request has started before processing it To: Daniel Wagner , linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Jens Axboe , Hannes Reinecke , Keith Busch , Christoph Hellwig References: <20210301175601.116405-1-dwagner@suse.de> From: Sagi Grimberg Message-ID: <6b51a989-5551-e243-abda-5872411ec3ff@grimberg.me> Date: Fri, 5 Mar 2021 11:57:30 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210301175601.116405-1-dwagner@suse.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > blk_mq_tag_to_rq() always returns a request if the tag id is in a > valid range [0...max_tags). If the target replies with a tag for which > we don't have a request but it's not started, the host will likely > corrupt data or simply crash. > > Add an additional check if the a request has been started if not > reset the connection. > > This addition check will not protected against an invalid tag which > maps to a request which has been started. There is nothing we can do > about this. Though it will at a least protect from crashing the host, > which generally thought to be the right thing to do. Daniel, again, there is nothing specific about this to nvme-tcp, this is a safeguard against a funky controller (or a different bug that is hidden by this). The same can happen in any other transport so I would suggest that if this is a safeguard we want to put in place, we should make it a generic one. i.e. nvme_tag_to_rq() that _all_ transports call consistently.