linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joel Stanley <joel@jms.id.au>
To: Brendan Higgins <brendanhiggins@google.com>
Cc: Wolfram Sang <wsa@the-dreams.de>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Patrick Venture <venture@google.com>,
	linux-i2c@vger.kernel.org,
	OpenBMC Maillist <openbmc@lists.ozlabs.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] i2c: aspeed: fixed potential null pointer dereference
Date: Mon, 31 Jul 2017 18:57:09 +0930	[thread overview]
Message-ID: <CACPK8XdT5yxKFj75JCuXZ+3GT1Q6x0EYADmFdu6we6SHwTMnLw@mail.gmail.com> (raw)
In-Reply-To: <20170729010012.5032-1-brendanhiggins@google.com>

On Sat, Jul 29, 2017 at 10:30 AM, Brendan Higgins
<brendanhiggins@google.com> wrote:
> Before I skipped null checks when the master is in the STOP state; this
> fixes that.
>
> Signed-off-by: Brendan Higgins <brendanhiggins@google.com>

Acked-by: Joel Stanley <joel@jms.id.au>

Out of interest, was this found by code review, or did you hit this in testing?

Cheers,

Joel

> ---
>  drivers/i2c/busses/i2c-aspeed.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
> index f19348328a71..6fdf9231c23c 100644
> --- a/drivers/i2c/busses/i2c-aspeed.c
> +++ b/drivers/i2c/busses/i2c-aspeed.c
> @@ -410,10 +410,11 @@ static bool aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus)
>         }
>
>         /* We are in an invalid state; reset bus to a known state. */
> -       if (!bus->msgs && bus->master_state != ASPEED_I2C_MASTER_STOP) {
> +       if (!bus->msgs) {
>                 dev_err(bus->dev, "bus in unknown state");
>                 bus->cmd_err = -EIO;
> -               aspeed_i2c_do_stop(bus);
> +               if (bus->master_state != ASPEED_I2C_MASTER_STOP)
> +                       aspeed_i2c_do_stop(bus);
>                 goto out_no_complete;
>         }
>         msg = &bus->msgs[bus->msgs_index];
> --
> 2.14.0.rc0.400.g1c36432dff-goog
>

  reply	other threads:[~2017-07-31  9:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-29  1:00 [PATCH v1] i2c: aspeed: fixed potential null pointer dereference Brendan Higgins
2017-07-31  9:27 ` Joel Stanley [this message]
2017-07-31 18:20   ` Brendan Higgins
2017-08-12 11:32 ` Wolfram Sang
2017-08-14  3:51   ` Joel Stanley
2017-08-14 20:09 ` Wolfram Sang

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=CACPK8XdT5yxKFj75JCuXZ+3GT1Q6x0EYADmFdu6we6SHwTMnLw@mail.gmail.com \
    --to=joel@jms.id.au \
    --cc=benh@kernel.crashing.org \
    --cc=brendanhiggins@google.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=venture@google.com \
    --cc=wsa@the-dreams.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;
as well as URLs for NNTP newsgroup(s).