Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2528215imm; Mon, 24 Sep 2018 05:59:51 -0700 (PDT) X-Google-Smtp-Source: ACcGV62t2hE7ZG4Y3Ws1C71PxG1LlRkFuO9SCx/lw7huEOwBnzV1oy4ngcm9si53AkDDMDfyquhs X-Received: by 2002:a17:902:9a83:: with SMTP id w3-v6mr10894828plp.75.1537793991737; Mon, 24 Sep 2018 05:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537793991; cv=none; d=google.com; s=arc-20160816; b=1BLnXV0IveC4WI9j4sx44bF2dbOLJALqPtjSE8xUmAnEvY3qY+2wKLZUfxoHuo/zMH z0mZd+jIT8iIErNf2dEnG+N/34BCgQ6gVTm3kGtiOofTMxsnVijjJB+7c+4v9w9+NyIu 7upVqY1XjJGPIa9lvzYcNIC5c3CDZd7vhr6YSE/T6ACl31LTM8MbdB/DZt9zWmR2WbJk WPn7cIE7J+FnNIed7rfz9MArJy6GVvFEFgKIZOIp1Z88/gjBAGZ8hB/1kmtI3O8cd6eT JuRP2CNo3x+IfxTEY1cR1DIuONxbFGotAjedbH/0QSL4MUq4HyEGPTgLPSAjfI+/w/Sm z6tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=uhWtW2S0Df1YfLcL57eGwD0SSebDed+7aINxaUk1qDQ=; b=Fnn5yZvpvYnqQV2cEb4GXa0RB/cMLfMv26FOaXkcbDgQD+sB0k2bUPhXTr6Hxj83uH 2Lq6xLyitN7KiS8+4Mk84gwUBy3aQeQsocupwoOnERvAbdd2ZHRP80I6jWkuW71HnxU2 p8sH7y4u2Y713Wa18M9ZkVKdMpC+ERENE/IBIENCWx6Dj/ffpH93ermZvYTbLHmeAc8/ i4dlaxkaZ1eRECZShk5bNsyDw5ZBAndB2te3gstwSRgylxcmFxTlrdLCVC3lY1jqv3jd Gbu2YgGGmEujgNa5CYZHYz2F8SGQCPgBNN+O/x3GgLk5OgTgRqNRsHjhutWMH/gQylCP /SnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=cDBV0ZzF; 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 n15-v6si5039873pgc.143.2018.09.24.05.59.36; Mon, 24 Sep 2018 05:59:51 -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; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=cDBV0ZzF; 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 S1731600AbeIXS7x (ORCPT + 99 others); Mon, 24 Sep 2018 14:59:53 -0400 Received: from mail-it1-f193.google.com ([209.85.166.193]:37169 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728650AbeIXS7w (ORCPT ); Mon, 24 Sep 2018 14:59:52 -0400 Received: by mail-it1-f193.google.com with SMTP id h20-v6so10300139itf.2 for ; Mon, 24 Sep 2018 05:57:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=uhWtW2S0Df1YfLcL57eGwD0SSebDed+7aINxaUk1qDQ=; b=cDBV0ZzFMO2tQ1cqajFrGhmchIK3SjScY9qeRYqTFbhv9C+mJ2iqoaRUNXxbjMm+Fl 03EQrvM70ajwzJGYWRCxk9apofDu4pXS9Te06DBdJKqwgBjRqTzXmdcblQ48IjEH2jrC gkN/fi+qkXK0m/WP1j29npr79awamI3N5+P1aVeZFst50YARpY5BRtd1LJzHqcwDQ8Nq SmP5KgGpHsGrxQyeUjEXUHif+gVUvJMwG9jPp7jOUVe4/elZAnKLK73H5fQI5HHg4PdS DIYzvdwa7/35FIdJk2+X8usNkLu/FGkxKLldmDw+8vSodjeThmkTmlg3HT55Y6khj4XV sL4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=uhWtW2S0Df1YfLcL57eGwD0SSebDed+7aINxaUk1qDQ=; b=CzAnmf+p0eK/3ajmeQsBcQlQJX9vqTltjcxHJ1EwwBmZjOuFff6R1M4FQ8uYYGmuTB z74Pnx5bCd0Hkbq9ivxX7m3WcSk5HTyITQQhHAOl7YoJ9bbwfV6o7ZsGa8E+v7B5aA1I 0wtfXNtaxIS84OvxUsxZx6tbkHP0xN4evvuqooBil8woE34Fvp4HibtoO9jYkDwFjLV6 deOsqd7upIoU4ESRPHKV6w4xiXwKx7UDvZaiAuec86op8yPp4EBOYXEs+mhrleK3Pgu3 E+5yaIWmCuE8vG5tlGmrPcwYHH76J600GrOq7iW4rRwezLgXyFvW5ifk1gYuofkwbVDe dwtg== X-Gm-Message-State: ABuFfogDDNMth8+99z1Y+fA1ZSgH5iJhOq+FmAKGAvN3Y0N0+2hhyIhE XkgSlO9V18N5EKgwB8U7W49RQA/PaLn4l/PlPssBcA== X-Received: by 2002:a24:6e96:: with SMTP id w144-v6mr7876043itc.111.1537793869819; Mon, 24 Sep 2018 05:57:49 -0700 (PDT) MIME-Version: 1.0 References: <20180924113103.999624566@linuxfoundation.org> <20180924113122.447077803@linuxfoundation.org> In-Reply-To: <20180924113122.447077803@linuxfoundation.org> From: Bartosz Golaszewski Date: Mon, 24 Sep 2018 14:57:38 +0200 Message-ID: Subject: Re: [PATCH 4.18 177/235] gpiolib: dont allow userspace to set values of input lines To: Greg Kroah-Hartman Cc: Linux Kernel Mailing List , stable , Linus Walleij , alexander.levin@microsoft.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pon., 24 wrz 2018 o 14:41 Greg Kroah-Hartman napisa=C5=82(a): > > 4.18-stable review patch. If anyone has any objections, please let me kn= ow. > > ------------------ > > 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 =3D=3D GPIOHANDLE_SET_LINE_VALUES_IOCTL) { > - /* TODO: check if descriptors are really output */ > + /* > + * All line descriptors were created at once with the sam= e > + * 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 Best regards, Bartosz Golaszewski