mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
rapidio: fix use after free in rio_unregister_scan()
We're freeing the list iterator so we can't move to the next entry. Since there is only one matching mport_id, we can just break after finding it. Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Ryan Mallon <[email protected]> Acked-by: Alexandre Bounine <[email protected]> Cc: Matt Porter <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
4e50529481
commit
f93f3c4ee4
1 changed files with 3 additions and 1 deletions
|
|
@ -1715,11 +1715,13 @@ int rio_unregister_scan(int mport_id, struct rio_scan *scan_ops)
|
|||
(mport_id == RIO_MPORT_ANY && port->nscan == scan_ops))
|
||||
port->nscan = NULL;
|
||||
|
||||
list_for_each_entry(scan, &rio_scans, node)
|
||||
list_for_each_entry(scan, &rio_scans, node) {
|
||||
if (scan->mport_id == mport_id) {
|
||||
list_del(&scan->node);
|
||||
kfree(scan);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mutex_unlock(&rio_mport_list_lock);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue