Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4582856pxb; Sun, 14 Feb 2021 16:15:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJyiNyVwX6xYdyVTaNtqiHc5ZkoqzwbhCnVj2G4YhRnfAg/GaT8YJWdCa5+cupLA7wrNbezi X-Received: by 2002:a05:6402:4382:: with SMTP id o2mr13481908edc.371.1613348141182; Sun, 14 Feb 2021 16:15:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613348141; cv=none; d=google.com; s=arc-20160816; b=Zw2OWdT4hEZBU2i0vaVp1/vDqNXULnGuYJ0D5k/6aTgeTDrAm2Rg7Hna/rPN/fYDvy zeHnwUZJT6FuiRWHjCtjab5C+gatF1DUUgN/L/nlx7ma9/F3UQLUEI7eKdefhuhZfNcQ 3EvgjF0FOGIb0dt9n2AddlULJdwcjSczCn2JvQj47QEayirtQcgzu3zdu+0dBRK3gyUu VojRNheasxJA0f2CC3egzZQkf4z5efTHTmr1TZEFcscx6wxoQCAhgCbKTutm4+tC+n9Y H4hGEQIAYlQaOjB48+0oo2FqAiExSBj9yY+KXORUPwkIOg+fgKoCbs+MaKqRulvolKQi ZM5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :ironport-sdr; bh=1T6JoV2qux9SyORilrABhm0lCrlKTrRzoS8SxB2HPiI=; b=VRBacYzvNCe7/AIEVrtyoWfG+BixMu597SmL8uM1IHIt6mFjpF5d+dQk71bcU/DpIi G7Lc2DfA696Qrt/lZl/TgKj0EbZYMJfPwJaarmNzFybuYl6Fp7YQEpKQfuY/LsmVABFX dGUBLPDjp/8HWyVfYuFeTxGqiJJKpj4VuteSC2RmQKEDrDyMcCQnY1ES7S6+Dtjz1TBD xSNkmR8PlGQAVSEblSrshexK9e1OKrllCBZp1kjzxYKZO0dSG6y5yrKCK1MsOU0rbLcE yBFEuhtgbCWBZFpV4nAWrci30L9XMneZjXAAbgOlHIMt8cAcwAzxf0tF9zRn1et+o5V4 rSSQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id du19si10891601ejc.206.2021.02.14.16.15.06; Sun, 14 Feb 2021 16:15:41 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230116AbhBNXPk (ORCPT + 99 others); Sun, 14 Feb 2021 18:15:40 -0500 Received: from mga07.intel.com ([134.134.136.100]:49707 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229792AbhBNXPj (ORCPT ); Sun, 14 Feb 2021 18:15:39 -0500 IronPort-SDR: lvCgyegnW6k6StVGMoPbB1kxQ7P6VaRhRElmlGLC4gw4g9xiybXpWpZyhnDhBxbx3aUp8lcsF+ e2QvUFPMGRYQ== X-IronPort-AV: E=McAfee;i="6000,8403,9895"; a="246671017" X-IronPort-AV: E=Sophos;i="5.81,179,1610438400"; d="scan'208";a="246671017" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Feb 2021 15:14:58 -0800 IronPort-SDR: 5baMiPXAMLOLE+02Ny6pfw3U38wyzJ/BY291r/241pX2vv9fWp+/sWXoW5/e34TDtQzqTVMYnU aQ6EekstXsAQ== X-IronPort-AV: E=Sophos;i="5.81,179,1610438400"; d="scan'208";a="398810113" Received: from cbfoster-mobl.amr.corp.intel.com (HELO intel.com) ([10.252.135.243]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Feb 2021 15:14:57 -0800 Date: Sun, 14 Feb 2021 15:14:56 -0800 From: Ben Widawsky To: Al Viro Cc: linux-cxl@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, linux-pci@vger.kernel.org, Bjorn Helgaas , Chris Browy , Christoph Hellwig , Dan Williams , David Hildenbrand , David Rientjes , Ira Weiny , Jon Masters , Jonathan Cameron , Rafael Wysocki , Randy Dunlap , Vishal Verma , "John Groves (jgroves)" , "Kelley, Sean V" , kernel test robot , Dan Williams Subject: Re: [PATCH v2 4/8] cxl/mem: Add basic IOCTL interface Message-ID: <20210214231456.xnwitliczv6qwmjv@intel.com> References: <20210210000259.635748-1-ben.widawsky@intel.com> <20210210000259.635748-5-ben.widawsky@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21-02-14 16:30:09, Al Viro wrote: > On Tue, Feb 09, 2021 at 04:02:55PM -0800, Ben Widawsky wrote: > > > +static int handle_mailbox_cmd_from_user(struct cxl_memdev *cxlmd, > > + const struct cxl_mem_command *cmd, > > + u64 in_payload, u64 out_payload, > > + struct cxl_send_command __user *s) > > +{ > > + struct cxl_mem *cxlm = cxlmd->cxlm; > > + struct device *dev = &cxlmd->dev; > > + struct mbox_cmd mbox_cmd = { > > + .opcode = cmd->opcode, > > + .size_in = cmd->info.size_in, > > + }; > > + s32 user_size_out; > > + int rc; > > + > > + if (get_user(user_size_out, &s->out.size)) > > + return -EFAULT; > > You have already copied it in. Never reread stuff from userland - it *can* > change under you. As it turns out, this is some leftover logic which doesn't need to exist at all, and I'm happy to change it. Thanks for reviewing. I wasn't familiar with this restriction though. For my edification could you explain how that could happen? Also, is this something that should go in the kdocs, because I don't see anything about this restriction there. Thanks. Ben