]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
UBUNTU: SAUCE: i2c:amd move out pointer in union i2c_event_base
authorKai-Heng Feng <kai.heng.feng@canonical.com>
Thu, 19 Jul 2018 10:19:00 +0000 (12:19 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 5 Sep 2018 08:30:45 +0000 (10:30 +0200)
commit8a9dee1fe664e9d103541e3f7d0fefa895c4d1d0
treecb6d2833332943d15a94494f2901d1c75a847369
parente95ed23bf2999f11c5dadc88c3c8de8be0cbe61e
UBUNTU: SAUCE: i2c:amd move out pointer in union i2c_event_base

BugLink: https://bugs.launchpad.net/bugs/1773940
"Unable to handle kernel paging request" occurs at this line of code:
         privdata->eventval.buf[i] = readdata;

The pointer "buf" in union "i2c_event_base" will change its value as
soon as any union member gets modified. We can observe this behaviour in
amd_mp2_irq_isr(). This makes buf points to the wrong place, and causes
the trouble we saw when it gets accessed.

Put pointer inside union is not a good idea, so refactor the structure
to make sure the pointer and the union do not overlap.

Also remove the NULL check for eventval.buf, as its value comes from
read_cfg.buf.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: AceLan Kao <acelan.kao@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/i2c/busses/i2c-amd-pci-mp2.c
drivers/i2c/busses/i2c-amd-pci-mp2.h
drivers/i2c/busses/i2c-amd-platdrv.c