From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4CE3C433DB for ; Thu, 25 Mar 2021 16:31:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8746861A31 for ; Thu, 25 Mar 2021 16:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229847AbhCYQbF (ORCPT ); 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?