Message ID | 20170729010012.5032-1-brendanhiggins@google.com |
---|---|
State | Accepted |
Headers | show |
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 >
On Mon, Jul 31, 2017 at 2:27 AM, Joel Stanley <joel@jms.id.au> wrote: > 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? I am pretty sure we hit it in testing. Unfortunately, we had trouble reproducing it, but we did see a null pointer dereference. > > Cheers, > > Joel
On Fri, Jul 28, 2017 at 06:00:12PM -0700, Brendan Higgins 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> Is there a suitable "Fixes:" tag for this?
On Sat, Aug 12, 2017 at 9:02 PM, Wolfram Sang <wsa@the-dreams.de> wrote: > On Fri, Jul 28, 2017 at 06:00:12PM -0700, Brendan Higgins 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> > > Is there a suitable "Fixes:" tag for this? > The driver was introduced in 4.13, so we could add: Fixes: f327c686d3ba ("i2c: aspeed: added driver for Aspeed I2C") Cheers, Joel
On Fri, Jul 28, 2017 at 06:00:12PM -0700, Brendan Higgins 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> Applied to for-current, thanks!
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];
Before I skipped null checks when the master is in the STOP state; this fixes that. Signed-off-by: Brendan Higgins <brendanhiggins@google.com> --- drivers/i2c/busses/i2c-aspeed.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)