lirc: rc_dev_get_from_fd(): fix file leak

[ Upstream commit bba1f6758a9ec90c1adac5dcf78f8a15f1bad65b ]

missing fdput() on a failure exit

Fixes: 6a9d552483d50 "media: rc: bpf attach/detach requires write permission" # v6.9
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Al Viro 2024-05-30 23:58:26 -04:00 committed by Ksawlii
parent d8f3be0e63
commit 8a6d303c49

View file

@ -840,8 +840,10 @@ struct rc_dev *rc_dev_get_from_fd(int fd, bool write)
return ERR_PTR(-EINVAL);
}
if (write && !(f.file->f_mode & FMODE_WRITE))
if (write && !(f.file->f_mode & FMODE_WRITE)) {
fdput(f);
return ERR_PTR(-EPERM);
}
fh = f.file->private_data;
dev = fh->rc;