From: Kevin Hilman <khilman@baylibre.com>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
Carlo Caione <carlo@caione.org>,
linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] MMC: meson: avoid possible NULL dereference
Date: Fri, 06 Jan 2017 09:01:31 -0800 [thread overview]
Message-ID: <m237gwcec4.fsf@baylibre.com> (raw)
In-Reply-To: <20161223150108.9229-1-xypron.glpk@gmx.de> (Heinrich Schuchardt's message of "Fri, 23 Dec 2016 16:01:08 +0100")
Heinrich Schuchardt <xypron.glpk@gmx.de> writes:
> No actual segmentation faults were observed but the coding is
> at least inconsistent.
>
> irqreturn_t meson_mmc_irq():
>
> We should not dereference host before checking it.
>
> meson_mmc_irq_thread():
>
> If cmd or mrq are NULL we should not dereference them after
> writing a warning.
>
> Fixes: 51c5d8447bd7 MMC: meson: initial support for GX platforms
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Kevin Hilman <khilman@baylibre.com>
Ulf, I assume you can pick this up directly for v4.10-rc?
Thanks,
Kevin
> ---
> drivers/mmc/host/meson-gx-mmc.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
> index b352760c041e..09739352834c 100644
> --- a/drivers/mmc/host/meson-gx-mmc.c
> +++ b/drivers/mmc/host/meson-gx-mmc.c
> @@ -578,13 +578,15 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
> {
> struct meson_host *host = dev_id;
> struct mmc_request *mrq;
> - struct mmc_command *cmd = host->cmd;
> + struct mmc_command *cmd;
> u32 irq_en, status, raw_status;
> irqreturn_t ret = IRQ_HANDLED;
>
> if (WARN_ON(!host))
> return IRQ_NONE;
>
> + cmd = host->cmd;
> +
> mrq = host->mrq;
>
> if (WARN_ON(!mrq))
> @@ -670,10 +672,10 @@ static irqreturn_t meson_mmc_irq_thread(int irq, void *dev_id)
> int ret = IRQ_HANDLED;
>
> if (WARN_ON(!mrq))
> - ret = IRQ_NONE;
> + return IRQ_NONE;
>
> if (WARN_ON(!cmd))
> - ret = IRQ_NONE;
> + return IRQ_NONE;
>
> data = cmd->data;
> if (data) {
next prev parent reply other threads:[~2017-01-06 17:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-23 15:01 [PATCH 1/1] MMC: meson: avoid possible NULL dereference Heinrich Schuchardt
2017-01-06 17:01 ` Kevin Hilman [this message]
2017-01-10 15:38 ` Ulf Hansson
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=m237gwcec4.fsf@baylibre.com \
--to=khilman@baylibre.com \
--cc=carlo@caione.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=xypron.glpk@gmx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox