Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1092440imu; Tue, 20 Nov 2018 11:33:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/XLijSleJNlMO/S864HIlXTnb5HMEGog7SC9Ct9sUB/APhFFDpqFR6fCX5byvgo/LQqhJwm X-Received: by 2002:a17:902:144:: with SMTP id 62-v6mr3456634plb.142.1542742395930; Tue, 20 Nov 2018 11:33:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542742395; cv=none; d=google.com; s=arc-20160816; b=gObnBUzpGWkIeiyBcnr+YoBdH8iuRlQzRjb2a8/cu55UohmevkZRX1A6dGT7AjPMcO iyezxz4EOpIuPcrNXmDw3vIt/xW6VX9tKNy3fwk2Q+QjA/NtirZG7pl7fnNomm+OdAi2 69utuRo3rplFCmTPF1NkmqFR3J7fNeWX+K+s6SLTYM33J26VAzZnJTOEDbEopd3Pl1xe jUWboxQe7f3F5tmwg5jewqF6Bb1LS7RbvDmdWf1c55BJ80NTk08kKZV/H5j213NWi6AV sw9YRfRYXfN8ie72OTFJgjxeh2oKA3uaS81p5QSOigIj8f5tmzjgVhLYlB3sICrCxMrC Av9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=wlMNxUS1mY81FDUCwCj1Xu7l3ZKEl2LYhNa703OiVzk=; b=Mf9gjRAaVPJgZkfJE83TLQQxLgtrz7Hv+VBu3aah0gdbXu0OPsNDht8sRU+fAI33Ss +wCHgf40CPImz0/8JAPKQLXsEA0jh/GM/KUwak5e7TPPj2se/m4Rbd6+Om582OKh3QRt Bs2g/qwCh6JK3psW+RDszn+8aUfnkDwkFfzyNDoJ39YN7CEMD1o9eqr+DXAV9XpLD934 RRWoSeiZWswKKaTNjtoq8zwJn5RR1HCeTUeqe2Y+de7Kiu/VpNC1/lM4C3YuRYaiLPMw onFaPfd14dt3jsx/8D04p5mo21rd62YWuATb2lQc2r8QtlS9ZywwuCPdzljc3pHGjluJ QqDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=I7TV9AWF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 37si42084006pgs.447.2018.11.20.11.33.01; Tue, 20 Nov 2018 11:33:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=I7TV9AWF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728225AbeKUDS5 (ORCPT + 99 others); Tue, 20 Nov 2018 22:18:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:41352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725925AbeKUDS5 (ORCPT ); Tue, 20 Nov 2018 22:18:57 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7B18A20685; Tue, 20 Nov 2018 16:48:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542732533; bh=qraKiZ2g0v/wTp6ChPZcS/3GAHKrGok08AX/fEJ6Qeg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=I7TV9AWFO9QG3yGsE48FMz1ruLS3zAZOtml5ABRHILsvJ3WMzi96Q+av0AXvubXhq hX+1UrEpBwwTogKciIPBZenXvqixq6a7Zl11eYNtsMu4LSoN4H9E8BA3oxnLYIVcNF e79rnBB03Ucbg76LAOrnO5GRxwOoIabNvMGGOoDI= Date: Tue, 20 Nov 2018 17:48:50 +0100 From: "gregkh@linuxfoundation.org" To: Ioana Ciornei Cc: Laurentiu Tudor , "linux-kernel@vger.kernel.org" , "netdev-owner@vger.kernel.org" , Ioana Ciocoi Radulescu , Horia Geanta , Leo Li Subject: Re: [PATCH v3 2/4] bus: fsl-mc: add fsl-mc userspace support Message-ID: <20181120164850.GC27531@kroah.com> References: <1542728371-6972-1-git-send-email-ioana.ciornei@nxp.com> <1542728371-6972-3-git-send-email-ioana.ciornei@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1542728371-6972-3-git-send-email-ioana.ciornei@nxp.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 20, 2018 at 03:39:45PM +0000, Ioana Ciornei wrote: > +static int fsl_mc_uapi_send_command(unsigned long arg, > + struct fsl_mc_io *mc_io) > +{ > + struct fsl_mc_command mc_cmd; > + int error; > + > + error = copy_from_user(&mc_cmd, (void __user *)arg, sizeof(mc_cmd)); > + if (error) > + return -EFAULT; > + > + error = mc_send_command(mc_io, &mc_cmd); > + if (error) > + return error; > + > + error = copy_to_user((void __user *)arg, &mc_cmd, sizeof(mc_cmd)); > + if (error) > + return -EFAULT; > + > + return 0; > +} I know you said that "the firmware will properly verify the command" already, but given that I used to be a firmware developer a long time ago, I can almost guarantee that this will cause problems in the future. Want to make a friendly bet about this? What is the odds that your firmware api/interface has been properly fuzzed such that all possible combinations of bad commands will really not do horrible things to the hardware/system? Are you all willing to bet the system intregrity on this? If so, ok, it's your systems :) Personally, I think you need to add a "known whitelist" and do some sort of sanity checking here. thanks, greg k-h