lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171213085503.31899-1-quentin.schulz@free-electrons.com>
Date:   Wed, 13 Dec 2017 09:55:03 +0100
From:   Quentin Schulz <quentin.schulz@...e-electrons.com>
To:     linus.walleij@...aro.org, wens@...e.org,
        maxime.ripard@...e-electrons.com
Cc:     linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
        thomas.petazzoni@...e-electrons.com, linux-sunxi@...glegroups.com,
        mylene.josserand@...e-electrons.com,
        Quentin Schulz <quentin.schulz@...e-electrons.com>
Subject: [PATCH] pinctrl: axp209: dereference pointer after it's been set

The number of GPIOs is gotten from a field within the structure
referenced in the of_device.data but it was actually read before it was
retrieved, thus it was dereferencing a null pointer.

Set the number of GPIOs after retrieving of_device.data.

Fixes: e1190083b89b ("pinctrl: axp209: add support for AXP813 GPIOs")

Signed-off-by: Quentin Schulz <quentin.schulz@...e-electrons.com>
Reported-by: Mylène Josserand <mylene.josserand@...e-electrons.com>
---
 drivers/pinctrl/pinctrl-axp209.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c
index 22d3bb0bf927..510a2821e910 100644
--- a/drivers/pinctrl/pinctrl-axp209.c
+++ b/drivers/pinctrl/pinctrl-axp209.c
@@ -413,9 +413,11 @@ static int axp20x_pctl_probe(struct platform_device *pdev)
 	pctl->chip.set			= axp20x_gpio_set;
 	pctl->chip.direction_input	= axp20x_gpio_input;
 	pctl->chip.direction_output	= axp20x_gpio_output;
-	pctl->chip.ngpio		= pctl->desc->npins;
 
 	pctl->desc = (struct axp20x_pctrl_desc *)of_device_get_match_data(dev);
+
+	pctl->chip.ngpio		= pctl->desc->npins;
+
 	pctl->regmap = axp20x->regmap;
 	pctl->dev = &pdev->dev;
 
-- 
2.14.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