Commit c86b300
committed
fs: add kern_path_locked_negative()
The audit code relies on the fact that kern_path_locked() returned a
path even for a negative dentry. If it doesn't find a valid dentry it
immediately calls:
audit_find_parent(d_backing_inode(parent_path.dentry));
which assumes that parent_path.dentry is still valid. But it isn't since
kern_path_locked() has been changed to path_put() also for a negative
dentry.
Fix this by adding a helper that implements the required audit semantics
and allows us to fix the immediate bleeding. We can find a unified
solution for this afterwards.
Link: https://lore.kernel.org/20250414-rennt-wimmeln-f186c3a780f1@brauner
Fixes: 1c3cb50 ("VFS: change kern_path_locked() and user_path_locked_at() to never return negative dentry")
Reported-and-tested-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>1 parent ddee68c commit c86b300
3 files changed
+60
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1665 | 1665 | | |
1666 | 1666 | | |
1667 | 1667 | | |
1668 | | - | |
1669 | | - | |
1670 | | - | |
1671 | | - | |
1672 | | - | |
1673 | | - | |
1674 | | - | |
1675 | | - | |
1676 | | - | |
1677 | | - | |
1678 | | - | |
1679 | | - | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
1680 | 1671 | | |
1681 | | - | |
| 1672 | + | |
1682 | 1673 | | |
1683 | | - | |
| 1674 | + | |
1684 | 1675 | | |
| 1676 | + | |
1685 | 1677 | | |
1686 | | - | |
| 1678 | + | |
1687 | 1679 | | |
1688 | 1680 | | |
| 1681 | + | |
1689 | 1682 | | |
1690 | 1683 | | |
1691 | 1684 | | |
| |||
1698 | 1691 | | |
1699 | 1692 | | |
1700 | 1693 | | |
1701 | | - | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
1702 | 1712 | | |
1703 | 1713 | | |
1704 | 1714 | | |
| |||
2762 | 2772 | | |
2763 | 2773 | | |
2764 | 2774 | | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + | |
| 2785 | + | |
| 2786 | + | |
| 2787 | + | |
| 2788 | + | |
| 2789 | + | |
| 2790 | + | |
| 2791 | + | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
| 2796 | + | |
| 2797 | + | |
2765 | 2798 | | |
2766 | 2799 | | |
2767 | 2800 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | | - | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
351 | 353 | | |
352 | 354 | | |
353 | | - | |
354 | | - | |
355 | | - | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
356 | 361 | | |
357 | 362 | | |
358 | 363 | | |
| |||
418 | 423 | | |
419 | 424 | | |
420 | 425 | | |
421 | | - | |
| 426 | + | |
422 | 427 | | |
423 | 428 | | |
424 | 429 | | |
425 | | - | |
426 | 430 | | |
427 | 431 | | |
428 | 432 | | |
| |||
0 commit comments