diff options
author | Kyle Tso <kyletso@google.com> | 2023-02-08 19:58:52 +0800 |
---|---|---|
committer | Kyle Tso <kyletso@google.com> | 2023-02-09 23:48:02 +0800 |
commit | 78f5d459fa38fdd3c0bb16cc6484b0bdb591fc17 (patch) | |
tree | 4c72811526bf7424cd304058ceaba0b63d5b738e | |
parent | 40318349dd9a54290a0388ca18cb6ad700abb97b (diff) | |
download | tangorpro-78f5d459fa38fdd3c0bb16cc6484b0bdb591fc17.tar.gz |
pogo_transport: Add EXTCON_NONE in the end of supported cables
When registering EXTCON, the last entry in the supported cable array
should be EXTCON_NONE. Otherwise, the cable array in the extcon device
might store the data from unexpected out-of-bound memory adjacent to
the supported cable array. This might cause null pointer dereference in
cable_name_show function in extcon.c.
Call trace:
cable_name_show+0xc0/0xcc
dev_attr_show+0x4c/0xa4
sysfs_kf_seq_show+0x114/0x224
kernfs_seq_show+0xa4/0x124
seq_read_iter+0x270/0x7b0
kernfs_fop_read_iter+0xbc/0x2a8
vfs_read+0x450/0x498
ksys_read+0xb0/0x144
Bug: 258382812
Change-Id: I0458c81c27ae90deedb81f37f085672e77194688
Signed-off-by: Kyle Tso <kyletso@google.com>
-rw-r--r-- | pogo/pogo_transport.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/pogo/pogo_transport.c b/pogo/pogo_transport.c index b070ac2..86ce2da 100644 --- a/pogo/pogo_transport.c +++ b/pogo/pogo_transport.c @@ -178,6 +178,7 @@ struct pogo_transport { static const unsigned int pogo_extcon_cable[] = { EXTCON_USB, EXTCON_DOCK, + EXTCON_NONE, }; static void pogo_transport_event(struct pogo_transport *pogo_transport, |