Skip to contentSkip to conversation

FAILED: patch "[PATCH] media: rc: ensure input/lirc device can be opened after" failed to apply to 4.16-stable tree

PATCH [email protected] 2 participants 2 messages Jun 24, 2018

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.16-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From d7832cd2a3c87eb6ae1e802c88b6fc56c5823f6d Mon Sep 17 00:00:00 2001

From: Sean Young <[email protected]>
Date: Thu, 24 May 2018 05:47:17 -0400
Subject: [PATCH] media: rc: ensure input/lirc device can be opened after
register

Since commit cb84343fced1 ("media: lirc: do not call close() or open() on unregistered devices") rc_open() will return -ENODEV if rcdev->registered is false. Ensure this is set before we register the input device and the lirc device, else we have a short window where the neither the lirc or input device can be opened.

Fixes cb84343fced1 ("media: lirc: do not call close() or open() on unregistered devices")
drivers/media/rc/rc-main.c +2 -2
index b7071bde670a..2e222d9ee01f 100644
@@ -1862,6 +1862,8 @@ int rc_register_device(struct rc_dev *dev)
 		 dev->device_name ?: "Unspecified device", path ?: "N/A");
 	kfree(path);
 
+	dev->registered = true;
+
 	if (dev->driver_type != RC_DRIVER_IR_RAW_TX) {
 		rc = rc_setup_rx_device(dev);
 		if (rc)
@@ -1881,8 +1883,6 @@ int rc_register_device(struct rc_dev *dev)
 			goto out_lirc;
 	}
 
-	dev->registered = true;
-
 	dev_dbg(&dev->dev, "Registered rc%u (driver: %s)\n", dev->minor,
 		dev->driver_name ? dev->driver_name : "unknown");
 
maintainer
#1 lore raw
Quoted 10 lines · On Sun, Jun 24, 2018 at 09:56:47PM +0800, [email protected] wrote:

The patch below does not apply to the 4.16-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

Quoted 7 lines

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From d7832cd2a3c87eb6ae1e802c88b6fc56c5823f6d Mon Sep 17 00:00:00 2001

From: Sean Young <[email protected]>
Date: Thu, 24 May 2018 05:47:17 -0400
Subject: [PATCH] media: rc: ensure input/lirc device can be opened after
register

Here is the patch fixed up for v4.16 (and tested):

Quoted 1 line

From 861b15effeb3d936bce6ed0ed2a5ca866a77d8e6 Mon Sep 17 00:00:00 2001

From: Sean Young <[email protected]>
Date: Thu, 24 May 2018 05:47:17 -0400
Subject: [PATCH] media: rc: ensure input/lirc device can be opened after
register

Since commit cb84343fced1 ("media: lirc: do not call close() or open() on unregistered devices") rc_open() will return -ENODEV if rcdev->registered is false. Ensure this is set before we register the input device and the lirc device, else we have a short window where the neither the lirc or input device can be opened.

Fixes cb84343fced1 ("media: lirc: do not call close() or open() on unregistered devices")
---
 drivers/media/rc/rc-main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/rc/rc-main.c +2 -2
index 9b78818c0282..f71c22efea41 100644
@@ -1853,6 +1853,8 @@ int rc_register_device(struct rc_dev *dev)
 		 dev->device_name ?: "Unspecified device", path ?: "N/A");
 	kfree(path);
 
+	dev->registered = true;
+
 	if (dev->driver_type != RC_DRIVER_IR_RAW_TX) {
 		rc = rc_setup_rx_device(dev);
 		if (rc)
@@ -1872,8 +1874,6 @@ int rc_register_device(struct rc_dev *dev)
 			goto out_lirc;
 	}
 
-	dev->registered = true;
-
 	IR_dprintk(1, "Registered rc%u (driver: %s)\n",
 		   dev->minor,
 		   dev->driver_name ? dev->driver_name : "unknown");
Signature · 1 line
2.17.1