mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
i2c: i2c-msm-geni: NULL check before accessing i2c message
This change adds a NULL pointer check for i2c rx callback function. In some corner case and rare scenario, it may happen that delayed callback from GSI for any unexpected sequence can result into accessing stale message pointer which can be NULL. Actual root cause should be found but this adds a protection check. Change-Id: Iab2196812289026674ee3b26d27c4f20a01bbda2 Signed-off-by: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com>
This commit is contained in:
parent
70e9561de3
commit
894ebb20b0
1 changed files with 7 additions and 0 deletions
|
|
@ -513,6 +513,13 @@ static void gi2c_gsi_rx_cb(void *ptr)
|
|||
struct msm_gpi_dma_async_tx_cb_param *rx_cb = ptr;
|
||||
struct geni_i2c_dev *gi2c = rx_cb->userdata;
|
||||
|
||||
if (gi2c->cur == NULL) {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"%s: Error: unexpected callback\n", __func__);
|
||||
WARN_ON(1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (gi2c->cur->flags & I2C_M_RD) {
|
||||
gi2c_gsi_cb_err(rx_cb, "RX");
|
||||
complete(&gi2c->xfer);
|
||||
|
|
|
|||
Loading…
Reference in a new issue