Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3536057pxb; Sat, 13 Feb 2021 00:49:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJx+HZhlUL/GGaO/nxDDkOldqz6bkW/Lb84Fo0qvBDn1/ynf5I//ilYMm9zGwvU+OC1Mk/0Z X-Received: by 2002:a05:6402:11c7:: with SMTP id j7mr6987861edw.290.1613206148865; Sat, 13 Feb 2021 00:49:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613206148; cv=none; d=google.com; s=arc-20160816; b=weDx61W4bQgfb+1glh3hVIXwGGw8/Hjb68DOiOsIt/c9XvLWxH8P8IVYjnNMOj2cBP mh80KEBupA0AaC5/OyzBHVAtoAfMurbpaeaMUGaeIiGTfYMg7d/8cbn6gfpG+Pmhu/WL EkFd39pIcAoU8hZyC3atx8ZPgNLb7W09tghUOto2MhJkN1lmGpr4Z49doxJEZc79pE1q rrb87mH1O0aL0ao7y36KgpczfcU4JQhngYPcM9+9D2sPmx/myXtvMyEWx8zsMTMT27ia i5RfXQEEbc/54eHXuGGI+IjznrgXsjJZ5dkqE42dcvs6bIBfhRBXeOe+sPa+ul5IOhz+ yM4w== 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=cJ1guj2hFnIFzDLcGQrT4Fl7l0fTwh80MPfHEKwGSAQ=; b=ZW5ucJUqiSWcLXHz9lB473RPU2oHemPFVLejMov0qaXZuXKmnj4tE+TSdjzigaLXeD EmLmB7/1XIGjnDDKviyfRxT+u+YOMN4BDS7wKhIwah/gy7lRYlzKO76fvwDxnlk2lF8P dPNVAGqWgj6DwMlH5FM11kL5nkVJJinU85lDBB74k4kZRq8HpOm4PFiiE5cB51y60ZBC 9MN7x2W+/Br8mIC1LL8AUlXjNLNUqSCuKAzXC2oYxFTzvPFJdt1Bt+JponGlzOSVdwXY /W+tZtmtGmJqfzjX+hPck23zmOuIs/T6DQxQpK2FNnxtnz2mvFX19AtOs3f04eL3Fn8f fOtQ== 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 cf7si3300584ejb.470.2021.02.13.00.48.45; Sat, 13 Feb 2021 00:49:08 -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 S229531AbhBMIrY (ORCPT + 99 others); Sat, 13 Feb 2021 03:47:24 -0500 Received: from mx2.suse.de ([195.135.220.15]:33106 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbhBMIrX (ORCPT ); Sat, 13 Feb 2021 03:47:23 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8ECD7AC32; Sat, 13 Feb 2021 08:46:42 +0000 (UTC) Subject: Re: [PATCH] nvme-tcp: Check if request has started before processing it To: Sagi Grimberg , Keith Busch Cc: Daniel Wagner , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Christoph Hellwig , Jens Axboe References: <20210212181738.79274-1-dwagner@suse.de> <20210212210929.GA3851@redsun51.ssa.fujisawa.hgst.com> From: Hannes Reinecke Message-ID: <73e4914e-f867-c899-954d-4b61ae2b4c33@suse.de> Date: Sat, 13 Feb 2021 09:46:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/12/21 10:49 PM, Sagi Grimberg wrote: > >>>> blk_mq_tag_to_rq() will always return a request if the command_id is >>>> in the valid range. Check if the request has been started. If we >>>> blindly process the request we might double complete a request which >>>> can be fatal. >>> >>> How did you get to this one? did the controller send a completion for >>> a completed/bogus request? >> >> If that is the case, then that must mean it's possible the driver could >> have started the command id just before the bogus completion check. Data >> iorruption, right? > > Yes, which is why I don't think this check is very useful.. I actually view that as a valid protection against spoofed frames. Without it it's easy to crash the machine by injecting fake completions with random command ids. Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer