Linux v5.5.13
This commit is contained in:
parent
98bf49ad0d
commit
24e8702e2e
4 changed files with 8 additions and 349 deletions
|
|
@ -1,77 +0,0 @@
|
|||
From 6d390e4b5d48ec03bb87e63cf0a2bff5f4e116da Mon Sep 17 00:00:00 2001
|
||||
From: yangerkun <yangerkun@huawei.com>
|
||||
Date: Wed, 4 Mar 2020 15:25:56 +0800
|
||||
Subject: [PATCH] locks: fix a potential use-after-free problem when wakeup a
|
||||
waiter
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
'16306a61d3b7 ("fs/locks: always delete_block after waiting.")' add the
|
||||
logic to check waiter->fl_blocker without blocked_lock_lock. And it will
|
||||
trigger a UAF when we try to wakeup some waiter:
|
||||
|
||||
Thread 1 has create a write flock a on file, and now thread 2 try to
|
||||
unlock and delete flock a, thread 3 try to add flock b on the same file.
|
||||
|
||||
Thread2 Thread3
|
||||
flock syscall(create flock b)
|
||||
...flock_lock_inode_wait
|
||||
flock_lock_inode(will insert
|
||||
our fl_blocked_member list
|
||||
to flock a's fl_blocked_requests)
|
||||
sleep
|
||||
flock syscall(unlock)
|
||||
...flock_lock_inode_wait
|
||||
locks_delete_lock_ctx
|
||||
...__locks_wake_up_blocks
|
||||
__locks_delete_blocks(
|
||||
b->fl_blocker = NULL)
|
||||
...
|
||||
break by a signal
|
||||
locks_delete_block
|
||||
b->fl_blocker == NULL &&
|
||||
list_empty(&b->fl_blocked_requests)
|
||||
success, return directly
|
||||
locks_free_lock b
|
||||
wake_up(&b->fl_waiter)
|
||||
trigger UAF
|
||||
|
||||
Fix it by remove this logic, and this patch may also fix CVE-2019-19769.
|
||||
|
||||
Cc: stable@vger.kernel.org
|
||||
Fixes: 16306a61d3b7 ("fs/locks: always delete_block after waiting.")
|
||||
Signed-off-by: yangerkun <yangerkun@huawei.com>
|
||||
Signed-off-by: Jeff Layton <jlayton@kernel.org>
|
||||
---
|
||||
fs/locks.c | 14 --------------
|
||||
1 file changed, 14 deletions(-)
|
||||
|
||||
diff --git a/fs/locks.c b/fs/locks.c
|
||||
index 44b6da032842..426b55d333d5 100644
|
||||
--- a/fs/locks.c
|
||||
+++ b/fs/locks.c
|
||||
@@ -753,20 +753,6 @@ int locks_delete_block(struct file_lock *waiter)
|
||||
{
|
||||
int status = -ENOENT;
|
||||
|
||||
- /*
|
||||
- * If fl_blocker is NULL, it won't be set again as this thread
|
||||
- * "owns" the lock and is the only one that might try to claim
|
||||
- * the lock. So it is safe to test fl_blocker locklessly.
|
||||
- * Also if fl_blocker is NULL, this waiter is not listed on
|
||||
- * fl_blocked_requests for some lock, so no other request can
|
||||
- * be added to the list of fl_blocked_requests for this
|
||||
- * request. So if fl_blocker is NULL, it is safe to
|
||||
- * locklessly check if fl_blocked_requests is empty. If both
|
||||
- * of these checks succeed, there is no need to take the lock.
|
||||
- */
|
||||
- if (waiter->fl_blocker == NULL &&
|
||||
- list_empty(&waiter->fl_blocked_requests))
|
||||
- return status;
|
||||
spin_lock(&blocked_lock_lock);
|
||||
if (waiter->fl_blocker)
|
||||
status = 0;
|
||||
--
|
||||
2.25.2
|
||||
|
||||
14
kernel.spec
14
kernel.spec
|
|
@ -89,7 +89,7 @@ Summary: The Linux kernel
|
|||
%if 0%{?released_kernel}
|
||||
|
||||
# Do we have a -stable update to apply?
|
||||
%define stable_update 11
|
||||
%define stable_update 13
|
||||
# Set rpm version accordingly
|
||||
%if 0%{?stable_update}
|
||||
%define stablerev %{stable_update}
|
||||
|
|
@ -864,12 +864,6 @@ Patch508: 20200310_chris_chris_wilson_co_uk.patch
|
|||
# Backport vboxsf from 5.6, can be dropped when we move to 5.6
|
||||
Patch510: 0001-fs-Add-VirtualBox-guest-shared-folder-vboxsf-support.patch
|
||||
|
||||
# Fix UCSI oopses, (rhbz 1785972) (in gkh's usb-linus, heading towards mainline)
|
||||
Patch514: ucsi-oops-fixes.patch
|
||||
|
||||
# CVE-2019-19769 rhbz 1786174 1786175
|
||||
Patch515: 0001-locks-fix-a-potential-use-after-free-problem-when-wa.patch
|
||||
|
||||
# END OF PATCH DEFINITIONS
|
||||
|
||||
%endif
|
||||
|
|
@ -2899,6 +2893,12 @@ fi
|
|||
#
|
||||
#
|
||||
%changelog
|
||||
* Wed Mar 25 2020 Justin M. Forbes <jforbes@fedoraproject.org> - 5.5.13-200
|
||||
- Linux v5.5.13
|
||||
|
||||
* Wed Mar 25 2020 Justin M. Forbes <jforbes@fedoraproject.org> - 5.5.12-200
|
||||
- Linux v5.5.12
|
||||
|
||||
* Mon Mar 23 2020 Justin M. Forbes <jforbes@fedoraproject.org> - 5.5.11-200
|
||||
- Linux v5.5.11
|
||||
|
||||
|
|
|
|||
2
sources
2
sources
|
|
@ -1,2 +1,2 @@
|
|||
SHA512 (linux-5.5.tar.xz) = fa74fdabb5e63384a39e54da05b86a9ae9ea16179524b041fbbdffc7177e80b53600ae98d76be127ba216148f9dc55fe07ab20637e22c6d6030cb4aa09eb2f86
|
||||
SHA512 (patch-5.5.11.xz) = f90bd8a926d8fd0afd2aa6c97dcd9c1bf181290abda039cc453769092dd936b21ae68280a197aa5ab0b1afc78b1c4a3f5c8e2526511bcedefd19f7ecca244862
|
||||
SHA512 (patch-5.5.13.xz) = 22ff73b07ef89cc61950d929d99cabba42b2678e4e08a981e5bc61aae9523637626e779ce718eb55e27568479db2db483eee4fe042e36f70335b6b74886950a5
|
||||
|
|
|
|||
|
|
@ -1,264 +0,0 @@
|
|||
Delivered-To: hdegoede@gapps.redhat.com
|
||||
Received: by 2002:ac9:3cca:0:0:0:0:0 with SMTP id x10csp668580ocf;
|
||||
Wed, 11 Mar 2020 06:00:20 -0700 (PDT)
|
||||
X-Google-Smtp-Source: ADFU+vvLKVQ2NCRrbKk+46iEGOgL/dp5kNAySiFCE1BMXIcEIQUMJiy8VDfxwzkL4b/KDmsigoak
|
||||
X-Received: by 2002:a25:6806:: with SMTP id d6mr2754667ybc.326.1583931620742;
|
||||
Wed, 11 Mar 2020 06:00:20 -0700 (PDT)
|
||||
ARC-Seal: i=1; a=rsa-sha256; t=1583931620; cv=none;
|
||||
d=google.com; s=arc-20160816;
|
||||
b=GRQ4h+cMvCbklF6XW5Q2mltKo9tJfib6QJHpNf6iNAtnlnvES/vRFnJJTCa601ohr9
|
||||
C/HY4T0/cN46QA/mdPDIQz1+CMUnRpi7PDYoLeoc8TUMaPY/PU7QG3eQB6Mc8qP608Y9
|
||||
72lCJ+R+IEaXBUgNAmtiD1DB3C2bi8EctnvQN6JxfAAUU6Qp802Ru2kxmAI24d4GVjF9
|
||||
+FweOPG0cKBTdc8Al2jDyW7BIlYxtbSa1T/CvPUoNznd7ojx7uzwYegsvvfP9gicpzVa
|
||||
fEoH1Bhxvx/qURM0GfOO6xsxAX1jG8c58JGoNZLWYCqfA3p/k4FgsLtrWxIHDHC/FG+0
|
||||
PGGg==
|
||||
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
|
||||
h=content-transfer-encoding:mime-version:references:in-reply-to
|
||||
:message-id:date:subject:cc:to:from:delivered-to;
|
||||
bh=QqHHD8kGkQgrKZCRDMePpiviR2jnsd9jIjJ3n7LCR5M=;
|
||||
b=ycs3X68dm/6atsaad09LdioLoV+Js6lfsdgJsmymghQw7Wtld2MRz3STNMD1QcCD90
|
||||
sYGhDb0ilsba4RKe2G6hoXDLAau1VFSS6Yam9htpytW2hdea/r1nIG6W1m03UZtZ1wsA
|
||||
da/jufsdUKNhcKmZJs5Ok0Zk9c3F6Zt/h0IemuKwfFolV6q2EpfpogUH7DQsVZXWEKND
|
||||
l+apv3mjYqv5rJBRVY1q0H4/pNVuptRX+2Srnj5Siz+982kSAAGgb3WFB3AsS7RyklgX
|
||||
1Ho+CIco+U0d1wHM9BXylsjvLLjQRQOMklWXHm1qqXPQ0ybhClJmED5sJIr/Jf4mJ0KB
|
||||
A1Ng==
|
||||
ARC-Authentication-Results: i=1; mx.google.com;
|
||||
spf=pass (google.com: best guess record for domain of heikki.krogerus@linux.intel.com designates 134.134.136.126 as permitted sender) smtp.mailfrom=heikki.krogerus@linux.intel.com
|
||||
Return-Path: <heikki.krogerus@linux.intel.com>
|
||||
Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com. [205.139.110.61])
|
||||
by mx.google.com with ESMTPS id a15si1271762ybk.78.2020.03.11.06.00.20
|
||||
for <hdegoede@gapps.redhat.com>
|
||||
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
|
||||
Wed, 11 Mar 2020 06:00:20 -0700 (PDT)
|
||||
Received-SPF: pass (google.com: best guess record for domain of heikki.krogerus@linux.intel.com designates 134.134.136.126 as permitted sender) client-ip=134.134.136.126;
|
||||
Authentication-Results: mx.google.com;
|
||||
spf=pass (google.com: best guess record for domain of heikki.krogerus@linux.intel.com designates 134.134.136.126 as permitted sender) smtp.mailfrom=heikki.krogerus@linux.intel.com
|
||||
Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
|
||||
[66.187.233.88]) (Using TLS) by relay.mimecast.com with ESMTP id
|
||||
us-mta-456-lABK24RoPMylyDoOfppDdw-1; Wed, 11 Mar 2020 09:00:19 -0400
|
||||
X-MC-Unique: lABK24RoPMylyDoOfppDdw-1
|
||||
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3])
|
||||
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
|
||||
(No client certificate requested)
|
||||
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F06A8185A795
|
||||
for <hdegoede@gapps.redhat.com>; Wed, 11 Mar 2020 13:00:18 +0000 (UTC)
|
||||
Received: by smtp.corp.redhat.com (Postfix)
|
||||
id ED3AF1134CD6; Wed, 11 Mar 2020 13:00:18 +0000 (UTC)
|
||||
Delivered-To: hdegoede@redhat.com
|
||||
Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19])
|
||||
by smtp.corp.redhat.com (Postfix) with ESMTPS id E8DE21134CC1
|
||||
for <hdegoede@redhat.com>; Wed, 11 Mar 2020 13:00:18 +0000 (UTC)
|
||||
Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120])
|
||||
(using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits))
|
||||
(No client certificate requested)
|
||||
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D4F1980030B
|
||||
for <hdegoede@redhat.com>; Wed, 11 Mar 2020 13:00:18 +0000 (UTC)
|
||||
Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (Using
|
||||
TLS) by relay.mimecast.com with ESMTP id
|
||||
us-mta-396-cq2xxB_jPiKPJtJzTaqmBA-2; Wed, 11 Mar 2020 09:00:13 -0400
|
||||
X-MC-Unique: cq2xxB_jPiKPJtJzTaqmBA-2
|
||||
X-Amp-Result: SKIPPED(no attachment in message)
|
||||
X-Amp-File-Uploaded: False
|
||||
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
|
||||
by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Mar 2020 06:00:11 -0700
|
||||
X-ExtLoop1: 1
|
||||
X-IronPort-AV: E=Sophos;i="5.70,540,1574150400";
|
||||
d="scan'208";a="353878525"
|
||||
Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28])
|
||||
by fmsmga001.fm.intel.com with ESMTP; 11 Mar 2020 06:00:09 -0700
|
||||
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
|
||||
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Cc: Hans de Goede <hdegoede@redhat.com>,
|
||||
linux-usb@vger.kernel.org,
|
||||
stable@vger.kernel.org
|
||||
Subject: [PATCH 1/2] usb: typec: ucsi: displayport: Fix NULL pointer dereference
|
||||
Date: Wed, 11 Mar 2020 16:00:05 +0300
|
||||
Message-Id: <20200311130006.41288-2-heikki.krogerus@linux.intel.com>
|
||||
In-Reply-To: <20200311130006.41288-1-heikki.krogerus@linux.intel.com>
|
||||
References: <20200311130006.41288-1-heikki.krogerus@linux.intel.com>
|
||||
MIME-Version: 1.0
|
||||
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3
|
||||
X-Mimecast-Spam-Score: 0
|
||||
X-Mimecast-Originator: linux.intel.com
|
||||
Content-Type: text/plain; charset=WINDOWS-1252
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
|
||||
If the registration of the DisplayPort was not successful,
|
||||
or if the port does not support DisplayPort alt mode in the
|
||||
first place, the function ucsi_displayport_remove_partner()
|
||||
will fail with NULL pointer dereference when it attempts to
|
||||
access the driver data.
|
||||
|
||||
Adding a check to the function to make sure there really is
|
||||
driver data for the device before modifying it.
|
||||
|
||||
Fixes: af8622f6a585 ("usb: typec: ucsi: Support for DisplayPort alt mode")
|
||||
Reported-by: Andrea Gagliardi La Gala <andrea.lagala@gmail.com>
|
||||
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=3D206365
|
||||
Cc: stable@vger.kernel.org
|
||||
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
|
||||
---
|
||||
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_altmo=
|
||||
de *alt)
|
||||
=09=09return;
|
||||
=20
|
||||
=09dp =3D typec_altmode_get_drvdata(alt);
|
||||
+=09if (!dp)
|
||||
+=09=09return;
|
||||
+
|
||||
=09dp->data.conf =3D 0;
|
||||
=09dp->data.status =3D 0;
|
||||
=09dp->initialized =3D false;
|
||||
--=20
|
||||
2.25.1
|
||||
|
||||
Delivered-To: hdegoede@gapps.redhat.com
|
||||
Received: by 2002:ac9:3cca:0:0:0:0:0 with SMTP id x10csp668601ocf;
|
||||
Wed, 11 Mar 2020 06:00:21 -0700 (PDT)
|
||||
X-Google-Smtp-Source: ADFU+vsGhdWLjQ3QpxqWj6WbYOo0YlQLm+xaXhCA9qDlbUCuTwO0DTYoUpCtv/Wic/3KISqZC1e0
|
||||
X-Received: by 2002:a17:906:90d9:: with SMTP id v25mr2356602ejw.73.1583931621591;
|
||||
Wed, 11 Mar 2020 06:00:21 -0700 (PDT)
|
||||
ARC-Seal: i=1; a=rsa-sha256; t=1583931621; cv=none;
|
||||
d=google.com; s=arc-20160816;
|
||||
b=TLDfI22LVNxWmkmYrQN2uyHHPtPhg7WoBmf4iRg+OckIGdycsI9lsHbEayPwTnavnh
|
||||
zh/vP7ADiHK/CgvjRmi23hCcrqZchwKPBXKVGyfsW3uVNSuKzUHc/hvUeH4kyDpUkYei
|
||||
DYmbgn+d4egWgMwPcnILYiOOXOVCRXM5fx2dZ1fce9PUl2XNCZ2WVg4a9oRUD1sTUpSM
|
||||
5bSTil75+tWtb8iWaE6mjnA9QGdt8Fro9J5c96ieLXGDeBnn17yqeV0z2x5041uCzomd
|
||||
VjYisvIyCmgwyrP/1rmcNiefcXT8cywY6VDBXT4iZokr9E+Uc9oaWlrr68Dknu0L9Sps
|
||||
kikQ==
|
||||
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
|
||||
h=content-transfer-encoding:mime-version:references:in-reply-to
|
||||
:message-id:date:subject:cc:to:from:delivered-to;
|
||||
bh=2VcPAoJ6MUqHi98RX96U06C9ISBArMXJM424R6yWYho=;
|
||||
b=pgfElkmeiDab/DIqnu1P0nT7ENBYKSc1y7f0xD7a3nxknW4dRVi0JTJB0U0LlWHKMi
|
||||
oD+hUOzkTK7A6WFPHHQYUBwWaP1l4YyV9NttwwdNGvqJ3QPLaSRMGE1o8GMviHmTCinS
|
||||
wyoSx18HZANbQFED3KSI0XOvRPCxnItDbLtvd8xCCddAHkEoBJSWO2xMCxaTmiw9OrjP
|
||||
bJnzeQzbmEnLwTiYz/v9cwb99Rmnu8L6I/wgdbdso92c3YTO2jSCcEZcwsXOZOrrwfvB
|
||||
OpyJ9yZ53djiEcP9IXwuMIIuwGoo3jiRzoBTKYVvD6m/w+RUWNqyiadKfEC81qIjtM8e
|
||||
L0sA==
|
||||
ARC-Authentication-Results: i=1; mx.google.com;
|
||||
spf=pass (google.com: best guess record for domain of heikki.krogerus@linux.intel.com designates 134.134.136.126 as permitted sender) smtp.mailfrom=heikki.krogerus@linux.intel.com
|
||||
Return-Path: <heikki.krogerus@linux.intel.com>
|
||||
Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com. [207.211.31.120])
|
||||
by mx.google.com with ESMTPS id n15si1068927ejy.114.2020.03.11.06.00.21
|
||||
for <hdegoede@gapps.redhat.com>
|
||||
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
|
||||
Wed, 11 Mar 2020 06:00:21 -0700 (PDT)
|
||||
Received-SPF: pass (google.com: best guess record for domain of heikki.krogerus@linux.intel.com designates 134.134.136.126 as permitted sender) client-ip=134.134.136.126;
|
||||
Authentication-Results: mx.google.com;
|
||||
spf=pass (google.com: best guess record for domain of heikki.krogerus@linux.intel.com designates 134.134.136.126 as permitted sender) smtp.mailfrom=heikki.krogerus@linux.intel.com
|
||||
Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
|
||||
[66.187.233.88]) (Using TLS) by relay.mimecast.com with ESMTP id
|
||||
us-mta-457-hFBicEuyOd600736mXrw_g-1; Wed, 11 Mar 2020 09:00:19 -0400
|
||||
X-MC-Unique: hFBicEuyOd600736mXrw_g-1
|
||||
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4])
|
||||
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
|
||||
(No client certificate requested)
|
||||
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B396080029A
|
||||
for <hdegoede@gapps.redhat.com>; Wed, 11 Mar 2020 13:00:18 +0000 (UTC)
|
||||
Received: by smtp.corp.redhat.com (Postfix)
|
||||
id B09DA2037E5A; Wed, 11 Mar 2020 13:00:18 +0000 (UTC)
|
||||
Delivered-To: hdegoede@redhat.com
|
||||
Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21])
|
||||
by smtp.corp.redhat.com (Postfix) with ESMTPS id AA6B62026D67
|
||||
for <hdegoede@redhat.com>; Wed, 11 Mar 2020 13:00:17 +0000 (UTC)
|
||||
Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120])
|
||||
(using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits))
|
||||
(No client certificate requested)
|
||||
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0FD8B8001EA
|
||||
for <hdegoede@redhat.com>; Wed, 11 Mar 2020 13:00:17 +0000 (UTC)
|
||||
Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (Using
|
||||
TLS) by relay.mimecast.com with ESMTP id
|
||||
us-mta-60-lllq3BsjPKu9X3G8f-NF5Q-1; Wed, 11 Mar 2020 09:00:14 -0400
|
||||
X-MC-Unique: lllq3BsjPKu9X3G8f-NF5Q-1
|
||||
X-Amp-Result: SKIPPED(no attachment in message)
|
||||
X-Amp-File-Uploaded: False
|
||||
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
|
||||
by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Mar 2020 06:00:13 -0700
|
||||
X-ExtLoop1: 1
|
||||
X-IronPort-AV: E=Sophos;i="5.70,540,1574150400";
|
||||
d="scan'208";a="353878533"
|
||||
Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28])
|
||||
by fmsmga001.fm.intel.com with ESMTP; 11 Mar 2020 06:00:11 -0700
|
||||
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
|
||||
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Cc: Hans de Goede <hdegoede@redhat.com>,
|
||||
linux-usb@vger.kernel.org,
|
||||
stable@vger.kernel.org
|
||||
Subject: [PATCH 2/2] usb: typec: ucsi: displayport: Fix a potential race during registration
|
||||
Date: Wed, 11 Mar 2020 16:00:06 +0300
|
||||
Message-Id: <20200311130006.41288-3-heikki.krogerus@linux.intel.com>
|
||||
In-Reply-To: <20200311130006.41288-1-heikki.krogerus@linux.intel.com>
|
||||
References: <20200311130006.41288-1-heikki.krogerus@linux.intel.com>
|
||||
MIME-Version: 1.0
|
||||
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
|
||||
X-Mimecast-Spam-Score: 0
|
||||
X-Mimecast-Originator: linux.intel.com
|
||||
Content-Type: text/plain; charset=WINDOWS-1252
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
|
||||
Locking the connector in ucsi_register_displayport() to make
|
||||
sure that nothing can access the displayport alternate mode
|
||||
before the function has finished and the alternate mode is
|
||||
actually ready.
|
||||
|
||||
Fixes: af8622f6a585 ("usb: typec: ucsi: Support for DisplayPort alt mode")
|
||||
Cc: stable@vger.kernel.org
|
||||
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
|
||||
---
|
||||
drivers/usb/typec/ucsi/displayport.c | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/usb/typec/ucsi/displayport.c b/drivers/usb/typec/ucsi/=
|
||||
displayport.c
|
||||
index 261131c9e37c..048381c058a5 100644
|
||||
--- a/drivers/usb/typec/ucsi/displayport.c
|
||||
+++ b/drivers/usb/typec/ucsi/displayport.c
|
||||
@@ -288,6 +288,8 @@ struct typec_altmode *ucsi_register_displayport(struct =
|
||||
ucsi_connector *con,
|
||||
=09struct typec_altmode *alt;
|
||||
=09struct ucsi_dp *dp;
|
||||
=20
|
||||
+=09mutex_lock(&con->lock);
|
||||
+
|
||||
=09/* We can't rely on the firmware with the capabilities. */
|
||||
=09desc->vdo |=3D DP_CAP_DP_SIGNALING | DP_CAP_RECEPTACLE;
|
||||
=20
|
||||
@@ -296,12 +298,15 @@ struct typec_altmode *ucsi_register_displayport(struc=
|
||||
t ucsi_connector *con,
|
||||
=09desc->vdo |=3D all_assignments << 16;
|
||||
=20
|
||||
=09alt =3D typec_port_register_altmode(con->port, desc);
|
||||
-=09if (IS_ERR(alt))
|
||||
+=09if (IS_ERR(alt)) {
|
||||
+=09=09mutex_unlock(&con->lock);
|
||||
=09=09return alt;
|
||||
+=09}
|
||||
=20
|
||||
=09dp =3D devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL);
|
||||
=09if (!dp) {
|
||||
=09=09typec_unregister_altmode(alt);
|
||||
+=09=09mutex_unlock(&con->lock);
|
||||
=09=09return ERR_PTR(-ENOMEM);
|
||||
=09}
|
||||
=20
|
||||
@@ -314,5 +319,7 @@ struct typec_altmode *ucsi_register_displayport(struct =
|
||||
ucsi_connector *con,
|
||||
=09alt->ops =3D &ucsi_displayport_ops;
|
||||
=09typec_altmode_set_drvdata(alt, dp);
|
||||
=20
|
||||
+=09mutex_unlock(&con->lock);
|
||||
+
|
||||
=09return alt;
|
||||
}
|
||||
--=20
|
||||
2.25.1
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue