Skip to content

Commit cd042d4

Browse files
seanyoungksacilotto
authored andcommitted
media: rc: ensure that uevent can be read directly after rc device register
BugLink: https://bugs.launchpad.net/bugs/1916056 commit 896111d upstream. There is a race condition where if the /sys/class/rc0/uevent file is read before rc_dev->registered is set to true, -ENODEV will be returned. Link: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1901089 Cc: [email protected] Fixes: a2e2d73 ("media: rc: do not access device via sysfs after rc_unregister_device()") Signed-off-by: Sean Young <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Kamal Mostafa <[email protected]> Signed-off-by: Stefan Bader <[email protected]>
1 parent 82723cd commit cd042d4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/media/rc/rc-main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1892,6 +1892,8 @@ int rc_register_device(struct rc_dev *dev)
18921892
goto out_raw;
18931893
}
18941894

1895+
dev->registered = true;
1896+
18951897
rc = device_add(&dev->dev);
18961898
if (rc)
18971899
goto out_rx_free;
@@ -1901,8 +1903,6 @@ int rc_register_device(struct rc_dev *dev)
19011903
dev->device_name ?: "Unspecified device", path ?: "N/A");
19021904
kfree(path);
19031905

1904-
dev->registered = true;
1905-
19061906
/*
19071907
* once the the input device is registered in rc_setup_rx_device,
19081908
* userspace can open the input device and rc_open() will be called

0 commit comments

Comments
 (0)