Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp580199pxf; Thu, 25 Mar 2021 09:32:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxchhUgQAY2aQOSLWr8YsxGqSKFB7exxbKEVXlJRnvtKNamqJReGpuDfw1U+KMtJDMhEx/x X-Received: by 2002:a05:6402:2d0:: with SMTP id b16mr10252134edx.194.1616689969381; Thu, 25 Mar 2021 09:32:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616689969; cv=none; d=google.com; s=arc-20160816; b=AaK1yXeomdaOYxgW3HuWjMh+AWj6iUtsJiOV0CfFkr0rTpvk3LsVq/flEgfZ9KgdLq dowbU3ekzIz6/AaC7o4nysDHUXtJwo/MKnJP+oetsNb3ZLuRCv+UbzhnxO7qc/V6ZwP7 ula8GJE3ZJp7Mis8k4pb6uf5sbO6sCm6hPgMX7N0b/uD4/6+92976uQd9+E97Qiz0aDm hbACmIN4IB2mBuQZ5SoQYF9Fe5E1d2awOr+sTOYmRwrfG5FuEePTYpf3bXVLvdxTq+gt I+hnzgdnzk+41Na4pQlOY8m2YLP0DhNpmX8RbOpJry/N+HSpVhqXxJx3wNSq7egN2pec RZ4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=C27qWYLT0prfq3A06WyyLjiNGua0teidZmWI37omK30=; b=s7qx7mvtBvLMeiwXm9c2fgcfbrHEIC/1V0LdDUE49pfEdgZRLt71rFbLD1s8qj5Hlg x+FZmsGEOQ2mqz/yHF/WgE/w6uS6at6urUQrTdwPHpelYZyfe5BQCQD/72Yyia1Vz+nC Jpx4P0ojRLOlBt1eTJXZmE9JHluXjHeKgcycKFVXc7jvumQ0/1G3Z1YjBN7+fzbuAiMt MUK1gVoSRzHP6fS1dEMi5xXXj9AGXQUzgia0+gunWT41VbfvYvcYkAEzbidUK+qorPQ+ v5OoWUgnxXa34x3q2lcB/PIB94toLcDLYMD4crZCyxlEzUy3UJX7q2ybNd1WfaAMohLG hqyw== 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 n24si4686109eds.571.2021.03.25.09.32.25; Thu, 25 Mar 2021 09:32:49 -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 S229631AbhCYQbF (ORCPT + 99 others); Thu, 25 Mar 2021 12:31:05 -0400 Received: from verein.lst.de ([213.95.11.211]:42162 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbhCYQac (ORCPT ); Thu, 25 Mar 2021 12:30:32 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 6A9D268BEB; Thu, 25 Mar 2021 17:30:29 +0100 (CET) Date: Thu, 25 Mar 2021 17:30:28 +0100 From: Christoph Hellwig To: Niklas Cassel Cc: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , "minwoo.im.dev@gmail.com" , "javier@javigon.com" , "linux-nvme@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] nvme: disallow passthru cmd from targeting a nsid != nsid of the block dev Message-ID: <20210325163028.GA737@lst.de> References: <20210325094807.328126-1-Niklas.Cassel@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210325094807.328126-1-Niklas.Cassel@wdc.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 25, 2021 at 09:48:37AM +0000, Niklas Cassel wrote: > @@ -1632,6 +1632,8 @@ static int nvme_user_cmd(struct nvme_ctrl *ctrl, struct nvme_ns *ns, > return -EFAULT; > if (cmd.flags) > return -EINVAL; > + if (ns && cmd.nsid != ns->head->ns_id) > + return -EINVAL; Shouldn't we log something to the kernel log including the device and current->comm?