Commit f58423a
bpf, sockmap: Add locking annotations to iterator
The sparse checker currently outputs the following warnings:
include/linux/rcupdate.h:632:9: sparse: sparse: context imbalance in 'sock_hash_seq_start' - wrong count at exit
include/linux/rcupdate.h:632:9: sparse: sparse: context imbalance in 'sock_map_seq_start' - wrong count at exit
Add the necessary __acquires and __release annotations to make the
iterator locking schema palatable to sparse. Also add __must_hold
for good measure.
The kernel codebase uses both __acquires(rcu) and __acquires(RCU).
I couldn't find any guidance which one is preferred, so I used
what is easier to type out.
Fixes: 0365351 ("net: Allow iterating sockmap and sockhash")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Jakub Sitnicki <jakub@cloudflare.com>
Link: https://lore.kernel.org/bpf/20201012091850.67452-1-lmb@cloudflare.com1 parent e688c3d commit f58423a
1 file changed
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
745 | 745 | | |
746 | 746 | | |
747 | 747 | | |
| 748 | + | |
748 | 749 | | |
749 | 750 | | |
750 | 751 | | |
| |||
757 | 758 | | |
758 | 759 | | |
759 | 760 | | |
| 761 | + | |
760 | 762 | | |
761 | 763 | | |
762 | 764 | | |
| |||
767 | 769 | | |
768 | 770 | | |
769 | 771 | | |
| 772 | + | |
770 | 773 | | |
771 | 774 | | |
772 | 775 | | |
| |||
789 | 792 | | |
790 | 793 | | |
791 | 794 | | |
| 795 | + | |
792 | 796 | | |
793 | 797 | | |
794 | 798 | | |
| |||
1353 | 1357 | | |
1354 | 1358 | | |
1355 | 1359 | | |
| 1360 | + | |
1356 | 1361 | | |
1357 | 1362 | | |
1358 | 1363 | | |
| |||
1365 | 1370 | | |
1366 | 1371 | | |
1367 | 1372 | | |
| 1373 | + | |
1368 | 1374 | | |
1369 | 1375 | | |
1370 | 1376 | | |
| |||
1373 | 1379 | | |
1374 | 1380 | | |
1375 | 1381 | | |
| 1382 | + | |
1376 | 1383 | | |
1377 | 1384 | | |
1378 | 1385 | | |
| |||
1396 | 1403 | | |
1397 | 1404 | | |
1398 | 1405 | | |
| 1406 | + | |
1399 | 1407 | | |
1400 | 1408 | | |
1401 | 1409 | | |
| |||
0 commit comments