Commit 6d772ac
netlink: use kfree_rcu() in netlink_release()
On some suspend/resume operations involving wimax device, we have
noticed some intermittent memory corruptions in netlink code.
Stéphane Marchesin tracked this corruption in netlink_update_listeners()
and suggested a patch.
It appears netlink_release() should use kfree_rcu() instead of kfree()
for the listeners structure as it may be used by other cpus using RCU
protection.
netlink_release() must set to NULL the listeners pointer when
it is about to be freed.
Also have to protect netlink_update_listeners() and
netlink_has_listeners() if listeners is NULL.
Add a nl_deref_protected() lockdep helper to properly document which
locks protects us.
Reported-by: Jonathan Kliegman <kliegs@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Stéphane Marchesin <marcheu@google.com>
Cc: Sam Leffler <sleffler@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>1 parent 13d82bf commit 6d772ac
1 file changed
+15
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
| 142 | + | |
141 | 143 | | |
142 | 144 | | |
143 | 145 | | |
| |||
345 | 347 | | |
346 | 348 | | |
347 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
348 | 355 | | |
349 | 356 | | |
350 | 357 | | |
351 | 358 | | |
352 | 359 | | |
353 | 360 | | |
354 | 361 | | |
355 | | - | |
| 362 | + | |
356 | 363 | | |
357 | 364 | | |
358 | 365 | | |
| |||
536 | 543 | | |
537 | 544 | | |
538 | 545 | | |
539 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
540 | 551 | | |
541 | 552 | | |
542 | 553 | | |
| |||
982 | 993 | | |
983 | 994 | | |
984 | 995 | | |
985 | | - | |
| 996 | + | |
986 | 997 | | |
987 | 998 | | |
988 | 999 | | |
| |||
1625 | 1636 | | |
1626 | 1637 | | |
1627 | 1638 | | |
1628 | | - | |
| 1639 | + | |
1629 | 1640 | | |
1630 | 1641 | | |
1631 | 1642 | | |
| |||
0 commit comments