mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 15:11:48 -04:00
msm: mhi-dev: Check to avoid null pointer dereference
If mhi is not enabled the channels ring remain uninitialized. The host might reset mhi which will result in device crash due to null pointer dereference for the channel ring. Check if the pointer is NULL before dereferencing it to avoid the crash. Change-Id: I582f9a8a6c9bdca8d5f57e1800b566cca389b830 Signed-off-by: Gauri Joshi <gaurjosh@codeaurora.org>
This commit is contained in:
parent
c7f857a07a
commit
0b5165ee1a
1 changed files with 1 additions and 2 deletions
|
|
@ -2359,9 +2359,8 @@ static int mhi_dev_abort(struct mhi_dev *mhi)
|
|||
/* Hard stop all the channels */
|
||||
for (ch_id = 0; ch_id < mhi->cfg.channels; ch_id++) {
|
||||
ring = &mhi->ring[ch_id + mhi->ch_ring_start];
|
||||
if (ring->state == RING_STATE_UINT)
|
||||
if (!ring || ring->state == RING_STATE_UINT)
|
||||
continue;
|
||||
|
||||
ch = &mhi->ch[ch_id];
|
||||
mutex_lock(&ch->ch_lock);
|
||||
mhi->ch[ch_id].state = MHI_DEV_CH_STOPPED;
|
||||
|
|
|
|||
Loading…
Reference in a new issue