Skip to content

Commit dd90ad5

Browse files
committed
Merge tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull struct file leak fixes from Al Viro: "a couple of leaks on failure exits missing fdput()" * tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: lirc: rc_dev_get_from_fd(): fix file leak powerpc: fix a file leak in kvm_vcpu_ioctl_enable_cap()
2 parents 4c7be57 + bba1f67 commit dd90ad5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

arch/powerpc/kvm/powerpc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1984,8 +1984,10 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
19841984
break;
19851985

19861986
r = -ENXIO;
1987-
if (!xive_enabled())
1987+
if (!xive_enabled()) {
1988+
fdput(f);
19881989
break;
1990+
}
19891991

19901992
r = -EPERM;
19911993
dev = kvm_device_from_filp(f.file);

drivers/media/rc/lirc_dev.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,8 +828,10 @@ struct rc_dev *rc_dev_get_from_fd(int fd, bool write)
828828
return ERR_PTR(-EINVAL);
829829
}
830830

831-
if (write && !(f.file->f_mode & FMODE_WRITE))
831+
if (write && !(f.file->f_mode & FMODE_WRITE)) {
832+
fdput(f);
832833
return ERR_PTR(-EPERM);
834+
}
833835

834836
fh = f.file->private_data;
835837
dev = fh->rc;

0 commit comments

Comments
 (0)