Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3474422pxf; Mon, 15 Mar 2021 10:18:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAgBj3/xKzQQhDiBb0pGvhbspa0cjYqx/gdgeW6yoZRC8K/CJ5B6gd0C7YEoMQT8yP9UI8 X-Received: by 2002:a05:6402:1c98:: with SMTP id cy24mr31182446edb.296.1615828735856; Mon, 15 Mar 2021 10:18:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615828735; cv=none; d=google.com; s=arc-20160816; b=z/zY9VdOoj8KeIrxS5KIwvgknjoQasFM4Sn7A1KobF4kFr1HyWDKTzB7Os6dw8tiq3 64oohMaIm6Hi07B2MW8aDBNmb6N78mo8qrZnCw1NTKEmeBCoInl2/gixFcAuVouO2/2J 48jSXvwycMond6ZokcImrh1YzcD9XlcjLPpYDc3cC7MJ3wjbpiS7/WATYSQqZ99Cdeqc GxS4MBKEUNRt48OFRUjdkJNXMA3hC4xCGJFbfa3cJEI6/3SHrYszZ6aHE76+MLijwwbC nszrD5D2duWQDTrVqICsQ7y5SA3HHfZog5t1JU40f/vOCDSH7/fdkFdI0IL63xJZOJS3 2Rwg== 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=NW+eXND38mNlb3ZqG2dmVqWyYEV8WBK57NAHmFqZFYY=; b=aLSfW56jbaKAIgV1veKwC+btfIQyPQQgYYbmO4bLdh7tSJVTfEsW0eyPUwoLs8y3h6 jrxBpwp/8OqNpf5ly4vxMNz0mSMCUJocvMI+UjK5WUCXzDse9cYHSeeCplTL2P8IDLK7 NozugmzoJV2BvSsdUxfBIB/Agx24hfPj1PhsZ4qRtkACIytStToS94xeKdiQv2bxdVED OTtG38or8C3pyGOTRW2hOMQ/YtZZGxV84q8rQVv55dKMWvMye4r85SEVNbhdfepVksFw lJeoXUz6RuYgcfY3fmrulEJUzieFz+ZTyzYbYWtWUtaDZOaEunISmly5ML9IQ/4KkpYt EiuA== 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 y18si11832353ejp.482.2021.03.15.10.18.33; Mon, 15 Mar 2021 10:18:55 -0700 (PDT) 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 S235984AbhCORQV (ORCPT + 99 others); Mon, 15 Mar 2021 13:16:21 -0400 Received: from mail-pl1-f180.google.com ([209.85.214.180]:42928 "EHLO mail-pl1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235774AbhCORQQ (ORCPT ); Mon, 15 Mar 2021 13:16:16 -0400 Received: by mail-pl1-f180.google.com with SMTP id e2so10371766pld.9 for ; Mon, 15 Mar 2021 10:16:15 -0700 (PDT) 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=NW+eXND38mNlb3ZqG2dmVqWyYEV8WBK57NAHmFqZFYY=; b=grZZm1XXabzI0FIG8zAtzUpWbaQPDwJtpkxcZPL41OSYgt7NQsD8Xo1JazDIUdgDTK 6e6OvQb9Bt7sv7zV4HHiLZyYrKLF2PX6I3y0dhtsvvk6boEZSHCkUyPa42ZMg05em9Qr kFr74BxTPuTOhyM2ZEc2ff8q2tw9L2FP3bKQcw1F47o8GbJOQEI+qJ7PBDmMwJh/xIkC NX6AKLYeH+wfKEfJp2PVHhC5CwU1+47Y3Phu04cXzdj6G5RZMEY8W74OmItEWo0ZfY4F E8wpazNjMqn+8Mg+00b3710Nqy5zphHmOlIWppwIkmZjb2rwkNmK+9iYvJ6UoL4JFCoI SKNA== X-Gm-Message-State: AOAM532pKNxtmkbQkHCXJH38J9gbAnwxqsR5RP4GayWEEZWAoDrPXAaq wmb3ovwOqdm0Qu0ArX4RTnM= X-Received: by 2002:a17:902:8217:b029:e6:2875:b1d9 with SMTP id x23-20020a1709028217b02900e62875b1d9mr12202035pln.70.1615828575563; Mon, 15 Mar 2021 10:16:15 -0700 (PDT) Received: from ?IPv6:2601:647:4802:9070:4faf:1598:b15b:7e86? ([2601:647:4802:9070:4faf:1598:b15b:7e86]) by smtp.gmail.com with ESMTPSA id bg16sm188680pjb.43.2021.03.15.10.16.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Mar 2021 10:16:14 -0700 (PDT) Subject: Re: [PATCH v2] nvme-tcp: Check if request has started before processing it To: Daniel Wagner Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Jens Axboe , Hannes Reinecke , Keith Busch , Christoph Hellwig References: <20210301175601.116405-1-dwagner@suse.de> <6b51a989-5551-e243-abda-5872411ec3ff@grimberg.me> <20210311094345.ogm2lxqfuszktuhp@beryllium.lan> From: Sagi Grimberg Message-ID: <70af5b02-10c1-ab0b-1dfc-5906216871b4@grimberg.me> Date: Mon, 15 Mar 2021 10:16:13 -0700 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: <20210311094345.ogm2lxqfuszktuhp@beryllium.lan> 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 > Hi Sagi, > > On Fri, Mar 05, 2021 at 11:57:30AM -0800, Sagi Grimberg wrote: >> 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). > > As far I can tell, the main difference between nvme-tcp and FC/NVMe, > nvme-tcp has not a FW or a big driver which filter out some noise from a > misbehaving controller. I haven't really checked the other transports > but I wouldn't surprised they share the same properties as FC/NVMe. > >> 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. > > Okay, I'll review all the relevant code and see what could made more > generic and consistent. > > Though I think nvme-tcp plays in a different league as it is exposed to > normal networking traffic and this is a very hostile environment. It is, but in this situation, the controller is sending a second completion that results in a use-after-free, which makes the transport irrelevant. Unless there is some other flow (which is unclear to me) that causes this which is a bug that needs to be fixed rather than hidden with a safeguard.