Commit 4a403d7
committed
namespace: fix proc mount iteration
The m->index isn't updated when m->show() overflows and retains its
value before the current mount causing a restart to start at the same
value. If that happens in short order to due a quickly expanding mount
table this would cause the same mount to be shown again and again.
Ensure that *pos always equals the mount id of the mount that was
returned by start/next. On restart after overflow mnt_find_id_at(*pos)
finds the exact mount. This should avoid duplicates, avoid skips and
should handle concurrent modification just fine.
Cc: <stable@vger.kernel.org>
Fixed: 2eea9ce ("mounts: keep list of mounts in an rbtree")
Link: https://patch.msgid.link/20260129-geleckt-treuhand-4bb940acacd9@brauner
Signed-off-by: Christian Brauner <brauner@kernel.org>1 parent a41dbf5 commit 4a403d7
1 file changed
+15
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1531 | 1531 | | |
1532 | 1532 | | |
1533 | 1533 | | |
| 1534 | + | |
1534 | 1535 | | |
1535 | 1536 | | |
1536 | 1537 | | |
1537 | | - | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
1538 | 1542 | | |
1539 | 1543 | | |
1540 | 1544 | | |
1541 | 1545 | | |
1542 | | - | |
| 1546 | + | |
1543 | 1547 | | |
1544 | 1548 | | |
1545 | | - | |
1546 | 1549 | | |
1547 | | - | |
| 1550 | + | |
1548 | 1551 | | |
| 1552 | + | |
1549 | 1553 | | |
1550 | | - | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
1551 | 1561 | | |
1552 | 1562 | | |
1553 | 1563 | | |
| |||
0 commit comments