* [PATCH v1] i2c: aspeed: fixed potential null pointer dereference
@ 2017-07-29 1:00 Brendan Higgins
2017-07-31 9:27 ` Joel Stanley
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Brendan Higgins @ 2017-07-29 1:00 UTC (permalink / raw)
To: wsa, benh, joel, venture
Cc: linux-i2c, openbmc, linux-kernel, Brendan Higgins
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(-)
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1] i2c: aspeed: fixed potential null pointer dereference
2017-07-29 1:00 [PATCH v1] i2c: aspeed: fixed potential null pointer dereference Brendan Higgins
@ 2017-07-31 9:27 ` Joel Stanley
2017-07-31 18:20 ` Brendan Higgins
2017-08-12 11:32 ` Wolfram Sang
2017-08-14 20:09 ` Wolfram Sang
2 siblings, 1 reply; 6+ messages in thread
From: Joel Stanley @ 2017-07-31 9:27 UTC (permalink / raw)
To: Brendan Higgins
Cc: Wolfram Sang, Benjamin Herrenschmidt, Patrick Venture, linux-i2c,
OpenBMC Maillist, Linux Kernel Mailing List
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
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] i2c: aspeed: fixed potential null pointer dereference
2017-07-31 9:27 ` Joel Stanley
@ 2017-07-31 18:20 ` Brendan Higgins
0 siblings, 0 replies; 6+ messages in thread
From: Brendan Higgins @ 2017-07-31 18:20 UTC (permalink / raw)
To: Joel Stanley
Cc: Wolfram Sang, Benjamin Herrenschmidt, Patrick Venture, linux-i2c,
OpenBMC Maillist, Linux Kernel Mailing List
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] i2c: aspeed: fixed potential null pointer dereference
2017-07-29 1:00 [PATCH v1] i2c: aspeed: fixed potential null pointer dereference Brendan Higgins
2017-07-31 9:27 ` Joel Stanley
@ 2017-08-12 11:32 ` Wolfram Sang
2017-08-14 3:51 ` Joel Stanley
2017-08-14 20:09 ` Wolfram Sang
2 siblings, 1 reply; 6+ messages in thread
From: Wolfram Sang @ 2017-08-12 11:32 UTC (permalink / raw)
To: Brendan Higgins; +Cc: benh, joel, venture, linux-i2c, openbmc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 270 bytes --]
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?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] i2c: aspeed: fixed potential null pointer dereference
2017-08-12 11:32 ` Wolfram Sang
@ 2017-08-14 3:51 ` Joel Stanley
0 siblings, 0 replies; 6+ messages in thread
From: Joel Stanley @ 2017-08-14 3:51 UTC (permalink / raw)
To: Wolfram Sang
Cc: Brendan Higgins, Benjamin Herrenschmidt, Patrick Venture,
linux-i2c, OpenBMC Maillist, Linux Kernel Mailing List
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] i2c: aspeed: fixed potential null pointer dereference
2017-07-29 1:00 [PATCH v1] i2c: aspeed: fixed potential null pointer dereference Brendan Higgins
2017-07-31 9:27 ` Joel Stanley
2017-08-12 11:32 ` Wolfram Sang
@ 2017-08-14 20:09 ` Wolfram Sang
2 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2017-08-14 20:09 UTC (permalink / raw)
To: Brendan Higgins; +Cc: benh, joel, venture, linux-i2c, openbmc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 259 bytes --]
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!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-08-14 20:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-29 1:00 [PATCH v1] i2c: aspeed: fixed potential null pointer dereference Brendan Higgins
2017-07-31 9:27 ` Joel Stanley
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
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).