Commit ed94f87
ceph: don't allow type or device number to change on non-I_NEW inodes
Al pointed out that a malicious or broken MDS could change the type or
device number of a given inode number. It may also be possible for the
MDS to reuse an old inode number.
Ensure that we never allow fill_inode to change the type part of the
i_mode or the i_rdev unless I_NEW is set. Throw warnings if the MDS ever
changes these on us mid-stream, and return an error.
Don't set i_rdev directly, and rely on init_special_inode to do it.
Also, fix up error handling in the callers of ceph_get_inode.
In handle_cap_grant, check for and warn if the inode type changes, and
only overwrite the mode if it didn't.
Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>1 parent 3e10a15 commit ed94f87
2 files changed
Lines changed: 30 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3358 | 3358 | | |
3359 | 3359 | | |
3360 | 3360 | | |
3361 | | - | |
| 3361 | + | |
| 3362 | + | |
| 3363 | + | |
| 3364 | + | |
| 3365 | + | |
| 3366 | + | |
| 3367 | + | |
3362 | 3368 | | |
3363 | 3369 | | |
3364 | 3370 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
769 | 769 | | |
770 | 770 | | |
771 | 771 | | |
| 772 | + | |
| 773 | + | |
772 | 774 | | |
773 | 775 | | |
774 | 776 | | |
775 | 777 | | |
776 | 778 | | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
777 | 798 | | |
778 | 799 | | |
779 | 800 | | |
| |||
827 | 848 | | |
828 | 849 | | |
829 | 850 | | |
830 | | - | |
831 | | - | |
832 | 851 | | |
833 | 852 | | |
834 | 853 | | |
| |||
840 | 859 | | |
841 | 860 | | |
842 | 861 | | |
843 | | - | |
| 862 | + | |
844 | 863 | | |
845 | 864 | | |
846 | 865 | | |
| |||
938 | 957 | | |
939 | 958 | | |
940 | 959 | | |
941 | | - | |
| 960 | + | |
942 | 961 | | |
943 | 962 | | |
944 | 963 | | |
| |||
0 commit comments