Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2860146imm; Mon, 24 Sep 2018 11:07:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV6377akxJHU2fbO9E3yDwFDwT00vkJM3EHX0KHIYNq4kNlpfSov4Np0UXobiTN4M8cNRqkl4 X-Received: by 2002:a62:d206:: with SMTP id c6-v6mr33938pfg.8.1537812454350; Mon, 24 Sep 2018 11:07:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537812454; cv=none; d=google.com; s=arc-20160816; b=QsHTQHIWlU6PcWWr30pc4qDpq1QW1gMGNTY8/W2HJgVfEYgv2dmToJvo1kKbuRNO6t W+apPVbuyoG3Cuymnl9JQwgLUtUQwHfhBHnBw4PgYjsSNX74UyyctUOJC5M2jlAfczAj 0PrD4jVm/YIF4HhJtxuPkAYgV3+26mZpBVAESMUn/za9lRolnpi0ujUixtj46hn0fxBa tUnpSoOqUVWUtTGRpgVOMvI1g5kf8pr4yLAGt5rNa8aL22GyvHbklAyMVqPoysMI1KDe JIJLPlsox8ZoNEzy0YWrNxXHjjqBen4MDMrHKA9eDlG2SDYO2rK0uStAchOUk20hMMMD 8s8A== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=IhjtqM6Jp3fvzTbn3cUhh/vRbiI3DN9T5Skz4eF5dMQ=; b=dyoPWWbJwoe9jCIq6UTi6nz5W6/psJsdjrjAZ+QtYl+MPZBe8P7+2dVNAPHMtExGDL tUdqaOYsiRzqPnDZVoX4yphtOwuc0FG3XggM5LrWltYVViX1L/swMFBLVwvHL3xU/KeX A0ekF+O8dBgrnjpDFrHA88S5Ojg34Nd6c4bTGj+/3Z5lczXf46HRUAtd+z7GyKEVdwAN 199mOK0+Mslj8+7dv9ajJaGQqztACscFP+I/4tq7I/Mr9mbt2/ic2Ni5nnI7kSbd7cv7 fnns/3pl7tfqP4NnU4KENN4dp70tXUseRRl/vtA9Zth+PtkKaN2lvciKoX2rJw37OB9F T6Cw== ARC-Authentication-Results: i=1; mx.google.com; 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 w197-v6si4370036pfd.313.2018.09.24.11.07.18; Mon, 24 Sep 2018 11:07:34 -0700 (PDT) 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; 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 S1732572AbeIYAKU (ORCPT + 99 others); Mon, 24 Sep 2018 20:10:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:54100 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726218AbeIYAKU (ORCPT ); Mon, 24 Sep 2018 20:10:20 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5E480F06; Mon, 24 Sep 2018 18:06:57 +0000 (UTC) Date: Mon, 24 Sep 2018 20:06:54 +0200 From: Greg Kroah-Hartman To: Bartosz Golaszewski Cc: Linux Kernel Mailing List , stable , Linus Walleij , alexander.levin@microsoft.com Subject: Re: [PATCH 4.18 177/235] gpiolib: dont allow userspace to set values of input lines Message-ID: <20180924180654.GA31233@kroah.com> References: <20180924113103.999624566@linuxfoundation.org> <20180924113122.447077803@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 Mon, Sep 24, 2018 at 02:57:38PM +0200, Bartosz Golaszewski wrote: > pon., 24 wrz 2018 o 14:41 Greg Kroah-Hartman > napisaƂ(a): > > > > 4.18-stable review patch. If anyone has any objections, please let me know. > > > > ------------------ > > > > From: Bartosz Golaszewski > > > > [ Upstream commit e5332d5437764f775cf4e3b8ca3bf592af063a02 ] > > > > User space can currently both read and set values of input lines using > > the character device. This was not allowed by the old sysfs interface > > nor is it a correct behavior. > > > > Check the first descriptor in the set for the OUT flag when asked to > > set values and return -EPERM if the line is input. > > > > Signed-off-by: Bartosz Golaszewski > > Signed-off-by: Linus Walleij > > Signed-off-by: Sasha Levin > > Signed-off-by: Greg Kroah-Hartman > > --- > > drivers/gpio/gpiolib.c | 8 +++++++- > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > --- a/drivers/gpio/gpiolib.c > > +++ b/drivers/gpio/gpiolib.c > > @@ -449,7 +449,13 @@ static long linehandle_ioctl(struct file > > > > return 0; > > } else if (cmd == GPIOHANDLE_SET_LINE_VALUES_IOCTL) { > > - /* TODO: check if descriptors are really output */ > > + /* > > + * All line descriptors were created at once with the same > > + * flags so just check if the first one is really output. > > + */ > > + if (!test_bit(FLAG_IS_OUT, &lh->descs[0]->flags)) > > + return -EPERM; > > + > > if (copy_from_user(&ghd, ip, sizeof(ghd))) > > return -EFAULT; > > > > > > > > Hi Greg, > > FYI Linus suggested that we don't send this one for stable: > https://lkml.org/lkml/2018/7/20/1065 Ok, that was hard to dig out. This was sent as review last week. I'll go drop it, thanks for letting me know. greg k-h