stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Richard Genoud <richard.genoud@gmail.com>,
	Rob Herring <robh@kernel.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [PATCH 4.9 20/30] tty/serial: atmel: use port->name as name in request_irq()
Date: Thu, 14 Jun 2018 16:05:01 +0200	[thread overview]
Message-ID: <20180614132601.102096134@linuxfoundation.org> (raw)
In-Reply-To: <20180614132600.255515394@linuxfoundation.org>

4.9-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

commit 9594b5be7ec110ed11acec58fa94f3f293668c85 upstream.

I was puzzled while looking at /proc/interrupts and random things showed
up between reboots. This occurred more often but I realised it later. The
"correct" output should be:
|38:      11861  atmel-aic5   2 Level     ttyS0

but I saw sometimes
|38:       6426  atmel-aic5   2 Level     tty1

and accounted it wrongly as correct. This is use after free and the
former example randomly got the "old" pointer which pointed to the same
content. With SLAB_FREELIST_RANDOM and HARDENED I even got
|38:       7067  atmel-aic5   2 Level     E=Started User Manager for UID 0

or other nonsense.
As it turns out the tty, pointer that is accessed in atmel_startup(), is
freed() before atmel_shutdown(). It seems to happen quite often that the
tty for ttyS0 is allocated and freed while ->shutdown is not invoked. I
don't do anything special - just a systemd boot :)

Use dev_name(&pdev->dev) as the IRQ name for request_irq(). This exists
as long as the driver is loaded so no use-after-free here.

