linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Kukjin Kim <kgene@kernel.org>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Richard Purdie <rpurdie@rpsys.net>,
	Jacek Anaszewski <j.anaszewski@samsung.com>,
	Lee Jones <lee.jones@linaro.org>,
	Sebastian Reichel <sre@kernel.org>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Alessandro Zummo <a.zummo@towertech.it>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-input@vger.kernel.org, linux-leds@vger.kernel.org,
	linux-pm@vger.kernel.org, rtc-linux@googlegroups.com,
	r.baldyga@hackerion.com,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	stable@vger.kernel.org,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [PATCH v6 1/9] input: max8997-haptic: Fix NULL pointer dereference
Date: Mon, 9 May 2016 09:32:41 -0700	[thread overview]
Message-ID: <20160509163241.GB15535@dtor-ws> (raw)
In-Reply-To: <1462519289-2356-2-git-send-email-k.kozlowski@samsung.com>

On Fri, May 06, 2016 at 09:21:21AM +0200, Krzysztof Kozlowski wrote:
> From: Marek Szyprowski <m.szyprowski@samsung.com>
> 
> NULL pointer derefence happens when booting with DTB because the
> platform data for haptic device is not set in supplied data from parent
> MFD device.
> 
> The MFD device creates only platform data (from Device Tree) for itself,
> not for haptic child.
> 
> Unable to handle kernel NULL pointer dereference at virtual address 0000009c
> pgd = c0004000
> 	[0000009c] *pgd=00000000
> 	Internal error: Oops: 5 [#1] PREEMPT SMP ARM
> 	(max8997_haptic_probe) from [<c03f9cec>] (platform_drv_probe+0x4c/0xb0)
> 	(platform_drv_probe) from [<c03f8440>] (driver_probe_device+0x214/0x2c0)
> 	(driver_probe_device) from [<c03f8598>] (__driver_attach+0xac/0xb0)
> 	(__driver_attach) from [<c03f67ac>] (bus_for_each_dev+0x68/0x9c)
> 	(bus_for_each_dev) from [<c03f7a38>] (bus_add_driver+0x1a0/0x218)
> 	(bus_add_driver) from [<c03f8db0>] (driver_register+0x78/0xf8)
> 	(driver_register) from [<c0101774>] (do_one_initcall+0x90/0x1d8)
> 	(do_one_initcall) from [<c0a00dbc>] (kernel_init_freeable+0x15c/0x1fc)
> 	(kernel_init_freeable) from [<c06bb5b4>] (kernel_init+0x8/0x114)
> 	(kernel_init) from [<c0107938>] (ret_from_fork+0x14/0x3c)
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: <stable@vger.kernel.org>
> Fixes: 104594b01ce7 ("Input: add driver support for MAX8997-haptic")
> [k.kozlowski: Write commit message, add CC-stable]
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Applied, thank you.

> ---
>  drivers/input/misc/max8997_haptic.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/misc/max8997_haptic.c b/drivers/input/misc/max8997_haptic.c
> index a806ba3818f7..8d6326d7e7be 100644
> --- a/drivers/input/misc/max8997_haptic.c
> +++ b/drivers/input/misc/max8997_haptic.c
> @@ -255,12 +255,14 @@ static int max8997_haptic_probe(struct platform_device *pdev)
>  	struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent);
>  	const struct max8997_platform_data *pdata =
>  					dev_get_platdata(iodev->dev);
> -	const struct max8997_haptic_platform_data *haptic_pdata =
> -					pdata->haptic_pdata;
> +	const struct max8997_haptic_platform_data *haptic_pdata = NULL;
>  	struct max8997_haptic *chip;
>  	struct input_dev *input_dev;
>  	int error;
>  
> +	if (pdata)
> +		haptic_pdata = pdata->haptic_pdata;
> +
>  	if (!haptic_pdata) {
>  		dev_err(&pdev->dev, "no haptic platform data\n");
>  		return -EINVAL;
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Dmitry

  parent reply	other threads:[~2016-05-09 16:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06  7:21 [PATCH v6 0/9] mfd: max8997: Add regmap support Krzysztof Kozlowski
2016-05-06  7:21 ` [PATCH v6 1/9] input: max8997-haptic: Fix NULL pointer dereference Krzysztof Kozlowski
2016-05-06  7:24   ` Krzysztof Kozlowski
2016-05-06  7:27   ` [PATCH v6 2/9] mfd: max8997: Use regmap to access registers Krzysztof Kozlowski
2016-05-06  7:27     ` [PATCH v6 3/9] mfd: max8997: handle IRQs using regmap Krzysztof Kozlowski
2016-05-06  7:27     ` [PATCH v6 4/9] mfd: max8997: Change irq names to upper case Krzysztof Kozlowski
2016-05-06  7:27     ` [PATCH v6 5/9] extcon: max8997: Fix handling error code of regmap_irq_get_virq() Krzysztof Kozlowski
2016-05-10  1:23       ` Chanwoo Choi
2016-05-06  7:27     ` [PATCH v6 6/9] rtc: max8997: Check for ERRNO " Krzysztof Kozlowski
2016-05-07  6:48       ` Alexandre Belloni
2016-05-06  7:27     ` [PATCH v6 7/9] extcon: max8997: Fix inconsistent indenting Krzysztof Kozlowski
2016-05-10  1:24       ` Chanwoo Choi
2016-05-06  7:27     ` [PATCH v6 8/9] ARM: dts: exynos: Fix regulator name to avoid forbidden character on exynos4210-trats Krzysztof Kozlowski
2016-05-06  7:27     ` [PATCH v6 9/9] ARM: dts: exynos: Add interrupt line to MAX8997 PMIC " Krzysztof Kozlowski
2016-05-06  8:04     ` [PATCH v6 2/9] mfd: max8997: Use regmap to access registers Jacek Anaszewski
2016-05-09 16:32   ` Dmitry Torokhov [this message]
2016-05-09  7:35 ` [PATCH v6 0/9] mfd: max8997: Add regmap support Lee Jones

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=20160509163241.GB15535@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=broonie@kernel.org \
    --cc=cw00.choi@samsung.com \
    --cc=dbaryshkov@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=j.anaszewski@samsung.com \
    --cc=k.kozlowski@samsung.com \
    --cc=kgene@kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=myungjoo.ham@samsung.com \
    --cc=r.baldyga@hackerion.com \
    --cc=rpurdie@rpsys.net \
    --cc=rtc-linux@googlegroups.com \
    --cc=sre@kernel.org \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).