Commit 778c420
committed
NFS: Fix a race when updating an existing write
jira VULN-136535
cve CVE-2025-39697
commit-author Trond Myklebust <[email protected]>
commit 76d2e38
upstream-diff Used linux-5.15.y backport
f230d40147cc37eb3aef4d50e2e2c06ea73d9a77, which applied cleanly
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 <[email protected]>
Tested-by: Joe Quanaim <[email protected]>
Tested-by: Andrew Steffen <[email protected]>
Reviewed-by: Jeff Layton <[email protected]>
Fixes: bd37d6f ("NFSv4: Convert nfs_lock_and_join_requests() to use nfs_page_find_head_request()")
Cc: [email protected]
Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit f230d40147cc37eb3aef4d50e2e2c06ea73d9a77)
Signed-off-by: Marcin Wcisło <[email protected]>1 parent 381e0b9 commit 778c420
3 files changed
+29
-47
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
237 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
238 | 240 | | |
239 | 241 | | |
240 | 242 | | |
241 | | - | |
242 | | - | |
| 243 | + | |
243 | 244 | | |
244 | 245 | | |
245 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
158 | | - | |
| 157 | + | |
159 | 158 | | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | 159 | | |
168 | 160 | | |
169 | | - | |
170 | | - | |
171 | 161 | | |
172 | 162 | | |
173 | 163 | | |
| |||
239 | 229 | | |
240 | 230 | | |
241 | 231 | | |
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 | | - | |
271 | | - | |
272 | 232 | | |
273 | 233 | | |
274 | 234 | | |
| |||
625 | 585 | | |
626 | 586 | | |
627 | 587 | | |
628 | | - | |
| 588 | + | |
| 589 | + | |
629 | 590 | | |
630 | 591 | | |
631 | 592 | | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
632 | 601 | | |
633 | 602 | | |
634 | 603 | | |
635 | 604 | | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
636 | 614 | | |
637 | 615 | | |
638 | 616 | | |
| |||
850 | 828 | | |
851 | 829 | | |
852 | 830 | | |
853 | | - | |
| 831 | + | |
| 832 | + | |
854 | 833 | | |
855 | 834 | | |
856 | 835 | | |
| |||
861 | 840 | | |
862 | 841 | | |
863 | 842 | | |
| 843 | + | |
864 | 844 | | |
865 | 845 | | |
866 | 846 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| 151 | + | |
151 | 152 | | |
152 | 153 | | |
153 | 154 | | |
| |||
0 commit comments