From 3d01063abc9fdeae234a22e7d2283e87efbda896 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 30 Jun 2020 15:08:59 +0200 Subject: [PATCH] 4.4-stable patches added patches: revert-tty-hvc-fix-data-abort-due-to-race-in-hvc_open.patch --- ...x-data-abort-due-to-race-in-hvc_open.patch | 72 +++++++++++++++++++ queue-4.4/series | 1 + 2 files changed, 73 insertions(+) create mode 100644 queue-4.4/revert-tty-hvc-fix-data-abort-due-to-race-in-hvc_open.patch diff --git a/queue-4.4/revert-tty-hvc-fix-data-abort-due-to-race-in-hvc_open.patch b/queue-4.4/revert-tty-hvc-fix-data-abort-due-to-race-in-hvc_open.patch new file mode 100644 index 00000000000..cddf66676e3 --- /dev/null +++ b/queue-4.4/revert-tty-hvc-fix-data-abort-due-to-race-in-hvc_open.patch @@ -0,0 +1,72 @@ +From cf9c94456ebafc6d75a834e58dfdc8ae71a3acbc Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Tue, 12 May 2020 10:22:44 +0200 +Subject: Revert "tty: hvc: Fix data abort due to race in hvc_open" + +From: Greg Kroah-Hartman + +commit cf9c94456ebafc6d75a834e58dfdc8ae71a3acbc upstream. + +This reverts commit e2bd1dcbe1aa34ff5570b3427c530e4332ecf0fe. + +In discussion on the mailing list, it has been determined that this is +not the correct type of fix for this issue. Revert it so that we can do +this correctly. + +Reported-by: Jiri Slaby +Reported-by: Greg Kroah-Hartman +Link: https://lore.kernel.org/r/20200428032601.22127-1-rananta@codeaurora.org +Cc: Raghavendra Rao Ananta +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/hvc/hvc_console.c | 16 ++-------------- + 1 file changed, 2 insertions(+), 14 deletions(-) + +--- a/drivers/tty/hvc/hvc_console.c ++++ b/drivers/tty/hvc/hvc_console.c +@@ -89,8 +89,6 @@ static LIST_HEAD(hvc_structs); + */ + static DEFINE_SPINLOCK(hvc_structs_lock); + +-/* Mutex to serialize hvc_open */ +-static DEFINE_MUTEX(hvc_open_mutex); + /* + * This value is used to assign a tty->index value to a hvc_struct based + * upon order of exposure via hvc_probe(), when we can not match it to +@@ -335,24 +333,16 @@ static int hvc_install(struct tty_driver + */ + static int hvc_open(struct tty_struct *tty, struct file * filp) + { +- struct hvc_struct *hp; ++ struct hvc_struct *hp = tty->driver_data; + unsigned long flags; + int rc = 0; + +- mutex_lock(&hvc_open_mutex); +- +- hp = tty->driver_data; +- if (!hp) { +- rc = -EIO; +- goto out; +- } +- + spin_lock_irqsave(&hp->port.lock, flags); + /* Check and then increment for fast path open. */ + if (hp->port.count++ > 0) { + spin_unlock_irqrestore(&hp->port.lock, flags); + hvc_kick(); +- goto out; ++ return 0; + } /* else count == 0 */ + spin_unlock_irqrestore(&hp->port.lock, flags); + +@@ -381,8 +371,6 @@ static int hvc_open(struct tty_struct *t + /* Force wakeup of the polling thread */ + hvc_kick(); + +-out: +- mutex_unlock(&hvc_open_mutex); + return rc; + } + diff --git a/queue-4.4/series b/queue-4.4/series index c7293b9b286..71669b94cec 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -132,3 +132,4 @@ pnfs-flexfiles-fix-list-corruption-if-the-mirror-count-changes.patch nfsv4-fix-close-not-waiting-for-direct-io-compeletion.patch pci-disable-msi-for-hisilicon-hip06-hip07-only-in-root-port-mode.patch alsa-usb-audio-fix-invalid-null-check-in-snd_emuusb_set_samplerate.patch +revert-tty-hvc-fix-data-abort-due-to-race-in-hvc_open.patch -- 2.47.3