Skip to contentSkip to conversation

Question on typec_unregister_altmode

DISCUSSION Shah, Nehal-bakulchandra 2 participants 2 messages Apr 15, 2021 USB

lore
Share & tools
lore
#0 lore raw

Hi Heikki,

While working on one of the project i have observed one potential issue with typec_unregister_altmode.

If we unregister partners altmode then following code may fail and give the crash.

typec_mux_put(to_altmode(adev)->mux);

As partner does not get the mux during the register alt mode only port register alt mode has it.

so i think adev->mux should be checked for NULL/invalida pointer. Please correct my understanding.

Regards

Nehal

#1 lore raw

Hi,

Quoted 5 lines · Nehal-bakulchandra

Hi Heikki,

While working on one of the project i have observed one potential issue with typec_unregister_altmode.

If we unregister partners altmode then following code may fail and give the crash.

What crash?

Quoted 5 lines

typec_mux_put(to_altmode(adev)->mux);

As partner does not get the mux during the register alt mode only port register alt mode has it.

so i think adev->mux should be checked for NULL/invalida pointer. Please correct my understanding.

If you check the implementation of typec_mux_put(), it already does that. I don't understand the problem you are seeing?

If you are seeing a crash, then there should be a backtrace. Can you please share that?

thanks,

Signature · 1 line
heikki