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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 3748FC433DB for ; Sun, 14 Feb 2021 23:15:02 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B8BD560231 for ; Sun, 14 Feb 2021 23:15:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B8BD560231 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6FB26100EBB91; Sun, 14 Feb 2021 15:15:01 -0800 (PST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=ben.widawsky@intel.com; receiver= Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9E6A0100EBB8D for ; Sun, 14 Feb 2021 15:14:58 -0800 (PST) IronPort-SDR: JEveMEOfKrx4FjsQyf+2ZUuZegkLsvhBTNXgx/kNvXJi01Jzq53TIU3qdBbdSOGVj8/YSGv2Ie KC4PfaZRyfOA== X-IronPort-AV: E=McAfee;i="6000,8403,9895"; a="182678808" X-IronPort-AV: E=Sophos;i="5.81,179,1610438400"; d="scan'208";a="182678808" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.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 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-Disposition: inline In-Reply-To: Message-ID-Hash: WLHENBVXXAUNGGZ3QDVP4CCOSLJLYC4O X-Message-ID-Hash: WLHENBVXXAUNGGZ3QDVP4CCOSLJLYC4O X-MailFrom: ben.widawsky@intel.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation 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 , David Hildenbrand , David Rientjes , Jon Masters , Jonathan Cameron , Rafael Wysocki , Randy Dunlap , "John Groves (jgroves)" , "Kelley, Sean V" , kernel test robot , Dan Williams X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 _______________________________________________ Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org To unsubscribe send an email to linux-nvdimm-leave@lists.01.org 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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 C8E6BC433E0 for ; Sun, 14 Feb 2021 23:15:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7976764E08 for ; Sun, 14 Feb 2021 23:15:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229839AbhBNXPj (ORCPT ); Sun, 14 Feb 2021 18:15:39 -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-acpi@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