diff options
author | Nicolas Boichat <drinkcat@google.com> | 2016-05-31 10:13:13 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-06-01 11:25:46 -0700 |
commit | c3463c7f5d4a80bc8992b6a1f695e49739fbd012 (patch) | |
tree | 6a132af67b0ce5102d4079c032abee38a1a76378 | |
parent | b6576ce2db7840f59ab330f1f3721a299c3d8cf8 (diff) | |
download | chrome-ec-c3463c7f5d4a80bc8992b6a1f695e49739fbd012.tar.gz |
common/i2c: Fix I2C protection for i2c read/write commands
i2cread/i2cwrite takes 8-bit addresses, while i2cxfer takes 7-bit
addresses, make sure we filter on the correct address.
BRANCH=none
BUG=chrome-os-partner:52431
TEST=Book elm-rev1
Change-Id: I84dbc8468d7a8401673c90118f5799b3ff75c2e1
Signed-off-by: Nicolas Boichat <drinkcat@google.com>
Reviewed-on: https://chromium-review.googlesource.com/348153
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | common/i2c.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/i2c.c b/common/i2c.c index 03d7e2b9c6..51de07dd92 100644 --- a/common/i2c.c +++ b/common/i2c.c @@ -483,7 +483,7 @@ static int i2c_command_read(struct host_cmd_handler_args *args) return EC_RES_INVALID_PARAM; if (port_protected[p->port] && i2c_port->passthru_allowed) { - if (!i2c_port->passthru_allowed(i2c_port, p->addr)) + if (!i2c_port->passthru_allowed(i2c_port, p->addr >> 1)) return EC_RES_ACCESS_DENIED; } @@ -517,7 +517,7 @@ static int i2c_command_write(struct host_cmd_handler_args *args) return EC_RES_INVALID_PARAM; if (port_protected[p->port] && i2c_port->passthru_allowed) { - if (!i2c_port->passthru_allowed(i2c_port, p->addr)) + if (!i2c_port->passthru_allowed(i2c_port, p->addr >> 1)) return EC_RES_ACCESS_DENIED; } |