Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4384847pxb; Sun, 14 Feb 2021 08:32:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJxrBms/pokd5AekLKp7jw27sQTryiBN7CTGQSOSDinRLL2hMTdEKxaf7816+d7M7LKOs8AA X-Received: by 2002:a17:906:b001:: with SMTP id v1mr12054901ejy.217.1613320371141; Sun, 14 Feb 2021 08:32:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613320371; cv=none; d=google.com; s=arc-20160816; b=uYlYoUGtwRvqVtvnia/8URsmr6gWky6KYBkKcYnI3WjFJEfbNbaJbUEDecDgChqCSn oUitM958jgiJf/ZrAU539/ABxTd+TMT/4eUY3DQZLCEHlJVXGXmQHKJNF7g8oUIKEiaP x5upeXa77gQ2DT4YgwKYI2CNQyrLujcd4cxUt0JfA9JOOvkI+FkcI9j3aXCIdoG33niH 8FdZtPEaQz5tOxYOLan1qeOG6lKsuy0hQoDxrC7SVNcvdpU0ehW6AD8B+szmLibpgil9 aRPkU8sfFuYmAQOk5OvHpYT4wBga86c0JcLLSLEIDS3FwKj/7EeuzWCmhw0oekcPAL4u sghA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=0rjbLMcnBnA5NKUh0neFExxmXgzEuIC/NG2lodWVwYM=; b=sA6MLTdr/XDUgW9waLdaS5ibJHKOZFhGepCzvixoXG2pSgHh0t6rZA4zZBOasiqae6 M2DZYzzVQazQJANqb+DMRWHdsZG05O5UzFilcUwgkVonoggr1lbW3xXcdmG5uqnz6Q0s eu0fub9yqBILa6XxgnLVm1MYMiHSuvZELm66E+XkI6Ax/eYPUROddiiJXM2C5e33/eJn QTy0YKQEUP3hTPnLfdt/LNSIXGkZQuX0jmx88dIaNMwyRUgQX4clIscWYdbEaMWws3ot UxsnWB5W1zXJFx9pKP24Xwf41nr35cUkGFLaNRzEFuYlObFLdtXuATZgprEuZhIA3ETc dhOw== 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 s20si11717964eji.61.2021.02.14.08.32.27; Sun, 14 Feb 2021 08:32:51 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229714AbhBNQbO (ORCPT + 99 others); Sun, 14 Feb 2021 11:31:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbhBNQbJ (ORCPT ); Sun, 14 Feb 2021 11:31:09 -0500 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CD9DC061574 for ; Sun, 14 Feb 2021 08:30:29 -0800 (PST) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1lBKHh-00DvRy-5S; Sun, 14 Feb 2021 16:30:09 +0000 Date: Sun, 14 Feb 2021 16:30:09 +0000 From: Al Viro To: Ben Widawsky 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: 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: <20210210000259.635748-5-ben.widawsky@intel.com> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.