Commit 581dd2d
committed
Bluetooth: hci_event: Fix using rcu_read_(un)lock while iterating
The usage of rcu_read_(un)lock while inside list_for_each_entry_rcu is
not safe since for the most part entries fetched this way shall be
treated as rcu_dereference:
Note that the value returned by rcu_dereference() is valid
only within the enclosing RCU read-side critical section [1]_.
For example, the following is **not** legal::
rcu_read_lock();
p = rcu_dereference(head.next);
rcu_read_unlock();
x = p->address; /* BUG!!! */
rcu_read_lock();
y = p->data; /* BUG!!! */
rcu_read_unlock();
Fixes: a0bfde1 ("Bluetooth: ISO: Add support for connecting multiple BISes")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>1 parent 4d94f05 commit 581dd2d
1 file changed
+11
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6870 | 6870 | | |
6871 | 6871 | | |
6872 | 6872 | | |
6873 | | - | |
6874 | 6873 | | |
6875 | 6874 | | |
6876 | | - | |
6877 | | - | |
6878 | | - | |
6879 | | - | |
| 6875 | + | |
| 6876 | + | |
| 6877 | + | |
| 6878 | + | |
| 6879 | + | |
6880 | 6880 | | |
| 6881 | + | |
6881 | 6882 | | |
6882 | 6883 | | |
6883 | 6884 | | |
6884 | 6885 | | |
6885 | 6886 | | |
6886 | | - | |
6887 | | - | |
6888 | | - | |
6889 | | - | |
6890 | | - | |
6891 | | - | |
6892 | | - | |
6893 | | - | |
6894 | | - | |
6895 | | - | |
6896 | | - | |
6897 | | - | |
6898 | | - | |
6899 | | - | |
6900 | | - | |
| 6887 | + | |
| 6888 | + | |
| 6889 | + | |
| 6890 | + | |
| 6891 | + | |
6901 | 6892 | | |
6902 | 6893 | | |
6903 | | - | |
6904 | | - | |
6905 | 6894 | | |
6906 | 6895 | | |
6907 | 6896 | | |
| |||
0 commit comments