Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp450520lqt; Thu, 6 Jun 2024 08:16:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVB/n2QnyAU1i8M31kHrE8L/xM4GAdPPP4/+gs+j0Ge6H58Yz0TCk9IfE0URcNg4E31BAJ6qRWwXbaKCjA31OULOw2iMEMSEtjhkLzILw== X-Google-Smtp-Source: AGHT+IEWDUpraTJ0FjHrrzFgpINY5JEkTaCdx6GKQJIDF7/6m/06QZDirJNZq0c3/6UyOrZ88WwL X-Received: by 2002:a17:906:c9cf:b0:a6c:8c6a:83c4 with SMTP id a640c23a62f3a-a6cb2df95a1mr2753166b.0.1717686961929; Thu, 06 Jun 2024 08:16:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717686961; cv=pass; d=google.com; s=arc-20160816; b=JF2HRkbGH0jVkN97YeLDwiDKDlov3T8qt7TIpBmZUbrLXvWMb/Mk3Ikb/QrDi53DWQ r+bSyGOMvriyKaI6OO9hiI/UJlH6cs2lkz9doyrNybL29+4SsZhgNHj0FPBXtYq8DoQ3 +IV4z0xZsGF4RH3qbQIDLqFxwyS6l5/5uzMy4PAuLz8ksH9Hp2xjelOe7D4E2OT8+zaY u7NPflJRsxcagoZRohkmE+vCcDOgVMe6uKAF+tNGP4Lt2vsVIFkg9bgoe9pTLosIxLTa 2RPGjzOicM9fmBlsCdQJy6GCVPdHePSjgYDN/3cv8SOU32c9dEK4anuhyBW9bSIqEf90 krTg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=O8GpG0KuWFomSMbvkTL0cP/NCyoCqvdU8XJn/qjoHJw=; fh=2jIpu1brcghMJ9ZAlyFYiLetA5QYDgVW17rG+Xrbsp4=; b=bDuCoxBZaUJzG/bwYU1fJkrV72rmLnmBFSrRvCHS0ueeAnFEKyKjWRDV4CfBYSJcAJ yRsQRmlj0+hyXRI5d1P1T/iWyICMpSmufzrckxu55tdP7nPnsUwYZaknrjIdMkH875I3 K6lejtqwRDI/heFUTPjPTS+xjaWS2NHSaT+2s0cL+Q2sRGY+8yiEqOeZv3r0dCt41zNJ xhbAS78wGgbQTv37pWVsZul54WSTZ5lOJfhE7/TwaYLsfFiIGkBggAuD4x9FOaFSmlr6 JUQ3k8qG074+8YZSxssANYcNHNoInTVmlFcK8o6CgGWerLCk/PC3FwUrQ+lovub++8kF keSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=mwDNnRDV; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-204538-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204538-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c805d3d2fsi82380366b.229.2024.06.06.08.16.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 08:16:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204538-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=mwDNnRDV; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-204538-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204538-linux.lists.archive=gmail.com@vger.kernel.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 9ED471F25AE0 for ; Thu, 6 Jun 2024 15:16:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E688019A29F; Thu, 6 Jun 2024 14:52:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="mwDNnRDV" Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D21F198A2E; Thu, 6 Jun 2024 14:52:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717685575; cv=none; b=WvEI5kra6IofdfrrTFn89gormYXxzW1cJTCYXG4KapqCakbumsbGMSUbkPWwvMsyWSXq6MwttCeYyxAMjuEuNNniipgE78pZb0pBG74qgWvKhPYwZuWTg7VrX3IoNfaaTa3NMQclRe0PBQX2CdWo/gXZV+cl2CH3SoAbF8vTu+M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717685575; c=relaxed/simple; bh=KLXH+KI7yI3uxBMA/JQDRrP+7Rcs98KHMwoZl9klMcw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jdRKpsjd6E6IiwDhG+Wq2u2MKq7lKgLC3vsLs4MjIeyvaRW8p3Pe437jMjrT6GYi7uTbttv5zrAwz9B6MbJcpoqZqK3OHFvkyX1dktgtUG1qcowCJixCi9FLhMlqvku7W5ygo8XHMZTU+HO83Yk+c22mM1H/tbzQedqQXyG5LNs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=mwDNnRDV; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=O8GpG0KuWFomSMbvkTL0cP/NCyoCqvdU8XJn/qjoHJw=; b=mwDNnRDVs/rojIxBHHkoox0oeH jLJh+rEGcUE/A/68LanuuYwBbAqGutQXkQiNveE82IJoK5a0W9OqQqxKfrKNxVmsMmX/SMVvlKeC0 ZA5IRIDAlGSPNIIE6/coS3qAZpb7eS7jt2zgPefvOSaJtLXArQH0C8oVEt6R59VfGckX3vXDpf9pe HtFTde242PoXxuyab2zpmqR/szLSAbQ8eojNJsjdjbvAHNHFabFJ3D6FLoACCEuwLS2rV5BVePmCz 71dSuh9Qrq1of23PG1wDWsWt/YR6BeKC9I1x2VLh9gatB/51ycV3SsKqPsOxENhyVssT/dFYncL4/ XkLtVskg==; Received: from hch by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFETz-0000000A9Zf-3ZTU; Thu, 06 Jun 2024 14:52:51 +0000 Date: Thu, 6 Jun 2024 07:52:51 -0700 From: Christoph Hellwig To: Ming Lei Cc: yebin , Christoph Hellwig , axboe@kernel.dk, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Ye Bin , Zhang Yi , "Ewan D. Milne" , linux-nvme@lists.infradead.org Subject: Re: [PATCH] block: bio-integrity: fix potential null-ptr-deref in bio_integrity_free Message-ID: References: <20240606062655.2185006-1-yebin@huaweicloud.com> <66619EB6.4040002@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html On Thu, Jun 06, 2024 at 10:30:06PM +0800, Ming Lei wrote: > Yeah, that is one area queue freezing can't cover logical block size > change, but I'd suggest to put the logical bs check into submit_bio() or > slow path of __bio_queue_enter() at least. We really need an alignment check in submit_bio anyway, so doing it under the freeze protection would also help with this. > My concern is that nvme format is started without draining IO, and > IO can be submitted to hardware when nvme FW is handling formatting. > I am not sure if nvme FW can deal with this situation correctly. > Ewan suggested to run 'nvme format' with exclusive nvme disk open, which > needs nvme-cli change. .. and doesn't protect against someone using a different tool anyway. That beeing said, nvme_passthru_start actually freezes all queues based on the commands supported an affects log, and nvme_init_known_nvm_effects should force this even for controllers not supporting the log or reporting bogus information. So in general the queue should be frozen during the actual format.