mirror of
https://github.com/torvalds/linux.git
synced 2026-11-27 17:02:17 +00:00
media: rc: do not access device via sysfs after rc_unregister_device()
Device drivers do not expect to have change_protocol or wakeup re-programming to be accesed after rc_unregister_device(). This can cause the device driver to access deallocated resources. Cc: <[email protected]> # 4.16+ Signed-off-by: Sean Young <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
4f0835d667
commit
a2e2d73fa2
@@ -1292,6 +1292,10 @@ static ssize_t store_protocols(struct device *device,
|
||||
}
|
||||
|
||||
mutex_lock(&dev->lock);
|
||||
if (!dev->registered) {
|
||||
mutex_unlock(&dev->lock);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
old_protocols = *current_protocols;
|
||||
new_protocols = old_protocols;
|
||||
@@ -1430,6 +1434,10 @@ static ssize_t store_filter(struct device *device,
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&dev->lock);
|
||||
if (!dev->registered) {
|
||||
mutex_unlock(&dev->lock);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
new_filter = *filter;
|
||||
if (fattr->mask)
|
||||
@@ -1544,6 +1552,10 @@ static ssize_t store_wakeup_protocols(struct device *device,
|
||||
int i;
|
||||
|
||||
mutex_lock(&dev->lock);
|
||||
if (!dev->registered) {
|
||||
mutex_unlock(&dev->lock);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
allowed = dev->allowed_wakeup_protocols;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user