Commit 81026fb
nfsd: don't ignore the return code of svc_proc_register()
jira VULN-64890
cve CVE-2025-22026
commit-author Jeff Layton <jlayton@kernel.org>
commit 930b64c
upstream-diff Ignored cherry-pick of the upstrem fix - the LTS 8.6 nfsd
codebase was too distinct from the upstream for auto merging to be
useful in any way. Backported checking of the `svc_proc_register()' exit
code manually:
fs/nfsd/stats.c
Modified function `nfsd_stat_init()' instead of
`nfsd_proc_stat_init()' because it was renamed in the
non-backported commit 93483ac.
fs/nfsd/stats.h
Like above
fs/nfsd/nfsctl.c
- Modified `init_nfsd()' where `nfsd_stat_init()' is actually used
in LTS 8.6 instead of `nfsd_net_init()', where this function
call (named `nfsd_proc_stat_init()' at that time) was moved in
the non-backported commit
93483ac.
- Ignored the `percpu_counter_destroy_many()' cleanup not
applicable to the `init_nfsd()' function. Included in the exit
path instead the `nfsd4_exit_pnfs()' call with the use of newly
introduced label `out_free_pnfs'.
Currently, nfsd_proc_stat_init() ignores the return value of
svc_proc_register(). If the procfile creation fails, then the kernel
will WARN when it tries to remove the entry later.
Fix nfsd_proc_stat_init() to return the same type of pointer as
svc_proc_register(), and fix up nfsd_net_init() to check that and fail
the nfsd_net construction if it occurs.
svc_proc_register() can fail if the dentry can't be allocated, or if an
identical dentry already exists. The second case is pretty unlikely in
the nfsd_net construction codepath, so if this happens, return -ENOMEM.
Reported-by: syzbot+e34ad04f27991521104c@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/linux-nfs/67a47501.050a0220.19061f.05f9.GAE@google.com/
Cc: stable@vger.kernel.org # v6.9
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
(cherry picked from commit 930b64c)
Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>1 parent 656ce6d commit 81026fb
3 files changed
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1524 | 1524 | | |
1525 | 1525 | | |
1526 | 1526 | | |
1527 | | - | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
1528 | 1531 | | |
1529 | 1532 | | |
1530 | 1533 | | |
| |||
1549 | 1552 | | |
1550 | 1553 | | |
1551 | 1554 | | |
| 1555 | + | |
1552 | 1556 | | |
1553 | 1557 | | |
1554 | 1558 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
0 commit comments