Commit 70015d5
committed
NFS: Fix a race when updating an existing write
jira KERNEL-216
cve CVE-2025-39697
Rebuild_History Non-Buildable kernel-5.14.0-611.9.1.el9_7
commit-author Trond Myklebust <trond.myklebust@hammerspace.com>
commit 76d2e38
After nfs_lock_and_join_requests() tests for whether the request is
still attached to the mapping, nothing prevents a call to
nfs_inode_remove_request() from succeeding until we actually lock the
page group.
The reason is that whoever called nfs_inode_remove_request() doesn't
necessarily have a lock on the page group head.
So in order to avoid races, let's take the page group lock earlier in
nfs_lock_and_join_requests(), and hold it across the removal of the
request in nfs_inode_remove_request().
Reported-by: Jeff Layton <jlayton@kernel.org>
Tested-by: Joe Quanaim <jdq@meta.com>
Tested-by: Andrew Steffen <aksteffen@meta.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Fixes: bd37d6f ("NFSv4: Convert nfs_lock_and_join_requests() to use nfs_page_find_head_request()")
Cc: stable@vger.kernel.org
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
(cherry picked from commit 76d2e38)
Signed-off-by: Jonathan Maple <jmaple@ciq.com>1 parent 191be67 commit 70015d5
3 files changed
+16
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
257 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
258 | 260 | | |
259 | 261 | | |
260 | 262 | | |
261 | | - | |
262 | | - | |
| 263 | + | |
263 | 264 | | |
264 | 265 | | |
265 | 266 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
157 | | - | |
| 156 | + | |
158 | 157 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | 158 | | |
167 | 159 | | |
168 | | - | |
169 | | - | |
170 | 160 | | |
171 | 161 | | |
172 | 162 | | |
| |||
584 | 574 | | |
585 | 575 | | |
586 | 576 | | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
587 | 581 | | |
588 | 582 | | |
| 583 | + | |
589 | 584 | | |
590 | 585 | | |
591 | 586 | | |
592 | 587 | | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
| 588 | + | |
600 | 589 | | |
601 | 590 | | |
602 | 591 | | |
| |||
801 | 790 | | |
802 | 791 | | |
803 | 792 | | |
804 | | - | |
| 793 | + | |
| 794 | + | |
805 | 795 | | |
806 | 796 | | |
807 | 797 | | |
| |||
813 | 803 | | |
814 | 804 | | |
815 | 805 | | |
| 806 | + | |
816 | 807 | | |
817 | 808 | | |
818 | 809 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
163 | 164 | | |
164 | 165 | | |
165 | 166 | | |
| |||
0 commit comments