This is a note to let you know that I've just added the patch titled Revert "tty: hvc: Fix data abort due to race in hvc_open" to the 4.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: revert-tty-hvc-fix-data-abort-due-to-race-in-hvc_open.patch and it can be found in the queue-4.14 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From cf9c94456ebafc6d75a834e58dfdc8ae71a3acbc Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> 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 <gregkh@xxxxxxxxxxxxxxxxxxx> 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 <jslaby@xxxxxxx> Reported-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20200428032601.22127-1-rananta@xxxxxxxxxxxxxx Cc: Raghavendra Rao Ananta <rananta@xxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- 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 @@ -88,8 +88,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 @@ -334,24 +332,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); @@ -379,8 +369,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; } Patches currently in stable-queue which might be from gregkh@xxxxxxxxxxxxxxxxxxx are queue-4.14/xhci-fix-incorrect-ep_state_mask.patch queue-4.14/xhci-fix-enumeration-issue-when-setting-max-packet-size-for-fs-devices.patch queue-4.14/mld-fix-memory-leak-in-ipv6_mc_destroy_dev.patch queue-4.14/nfsv4-fix-close-not-waiting-for-direct-io-compeletion.patch queue-4.14/alsa-usb-audio-add-quirk-for-denon-dcd-1500re.patch queue-4.14/net-fix-memleak-in-register_netdevice.patch queue-4.14/tg3-driver-sleeps-indefinitely-when-eeh-errors-exceed-eeh_max_freezes.patch queue-4.14/usb-ohci-sm501-add-missed-iounmap-in-remove.patch queue-4.14/net-do-not-clear-the-sock-tx-queue-in-sk_set_socket.patch queue-4.14/net-fix-the-arp-error-in-some-cases.patch queue-4.14/rxrpc-fix-notification-call-on-completion-of-discarded-calls.patch queue-4.14/ocfs2-fix-value-of-ocfs2_invalid_slot.patch queue-4.14/net-usb-ax88179_178a-fix-packet-alignment-padding.patch queue-4.14/sctp-don-t-advertise-ipv4-addresses-if-ipv6only-is-set-on-the-socket.patch queue-4.14/net-core-reduce-recursion-limit-value.patch queue-4.14/staging-rtl8723bs-prevent-buffer-overflow-in-update_sta_support_rate.patch queue-4.14/tcp_cubic-fix-spurious-hystart_delay-exit-upon-drop-in-min-rtt.patch queue-4.14/revert-tty-hvc-fix-data-abort-due-to-race-in-hvc_open.patch queue-4.14/usb-dwc2-postponed-gadget-registration-to-the-udc-class-driver.patch queue-4.14/usb-host-ehci-exynos-fix-error-check-in-exynos_ehci_probe.patch queue-4.14/ip_tunnel-fix-use-after-free-in-ip_tunnel_lookup.patch queue-4.14/alsa-usb-audio-fix-invalid-null-check-in-snd_emuusb_set_samplerate.patch queue-4.14/arm64-perf-report-the-pc-value-in-regs_abi_32-mode.patch queue-4.14/drm-radeon-fix-fb_div-check-in-ni_init_smc_spll_table.patch queue-4.14/rocker-fix-incorrect-error-handling-in-dma_rings_init.patch queue-4.14/tcp-grow-window-for-ooo-packets-only-for-sack-flows.patch queue-4.14/kvm-nvmx-plumb-l2-gpa-through-to-pml-emulation.patch queue-4.14/alsa-hda-add-nvidia-codec-ids-9a-9d-through-a0-to-patch-table.patch queue-4.14/loop-replace-kill_bdev-with-invalidate_bdev.patch queue-4.14/btrfs-fix-failure-of-rwf_nowait-write-into-prealloc-extent-beyond-eof.patch queue-4.14/acpi-sysfs-fix-pm_profile_attr-type.patch queue-4.14/ocfs2-fix-panic-on-nfs-server-over-ocfs2.patch queue-4.14/pnfs-flexfiles-fix-list-corruption-if-the-mirror-count-changes.patch queue-4.14/mm-slab-use-memzero_explicit-in-kzfree.patch queue-4.14/sunrpc-properly-set-the-subbuf-parameter-of-xdr_buf_subsegment.patch queue-4.14/cdc-acm-add-disable_echo-quirk-for-microchip-smsc-chip.patch queue-4.14/kvm-x86-fix-msr-range-of-apic-registers-in-x2apic-mode.patch queue-4.14/sunrpc-fixed-rollback-in-rpc_gssd_dummy_populate.patch queue-4.14/ip6_gre-fix-use-after-free-in-ip6gre_tunnel_lookup.patch queue-4.14/block-bio-integrity-don-t-free-buf-if-bio_integrity_add_page-failed.patch queue-4.14/usb-ehci-reopen-solution-for-synopsys-hc-bug.patch queue-4.14/tracing-fix-event-trigger-to-accept-redundant-spaces.patch queue-4.14/usb-host-xhci-mtk-avoid-runtime-suspend-when-removing-hcd.patch queue-4.14/ibmveth-fix-max-mtu-limit.patch queue-4.14/ocfs2-load-global_inode_alloc.patch queue-4.14/net-be-more-gentle-about-silly-gso-requests-coming-from-user.patch queue-4.14/usb-add-usb_quirk_delay_init-for-logitech-c922.patch queue-4.14/net-bridge-enfore-alignment-for-ethernet-address.patch queue-4.14/xhci-poll-for-u0-after-disabling-usb2-lpm.patch queue-4.14/scsi-scsi_devinfo-handle-non-terminated-strings.patch