diff options
author | Wai-Hong Tam <waihong@google.com> | 2020-09-28 15:07:47 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-10-01 17:21:20 +0000 |
commit | ba00ece0ac06e38edb3f1ab8d82ef5829f4ca77f (patch) | |
tree | d4bc0c6f46813d400bc42851865c7015e1c4e921 | |
parent | 7da15e7ac1eb949eceeac8bbd5146ffc75dab01f (diff) | |
download | chrome-ec-ba00ece0ac06e38edb3f1ab8d82ef5829f4ca77f.tar.gz |
TCPMv2: Fix dereferencing a NULL pointer
Some monitors or dongles may not follow the spec that sends a 'DP
Status' VDM to the Chromebook. The 'DP Status' VDM is supposed to
send from a DP source, not a DP sink. When the Chromebook receives
this message, the dereference of a NULL pointer is triggered and
EC crashes. Should ignore this assignment and leave it NULL so the
Chromebook later NACK's the VDM message.
BRANCH=None
BUG=b:169611334
TEST=Build the image.
Change-Id: I7bf80229be0c6ca20aa1eac63db762b3e4a9d683
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2437189
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Scott Collyer <scollyer@chromium.org>
-rw-r--r-- | common/usbc/usb_pe_drp_sm.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c index 45074126f3..7f8127b1b9 100644 --- a/common/usbc/usb_pe_drp_sm.c +++ b/common/usbc/usb_pe_drp_sm.c @@ -5281,10 +5281,12 @@ static void pe_vdm_response_entry(int port) func = svdm_rsp.enter_mode; break; case CMD_DP_STATUS: - func = svdm_rsp.amode->status; + if (svdm_rsp.amode) + func = svdm_rsp.amode->status; break; case CMD_DP_CONFIG: - func = svdm_rsp.amode->config; + if (svdm_rsp.amode) + func = svdm_rsp.amode->config; break; case CMD_EXIT_MODE: vdo_opos = PD_VDO_OPOS(rx_payload[0]); |