Skip to contentSkip to conversation

Patch "NFC: nfcmrvl_uart: add missing tty-device sanity check" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Jul 22, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

NFC: nfcmrvl_uart: add missing tty-device sanity check

to the 4.9-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:
nfc-nfcmrvl_uart-add-missing-tty-device-sanity-check.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 15e0c59f1535926a939d1df66d6edcf997d7c1b9 Mon Sep 17 00:00:00 2001

From: Johan Hovold <[email protected]>
Date: Thu, 30 Mar 2017 12:15:36 +0200
Subject: NFC: nfcmrvl_uart: add missing tty-device sanity check

From: Johan Hovold <[email protected]>

commit 15e0c59f1535926a939d1df66d6edcf997d7c1b9 upstream.

Make sure to check the tty-device pointer before trying to access the parent device to avoid dereferencing a NULL-pointer when the tty is one end of a Unix98 pty.

Fixes e097dc624f78 ("NFC: nfcmrvl: add UART driver")
Cc Vincent Cuissard <[email protected]>
---
 drivers/nfc/nfcmrvl/uart.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/nfc/nfcmrvl/uart.c +4 -4
@@ -109,6 +109,7 @@ static int nfcmrvl_nci_uart_open(struct
 	struct nfcmrvl_private *priv;
 	struct nfcmrvl_platform_data *pdata = NULL;
 	struct nfcmrvl_platform_data config;
+	struct device *dev = nu->tty->dev;
 
 	/*
 	 * Platform data cannot be used here since usually it is already used
@@ -116,9 +117,8 @@ static int nfcmrvl_nci_uart_open(struct
 	 * and check if DT entries were added.
 	 */
 
-	if (nu->tty->dev->parent && nu->tty->dev->parent->of_node)
-		if (nfcmrvl_uart_parse_dt(nu->tty->dev->parent->of_node,
-					  &config) == 0)
+	if (dev && dev->parent && dev->parent->of_node)
+		if (nfcmrvl_uart_parse_dt(dev->parent->of_node, &config) == 0)
 			pdata = &config;
 
 	if (!pdata) {
@@ -131,7 +131,7 @@ static int nfcmrvl_nci_uart_open(struct
 	}
 
 	priv = nfcmrvl_nci_register_dev(NFCMRVL_PHY_UART, nu, &uart_ops,
-					nu->tty->dev, pdata);
+					dev, pdata);
 	if (IS_ERR(priv))
 		return PTR_ERR(priv);
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/nfc-nfcmrvl-use-nfc-device-for-firmware-download.patch queue-4.9/nfc-nfcmrvl-fix-firmware-management-initialisation.patch queue-4.9/nfc-nfcmrvl-do-not-use-device-managed-resources.patch queue-4.9/thermal-max77620-fix-device-node-reference-imbalance.patch queue-4.9/nfc-nfcmrvl_uart-add-missing-tty-device-sanity-check.patch queue-4.9/nfc-fix-broken-device-allocation.patch