]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
usb: typec: tcpm: fix logbuffer index is wrong if _tcpm_log is re-entered
authorPeter Chen <peter.chen@nxp.com>
Tue, 12 Jun 2018 01:53:01 +0000 (09:53 +0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 14 Jan 2019 09:28:55 +0000 (09:28 +0000)
commit3a3d251d91b6b7773f2eb4f0ace26c8be29fc1ff
treecf57d29b2d615ac9b4ac18f9620f5445e171fe1a
parent57075acf38593dbef6c60aab15254f4c916f1d8d
usb: typec: tcpm: fix logbuffer index is wrong if _tcpm_log is re-entered

BugLink: http://bugs.launchpad.net/bugs/1808185
commit d5a4f93511b7000183c0d528739b824752139f79 upstream.

The port->logbuffer_head may be wrong if the two processes enters
_tcpm_log at the mostly same time. The 2nd process enters _tcpm_log
before the 1st process update the index, then the 2nd process will
not allocate logbuffer, when the 2nd process tries to use log buffer,
the index has already updated by the 1st process, so it will get
NULL pointer for updated logbuffer, the error message like below:

tcpci 0-0050: Log buffer index 6 is NULL

Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/usb/typec/tcpm.c