public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* Question on typec_unregister_altmode
@ 2021-04-15 10:49 Shah, Nehal-bakulchandra
  2021-04-15 11:06 ` Heikki Krogerus
  0 siblings, 1 reply; 2+ messages in thread
From: Shah, Nehal-bakulchandra @ 2021-04-15 10:49 UTC (permalink / raw)
  To: Heikki Krogerus; +Cc: linux-usb, basavaraj.natikar

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Question on typec_unregister_altmode
  2021-04-15 10:49 Question on typec_unregister_altmode Shah, Nehal-bakulchandra
@ 2021-04-15 11:06 ` Heikki Krogerus
  0 siblings, 0 replies; 2+ messages in thread
From: Heikki Krogerus @ 2021-04-15 11:06 UTC (permalink / raw)
  To: Shah, Nehal-bakulchandra; +Cc: linux-usb, basavaraj.natikar

Hi,

On Thu, Apr 15, 2021 at 04:19:06PM +0530, Shah, Nehal-bakulchandra wrote:
> 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?

> 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,

-- 
heikki

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-15 11:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-15 10:49 Question on typec_unregister_altmode Shah, Nehal-bakulchandra
2021-04-15 11:06 ` Heikki Krogerus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox