Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1130746imm; Wed, 10 Oct 2018 09:33:00 -0700 (PDT) X-Google-Smtp-Source: ACcGV62HtbirVItQJwRE768sKsTjmhuweE121fStFMc0kO0Trq8aW0vIQf8u3yl4+RD00KfZA9Ia X-Received: by 2002:a17:902:20c5:: with SMTP id v5-v6mr33460073plg.62.1539189180654; Wed, 10 Oct 2018 09:33:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539189180; cv=none; d=google.com; s=arc-20160816; b=PXQWjb42ZbmrfcamsSRmV6dKDKGPA480ERNk/uBfCjy0kLR4T/Su2vPPVXHCOrgQ2I nghsmvL8DjTNGbc6E6C7yPCmMJJR3HmaiEu2xdVKZiOpmNM6fXaM6ZElHHPyx1VEqc8e bbBaP5+kskLSU7E1bJjR2RX93EEddSoVANVIjokgJZ7UisFfe/Eis9IqwpzDxX74/DfN yrUyRaKENjxPyEWwaVQAB1HVqo4DBLS+Sp9TqfEv8tkIVoBNK577BjYp0lMYzEbDMS2G xfMkW7sgM8J2j/iy2V5F67FKsDqijCLfDjA1gI49upO99XGieU3CG3kHBNySWtd06gYi 3EuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:mime-version:user-agent:date:message-id :autocrypt:openpgp:subject:from:to:reply-to; bh=e89MV2vBgE+zqOGyaMuBj2SZM8fufww/qx84761mn1I=; b=bb4lzGPxas9/XGEDDEITL/3oJIUWIsCm57MiYpQ684SskN9PZLAg1Pi4H/3dWZhXOE h4vrTLLn88gC9CUPNhQxYCdniX6BAGZfs2h1WGpoKZ5Nj4yZJIPyixDjlpi60ZXyjWD2 Dfkpj3CzbUry99BUXD0t6PUkrtsDTtk1pvEig9jhFIxkI/SfnbWfnGC1qkxrUAxlGR2u db1Zper2ADCUN83hDGFWkMxj+D6BGB4ucpKURiHKnUffGaCRvKY4n59Yb/7s9R3RzUQk pUxt/Fxo5XH5pJc17ZR/1PK8NNCmTeV5zy+RNNFH3A41Iz72vTlKSL2EO38vL4lVv8z3 F/ew== 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 p2-v6si21830502pgl.21.2018.10.10.09.32.45; Wed, 10 Oct 2018 09:33:00 -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 S1726825AbeJJXzE convert rfc822-to-8bit (ORCPT + 99 others); Wed, 10 Oct 2018 19:55:04 -0400 Received: from elektron.elka.pw.edu.pl ([194.29.160.103]:42433 "EHLO elektron.elka.pw.edu.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726479AbeJJXzE (ORCPT ); Wed, 10 Oct 2018 19:55:04 -0400 X-Greylist: delayed 1146 seconds by postgrey-1.27 at vger.kernel.org; Wed, 10 Oct 2018 19:55:02 EDT Received: from [172.19.1.1] (178235205188.warszawa.vectranet.pl [178.235.205.188]) (Authenticated sender: wzabolot@elektron.elka.pw.edu.pl) by elektron.elka.pw.edu.pl (Postfix) with ESMTPSA id BEAE668B013 for ; Wed, 10 Oct 2018 18:13:03 +0200 (CEST) Reply-To: wzab@ise.pw.edu.pl To: LKML From: wzab Subject: Bug introduced in the of_get_named_gpiod_flags function. Openpgp: preference=signencrypt Autocrypt: addr=wzab@ise.pw.edu.pl; prefer-encrypt=mutual; keydata= mQQNBFjygGQBIAC1gKtkzQFr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dmRYRd0VkXIgp7r+t2mN3OWAPXLXVxYWNakjptywEWqCEP8Pay0AryH/fvOOhYvlRgUhpv psEysxjTbFlDTBnlJv42zYvI9Hm7Z3P//LKyYxg8rHwIHOG7UgeKdlTJHrPc41OFzh8EX7y2 35ww5bS6s3/Y6oAkyD2yD8+mGmqQnWttuUkRD2ByEmXs1F7CsObmHFrAYutA4wcn6ltnuzzr 9AHtLkjI3XkOBXqcX4ppEBC+LFcLG+JLjAqZiyf0d3eyJNBtlgumSEyjz7+2k0fcTk7bcjbK TOH3/6yz2EyPmUBj1VY+shnGzhecU7vO8KHpNV3rDLU19FDAeJiHuLbHE9PNZV+bqIU/EFb1 ZVs+B6Y3ILO9ILbejYI2QavTtHLUCJ0zqmZCQFSOnGBKpnlCjQ== Message-ID: <90dbf770-5262-5128-e585-c44d086568f9@ise.pw.edu.pl> Date: Wed, 10 Oct 2018 18:13:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Content-Language: pl-PL Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, The function of_get_named_gpiod_flags in older versions of the kernel (up to 4.7.10 - https://elixir.bootlin.com/linux/v4.7.10/source/drivers/gpio/gpiolib-of.c#L75 ) contained an important workaround: /* .of_xlate might decide to not fill in the flags, so clear it. */if (flags) *flags = 0; Unfortunately, newer kernels do not contain it. Therefore if the "xlat" function in the gpiochip driver does not set flags, (like e.g. the Xilinx AXI GPIO driver: https://github.com/Xilinx/linux-xlnx/blob/c2ba891326bb472da59b6a2da29aca218d337687/drivers/gpio/gpio-xilinx.c#L262 ) the random, unitialized value from the stack in of_find_gpio ( https://elixir.bootlin.com/linux/v4.18.13/source/drivers/gpio/gpiolib-of.c#L228 ) is used, which results in random settings of e.g., OPEN DRAIN or OPEN SOURCE mode. I have also reported the problem in the Xilinx forum: https://forums.xilinx.com/t5/Embedded-Linux/Bug-in-of-get-named-gpiod-flags-function-in-the-kernel-random/td-p/897695 With best regards, Wojciech Zabolotny