All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Vladimir Yerilov <openmindead@gmail.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: kernel NULL pointer dereference, ucsi bug
Date: Wed, 12 Jun 2019 12:55:32 +0300	[thread overview]
Message-ID: <20190612095532.GB19831@kuha.fi.intel.com> (raw)
In-Reply-To: <CAB31r6V+PYppYJz29u_hfpiL6xqhhe+-2xZTRpqOmpLrtCdh8Q@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1501 bytes --]

On Tue, Jun 11, 2019 at 10:19:27PM +1000, Vladimir Yerilov wrote:
> Hi Heikki,
> 
> > What do you have connected to the USB Type-C connectors on the
> machine when that happens?
> 
> Now, on 5.2-rc4, it happens only during boot and when power cord is
> connected to laptop's type-c charging port. Another port, which does
> not support charging, does not cause this problem, I mean I can have
> something connected to it or not, no issue is observed if charger is
> disconnected. I even tried to connect my hub to the guilty charging
> port, everything works fine until hub is powered from the charger, in
> that case the bug happens again. This differs from my previous tests
> when whatever I had connected to the charging port, caused failures,
> even type C to A OTG cable. To summarize: now it happens when power
> cord from the charger is connected during the boot, but if I connect
> it after boot (e.g. after logging in to my X session), no crash
> occurs.
> 
> > Can you use the machine normally when nothing is connected to the USB Type-C connectors
> 
> Yeah, everything is great when nothing is connected to the faulty
> charging port during the boot, and charger may be connected later, but
> it's kinda... wrong.
> 
> > Is it possible to send complete dmesg output after that happened?
> 
> You can find everything attached (done with journalctl -k -xb)

Thanks. I don't see anything the driver is doing wrong. I'm attaching
a patch. Can you test if it fixes the issue?

Br,

-- 
heikki

[-- Attachment #2: 0001-usb-typec-Make-sure-an-alt-mode-exist-before-getting.patch --]
[-- Type: text/plain, Size: 993 bytes --]

From d6979950ee911194dab9ae7513fe36dc3730f7a9 Mon Sep 17 00:00:00 2001
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Date: Tue, 11 Jun 2019 11:10:25 +0300
Subject: [PATCH] usb: typec: Make sure an alt mode exist before getting its
 partner

Interim. For testing only!

Adding check to typec_altmode_get_partner() to prevent
potential NULL pointer dereference.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/usb/typec/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/typec/bus.c b/drivers/usb/typec/bus.c
index 76299b6ff06d..74cb3c2ecb34 100644
--- a/drivers/usb/typec/bus.c
+++ b/drivers/usb/typec/bus.c
@@ -192,7 +192,7 @@ EXPORT_SYMBOL_GPL(typec_altmode_vdm);
 const struct typec_altmode *
 typec_altmode_get_partner(struct typec_altmode *adev)
 {
-	return &to_altmode(adev)->partner->adev;
+	return adev ? &to_altmode(adev)->partner->adev : NULL;
 }
 EXPORT_SYMBOL_GPL(typec_altmode_get_partner);
 
-- 
2.20.1


  parent reply	other threads:[~2019-06-12  9:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-02 11:24 kernel NULL pointer dereference, ucsi bug Vladimir Yerilov
2019-06-03 13:12 ` Greg KH
2019-06-03 14:58   ` Vladimir Yerilov
2019-06-04  5:40     ` Greg KH
2019-06-05  6:36       ` Vladimir Yerilov
2019-06-05 16:58         ` Greg KH
2019-06-06  9:36           ` Vladimir Yerilov
2019-06-06 16:58           ` Vladimir Yerilov
2019-06-10  3:48             ` Vladimir Yerilov
2019-06-10 14:32             ` Greg KH
2019-06-10 14:57               ` Vladimir Yerilov
2019-06-11  7:06               ` Heikki Krogerus
2019-06-11  7:54 ` Heikki Krogerus
     [not found]   ` <CAB31r6V+PYppYJz29u_hfpiL6xqhhe+-2xZTRpqOmpLrtCdh8Q@mail.gmail.com>
2019-06-12  9:55     ` Heikki Krogerus [this message]
2019-06-12 12:23       ` Vladimir Yerilov
2019-06-12 12:32         ` Greg KH
2019-06-12 12:57           ` Vladimir Yerilov
2019-06-12 14:05             ` Heikki Krogerus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190612095532.GB19831@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=openmindead@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.