From: Lee Jones <lee.jones@linaro.org>
To: Alexander Shiyan <shc_work@mail.ru>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Samuel Ortiz <sameo@linux.intel.com>,
Shawn Guo <shawn.guo@linaro.org>,
Sascha Hauer <kernel@pengutronix.de>
Subject: Re: [PATCH RESEND] mfd: mc13xxx: Fix null pointer dereference in mc13xxx_common_init
Date: Mon, 2 Dec 2013 10:54:32 +0000 [thread overview]
Message-ID: <20131202105432.GC29373@lee--X1> (raw)
In-Reply-To: <1385805188-5597-1-git-send-email-shc_work@mail.ru>
On Sat, 30 Nov 2013, Alexander Shiyan wrote:
> If this driver being loaded from devicetree, the pdata is NULL.
> This cause kernel Oops when "fsl,mc13xxx-uses-codec" and/or
> "fsl,mc13xxx-uses-touch" properties is specified.
<snip>
The original code is pretty gross. This stuff shouldn't be identifying
_support_ in Device Tree, then dragging in configuration from platform
code.
Rather than patch it up with little plasters (band aids), can we fix
it properly please?
> Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
> drivers/mfd/mc13xxx-core.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
> index dbbf8ee..625633a 100644
> --- a/drivers/mfd/mc13xxx-core.c
> +++ b/drivers/mfd/mc13xxx-core.c
> @@ -682,14 +682,14 @@ err_revision:
> if (mc13xxx->flags & MC13XXX_USE_ADC)
> mc13xxx_add_subdevice(mc13xxx, "%s-adc");
>
> - if (mc13xxx->flags & MC13XXX_USE_CODEC)
> + if ((mc13xxx->flags & MC13XXX_USE_CODEC) && pdata)
> mc13xxx_add_subdevice_pdata(mc13xxx, "%s-codec",
> pdata->codec, sizeof(*pdata->codec));
>
> if (mc13xxx->flags & MC13XXX_USE_RTC)
> mc13xxx_add_subdevice(mc13xxx, "%s-rtc");
>
> - if (mc13xxx->flags & MC13XXX_USE_TOUCHSCREEN)
> + if ((mc13xxx->flags & MC13XXX_USE_TOUCHSCREEN) && pdata)
> mc13xxx_add_subdevice_pdata(mc13xxx, "%s-ts",
> &pdata->touch, sizeof(pdata->touch));
>
> @@ -701,6 +701,10 @@ err_revision:
> mc13xxx_add_subdevice_pdata(mc13xxx, "%s-pwrbutton",
> pdata->buttons, sizeof(*pdata->buttons));
> } else {
> + if (mc13xxx->flags & MC13XXX_USE_CODEC)
> + mc13xxx_add_subdevice(mc13xxx, "%s-codec");
> + if (mc13xxx->flags & MC13XXX_USE_TOUCHSCREEN)
> + mc13xxx_add_subdevice(mc13xxx, "%s-ts");
> mc13xxx_add_subdevice(mc13xxx, "%s-regulator");
> mc13xxx_add_subdevice(mc13xxx, "%s-led");
> mc13xxx_add_subdevice(mc13xxx, "%s-pwrbutton");
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
next prev parent reply other threads:[~2013-12-02 10:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-30 9:53 [PATCH RESEND] mfd: mc13xxx: Fix null pointer dereference in mc13xxx_common_init Alexander Shiyan
2013-12-02 8:30 ` Philippe Rétornaz
2013-12-02 10:54 ` Lee Jones [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-11-30 4:55 Alexander Shiyan
2013-11-30 9:34 ` Michael Grzeschik
2013-11-30 9:52 ` Alexander Shiyan
2013-12-02 10:56 ` Lee Jones
2013-12-02 11:11 ` Alexander Shiyan
2013-12-02 11:17 ` Lee Jones
2013-12-02 11:53 ` Michael Grzeschik
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=20131202105432.GC29373@lee--X1 \
--to=lee.jones@linaro.org \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.intel.com \
--cc=shawn.guo@linaro.org \
--cc=shc_work@mail.ru \
/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