Commit a535116
committed
ovl: make use of ->layers safe in rcu pathwalk
ovl_permission() accesses ->layers[...].mnt; we can't have ->layers
freed without an RCU delay on fs shutdown.
Fortunately, kern_unmount_array() that is used to drop those mounts
does include an RCU delay, so freeing is delayed; unfortunately, the
array passed to kern_unmount_array() is formed by mangling ->layers
contents and that happens without any delays.
The ->layers[...].name string entries are used to store the strings to
display in "lowerdir=..." by ovl_show_options(). Those entries are not
accessed in RCU walk.
Move the name strings into a separate array ofs->config.lowerdirs and
reuse the ofs->config.lowerdirs array as the temporary mount array to
pass to kern_unmount_array().
Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Link: https://lore.kernel.org/r/20231002023711.GP3389589@ZenIV/
Acked-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>1 parent c54719c commit a535116
3 files changed
Lines changed: 21 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | | - | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 45 | | |
54 | 46 | | |
55 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
752 | 752 | | |
753 | 753 | | |
754 | 754 | | |
755 | | - | |
756 | | - | |
| 755 | + | |
| 756 | + | |
757 | 757 | | |
758 | 758 | | |
| 759 | + | |
759 | 760 | | |
760 | | - | |
761 | 761 | | |
762 | 762 | | |
763 | 763 | | |
764 | 764 | | |
765 | 765 | | |
766 | 766 | | |
767 | 767 | | |
| 768 | + | |
768 | 769 | | |
769 | 770 | | |
770 | 771 | | |
| |||
949 | 950 | | |
950 | 951 | | |
951 | 952 | | |
952 | | - | |
| 953 | + | |
953 | 954 | | |
954 | | - | |
955 | | - | |
| 955 | + | |
| 956 | + | |
956 | 957 | | |
957 | 958 | | |
958 | | - | |
| 959 | + | |
959 | 960 | | |
960 | 961 | | |
961 | | - | |
| 962 | + | |
962 | 963 | | |
963 | 964 | | |
964 | 965 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
572 | 572 | | |
573 | 573 | | |
574 | 574 | | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | 575 | | |
581 | 576 | | |
582 | 577 | | |
| |||
1125 | 1120 | | |
1126 | 1121 | | |
1127 | 1122 | | |
1128 | | - | |
| 1123 | + | |
| 1124 | + | |
1129 | 1125 | | |
1130 | 1126 | | |
1131 | 1127 | | |
| |||
1370 | 1366 | | |
1371 | 1367 | | |
1372 | 1368 | | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
1373 | 1374 | | |
1374 | | - | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
1375 | 1379 | | |
1376 | 1380 | | |
1377 | 1381 | | |
| |||
0 commit comments