Commit 7a28d65
nfs/localio: fix regression due to out-of-order __put_cred
commit 3af870a upstream.
Commit f2060bd ("nfs/localio: add refcounting for each iocb IO
associated with NFS pgio header") inadvertantly reintroduced the same
potential for __put_cred() triggering BUG_ON(cred == current->cred) that
commit 992203a ("nfs/localio: restore creds before releasing pageio
data") fixed.
Fix this by saving and restoring the cred around each {read,write}_iter
call within the respective for loop of nfs_local_call_{read,write} using
scoped_with_creds().
NOTE: this fix started by first reverting the following commits:
94afb62 ("nfs: use credential guards in nfs_local_call_read()")
bff3c84 ("nfs: use credential guards in nfs_local_call_write()")
1d18101 ("Merge tag 'kernel-6.19-rc1.cred' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs")
followed by narrowly fixing the cred lifetime issue by using
scoped_with_creds(). In doing so, this commit's changes appear more
extensive than they really are (as evidenced by comparing to v6.18's
fs/nfs/localio.c).
Reported-by: Zorro Lang <[email protected]>
Signed-off-by: Mike Snitzer <[email protected]>
Acked-by: Trond Myklebust <[email protected]>
Reviewed-by: Christian Brauner <[email protected]>
Link: https://lore.kernel.org/linux-next/[email protected]/
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>1 parent 98a2689 commit 7a28d65
1 file changed
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
623 | 623 | | |
624 | 624 | | |
625 | 625 | | |
626 | | - | |
627 | | - | |
628 | 626 | | |
629 | 627 | | |
630 | 628 | | |
| |||
637 | 635 | | |
638 | 636 | | |
639 | 637 | | |
| 638 | + | |
640 | 639 | | |
| 640 | + | |
| 641 | + | |
641 | 642 | | |
642 | 643 | | |
643 | 644 | | |
| |||
647 | 648 | | |
648 | 649 | | |
649 | 650 | | |
650 | | - | |
651 | | - | |
652 | 651 | | |
653 | 652 | | |
654 | 653 | | |
| |||
830 | 829 | | |
831 | 830 | | |
832 | 831 | | |
833 | | - | |
834 | 832 | | |
835 | 833 | | |
836 | 834 | | |
| |||
845 | 843 | | |
846 | 844 | | |
847 | 845 | | |
| 846 | + | |
848 | 847 | | |
| 848 | + | |
| 849 | + | |
849 | 850 | | |
850 | 851 | | |
851 | 852 | | |
| |||
857 | 858 | | |
858 | 859 | | |
859 | 860 | | |
860 | | - | |
861 | 861 | | |
862 | 862 | | |
863 | 863 | | |
| |||
0 commit comments