Cc: stable@vger.kernel.org
Fixes: 761ed4a94582 ("tty: serial_core: convert uart_close to use tty_port_close")
Acked-by: Richard Genoud <richard.genoud@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/tty/serial/atmel_serial.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1803,7 +1803,6 @@ static int atmel_startup(struct uart_por
 {
 	struct platform_device *pdev = to_platform_device(port->dev);
 	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
-	struct tty_struct *tty = port->state->port.tty;
 	int retval;
 
 	/*
@@ -1818,8 +1817,8 @@ static int atmel_startup(struct uart_por
 	 * Allocate the IRQ
 	 */
 	retval = request_irq(port->irq, atmel_interrupt,
-			IRQF_SHARED | IRQF_COND_SUSPEND,
-			tty ? tty->name : "atmel_serial", port);
+			     IRQF_SHARED | IRQF_COND_SUSPEND,
+			     dev_name(&pdev->dev), port);
 	if (retval) {
 		dev_err(port->dev, "atmel_startup - Can't get irq\n");
 		return retval;

  parent reply	other threads:[~2018-06-14 14:12 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-14 14:04 [PATCH 4.9 00/30] 4.9.109-stable review Greg Kroah-Hartman
2018-06-14 14:04 ` [PATCH 4.9 01/30] x86/fpu: Hard-disable lazy FPU mode Greg Kroah-Hartman
2018-06-14 14:04 ` [PATCH 4.9 02/30] bonding: correctly update link status during mii-commit phase Greg Kroah-Hartman
2018-06-14 14:04 ` [PATCH 4.9 03/30] bonding: fix active-backup transition Greg Kroah-Hartman
2018-06-14 14:04 ` [PATCH 4.9 04/30] bonding: require speed/duplex only for 802.3ad, alb and tlb Greg Kroah-Hartman
2018-06-14 14:04 ` [PATCH 4.9 05/30] nvme-pci: initialize queue memory before interrupts Greg Kroah-Hartman
2018-06-14 14:04 ` [PATCH 4.9 06/30] af_key: Always verify length of provided sadb_key Greg Kroah-Hartman
2018-06-14 14:04 ` [PATCH 4.9 07/30] x86/crypto, x86/fpu: Remove X86_FEATURE_EAGER_FPU #ifdef from the crc32c code Greg Kroah-Hartman
2018-06-14 14:04 ` [PATCH 4.9 08/30] nvmet: Move serial number from controller to subsystem Greg Kroah-Hartman
2018-06-14 14:04 ` [PATCH 4.9 09/30] nvmet: dont report 0-bytes in serial number Greg Kroah-Hartman
2018-06-14 14:04 ` [PATCH 4.9 10/30] nvmet: dont overwrite identify sn/fr with 0-bytes Greg Kroah-Hartman
2018-06-14 14:04 ` [PATCH 4.9 11/30] gpio: No NULL owner Greg Kroah-Hartman
2018-06-14 14:04 ` [PATCH 4.9 12/30] KVM: x86: introduce linear_{read,write}_system Greg Kroah-Hartman
2018-06-14 14:04 ` [PATCH 4.9 13/30] KVM: x86: pass kvm_vcpu to kvm_read_guest_virt and kvm_write_guest_virt_system Greg Kroah-Hartman
2018-06-14 14:04 ` [PATCH 4.9 14/30] staging: android: ion: Switch to pr_warn_once in ion_buffer_destroy Greg Kroah-Hartman
2018-06-14 14:04 ` [PATCH 4.9 15/30] usbip: vhci_sysfs: fix potential Spectre v1 Greg Kroah-Hartman
2018-06-14 14:04 ` [PATCH 4.9 16/30] usb-storage: Add support for FL_ALWAYS_SYNC flag in the UAS driver Greg Kroah-Hartman
2018-06-14 14:04 ` [PATCH 4.9 17/30] usb-storage: Add compatibility quirk flags for G-Technologies G-Drive Greg Kroah-Hartman
2018-06-14 14:04 ` [PATCH 4.9 18/30] usb: gadget: udc: renesas_usb3: disable the controllers irqs for reconnecting Greg Kroah-Hartman
2018-06-14 14:05 ` [PATCH 4.9 19/30] serial: sh-sci: Stop using printk format %pCr Greg Kroah-Hartman
2018-06-14 14:05 ` Greg Kroah-Hartman [this message]
2018-06-14 14:05 ` [PATCH 4.9 21/30] serial: samsung: fix maxburst parameter for DMA transactions Greg Kroah-Hartman
2018-06-14 14:05 ` [PATCH 4.9 22/30] serial: 8250: omap: Fix idling of clocks for unused uarts Greg Kroah-Hartman
2018-06-14 14:05 ` [PATCH 4.9 23/30] vmw_balloon: fixing double free when batching mode is off Greg Kroah-Hartman
2018-06-14 14:05 ` [PATCH 4.9 24/30] tty: pl011: Avoid spuriously stuck-off interrupts Greg Kroah-Hartman
2018-06-14 14:05 ` [PATCH 4.9 25/30] kvm: x86: use correct privilege level for sgdt/sidt/fxsave/fxrstor access Greg Kroah-Hartman
2018-06-14 14:05 ` [PATCH 4.9 26/30] Input: goodix - add new ACPI id for GPD Win 2 touch screen Greg Kroah-Hartman
2018-06-14 14:05 ` [PATCH 4.9 27/30] Input: elan_i2c - add ELAN0612 (Lenovo v330 14IKB) ACPI ID Greg Kroah-Hartman
2018-06-14 14:05 ` [PATCH 4.9 28/30] crypto: vmx - Remove overly verbose printk from AES init routines Greg Kroah-Hartman
2018-06-14 14:05 ` [PATCH 4.9 29/30] crypto: omap-sham - fix memleak Greg Kroah-Hartman
2018-06-14 14:05 ` [PATCH 4.9 30/30] perf: sync up x86/.../cpufeatures.h Greg Kroah-Hartman
2018-06-14 16:49 ` [PATCH 4.9 00/30] 4.9.109-stable review Nathan Chancellor
2018-06-14 16:51   ` Greg Kroah-Hartman
2018-06-14 22:41 ` Shuah Khan
2018-06-15  0:28 ` Naresh Kamboju
2018-06-15 15:18 ` Guenter Roeck

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=20180614132601.102096134@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard.genoud@gmail.com \
    --cc=robh@kernel.org \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).