All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lad Prabhakar" <prabhakar.mahadev-lad.rj@bp.renesas.com>
To: cip-dev@lists.cip-project.org,
	Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>,
	Pavel Machek <pavel@denx.de>
Cc: Biju Das <biju.das.jz@bp.renesas.com>
Subject: [cip-dev] [PATCH 4.4.y-cip] gpio: rcar: Avoid NULL pointer access in gpio_rcar_set_multiple()
Date: Fri,  4 Sep 2020 08:40:57 +0100	[thread overview]
Message-ID: <20200904074057.27932-1-prabhakar.mahadev-lad.rj@bp.renesas.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1007 bytes --]

gpiochip_get_data() expects the controller probe to call
gpiochip_add_data() before using it, where as the rcar-gpio
driver probe has gpiochip_add() call thus resulting in NULL
pointer access.

Avoid this case by using gpio_to_priv() call.

Fixes: 6e52cced1aa58 ("gpio: rcar: Implement gpiochip.set_multiple()")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/gpio/gpio-rcar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index e829f11aca8f..2778dcd96ae7 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -352,7 +352,7 @@ static void gpio_rcar_set(struct gpio_chip *chip, unsigned offset, int value)
 static void gpio_rcar_set_multiple(struct gpio_chip *chip, unsigned long *mask,
 				   unsigned long *bits)
 {
-	struct gpio_rcar_priv *p = gpiochip_get_data(chip);
+	struct gpio_rcar_priv *p = gpio_to_priv(chip);
 	unsigned long flags;
 	u32 val, bankmask;
 
-- 
2.17.1


[-- Attachment #2: Type: text/plain, Size: 419 bytes --]

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#5415): https://lists.cip-project.org/g/cip-dev/message/5415
Mute This Topic: https://lists.cip-project.org/mt/76625137/4520388
Group Owner: cip-dev+owner@lists.cip-project.org
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129055/727948398/xyzzy  [cip-dev@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-

             reply	other threads:[~2020-09-04  7:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04  7:40 Lad Prabhakar [this message]
2020-09-09  7:02 ` [cip-dev] [PATCH 4.4.y-cip] gpio: rcar: Avoid NULL pointer access in gpio_rcar_set_multiple() Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200904074057.27932-1-prabhakar.mahadev-lad.rj@bp.renesas.com \
    --to=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=cip-dev@lists.cip-project.org \
    --cc=nobuhiro1.iwamatsu@toshiba.co.jp \
    --cc=pavel@denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.