Commit 30b7164
committed
NFS: Fix a race when updating an existing write
jira VULN-136536
cve CVE-2025-39697
commit-author Trond Myklebust <trond.myklebust@hammerspace.com>
commit 76d2e38
upstream-diff Used linux-6.6.y backport
181feb41f0b268e6288bf9a7b984624d7fe2031d for the clean cherry pick
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 181feb41f0b268e6288bf9a7b984624d7fe2031d)
Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>1 parent d099aac commit 30b7164
3 files changed
Lines changed: 31 additions & 50 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | | - | |
275 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
276 | 278 | | |
277 | 279 | | |
278 | 280 | | |
279 | | - | |
280 | | - | |
| 281 | + | |
281 | 282 | | |
282 | 283 | | |
283 | 284 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
159 | | - | |
| 158 | + | |
160 | 159 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | 160 | | |
169 | 161 | | |
170 | | - | |
171 | | - | |
172 | 162 | | |
173 | 163 | | |
174 | 164 | | |
| |||
237 | 227 | | |
238 | 228 | | |
239 | 229 | | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | 230 | | |
271 | 231 | | |
272 | 232 | | |
| |||
620 | 580 | | |
621 | 581 | | |
622 | 582 | | |
623 | | - | |
624 | 583 | | |
625 | 584 | | |
626 | 585 | | |
627 | 586 | | |
628 | 587 | | |
629 | | - | |
630 | | - | |
631 | | - | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
632 | 600 | | |
633 | 601 | | |
634 | 602 | | |
635 | 603 | | |
636 | 604 | | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
637 | 614 | | |
638 | 615 | | |
639 | 616 | | |
| |||
838 | 815 | | |
839 | 816 | | |
840 | 817 | | |
841 | | - | |
| 818 | + | |
| 819 | + | |
842 | 820 | | |
843 | 821 | | |
844 | 822 | | |
| |||
850 | 828 | | |
851 | 829 | | |
852 | 830 | | |
| 831 | + | |
853 | 832 | | |
854 | 833 | | |
855 | 834 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
| |||
0 commit comments