On Mon, Feb 24, 2020 at 02:38:12PM +0530, Shah, Nehal-bakulchandra wrote: > Hi > > On 2/14/2020 7:58 PM, Shah, Nehal-bakulchandra wrote: > > Hi > > > > On 2/13/2020 5:35 PM, Heikki Krogerus wrote: > >> On Thu, Feb 13, 2020 at 02:00:14PM +0200, Heikki Krogerus wrote: > >>>> I am using CCG based UCSI driver without any > >>>> modification.For I2C part i have written custom > >>>> driver. > >>>> > >>>> I have attached the trace out and dmesg crash log. > >>>> > >>>> Please have a look > >>> Thanks for the logs. Can you test the attached diff? > >> Actually, don't try that one. Try this one instead. > > Sure i will update on this on Monday. > > > > > > thanks > > > > Nehal > > Patch is not solving the issue. I have attached both trace and dmesg output. How about if you try this (the attached patch) together with that previous diff? thanks, -- heikki
>From fa1aff5e8e7464851470f29eeae45bde1f089ce1 Mon Sep 17 00:00:00 2001 From: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx> Date: Mon, 17 Feb 2020 18:07:17 +0300 Subject: [PATCH] usb: typec: ucsi: displayport: Fix potential NULL pointer dereference In ucsi_displayport_remove_partner(), if the DisplayPort alt mode was never registered, then there is also no driver data for it. Adding a check to make sure there really is driver data for the device before modifying it. Signed-off-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx> --- drivers/usb/typec/ucsi/displayport.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/typec/ucsi/displayport.c b/drivers/usb/typec/ucsi/displayport.c index 0f1273ae086c..261131c9e37c 100644 --- a/drivers/usb/typec/ucsi/displayport.c +++ b/drivers/usb/typec/ucsi/displayport.c @@ -271,6 +271,9 @@ void ucsi_displayport_remove_partner(struct typec_altmode *alt) return; dp = typec_altmode_get_drvdata(alt); + if (!dp) + return; + dp->data.conf = 0; dp->data.status = 0; dp->initialized = false; -- 2.25.0