Skip to content

Commit 4831f76

Browse files
committed
Merge tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc fixes from Al Viro: "pick_file() speculation fix + fix for alpha mis(merge,cherry-pick) The fs/file.c one is a genuine missing speculation barrier in pick_file() (reachable e.g. via close(2)). The alpha one is strictly speaking not a bug fix, but only because confusion between preempt_enable() and preempt_disable() is harmless on architecture without CONFIG_PREEMPT. Looks like alpha.git picked the wrong version of patch - that braino used to be there in early versions, but it had been fixed quite a while ago..." * tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: fs: prevent out-of-bounds array speculation when closing a file descriptor alpha: fix lazy-FPU mis(merged/applied/whatnot)
2 parents a0aefd3 + 609d544 commit 4831f76

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

arch/alpha/lib/fpreg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ alpha_read_fp_reg (unsigned long reg)
2323

2424
if (unlikely(reg >= 32))
2525
return 0;
26-
preempt_enable();
26+
preempt_disable();
2727
if (current_thread_info()->status & TS_SAVED_FP)
2828
val = current_thread_info()->fp[reg];
2929
else switch (reg) {
@@ -133,7 +133,7 @@ alpha_read_fp_reg_s (unsigned long reg)
133133
if (unlikely(reg >= 32))
134134
return 0;
135135

136-
preempt_enable();
136+
preempt_disable();
137137
if (current_thread_info()->status & TS_SAVED_FP) {
138138
LDT(0, current_thread_info()->fp[reg]);
139139
STS(0, val);

fs/file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ static struct file *pick_file(struct files_struct *files, unsigned fd)
642642
if (fd >= fdt->max_fds)
643643
return NULL;
644644

645+
fd = array_index_nospec(fd, fdt->max_fds);
645646
file = fdt->fd[fd];
646647
if (file) {
647648
rcu_assign_pointer(fdt->fd[fd], NULL);

0 commit comments

Comments
 (0)