lirc: rc_dev_get_from_fd(): fix file leak
[ Upstream commitbba1f6758a] missing fdput() on a failure exit Fixes:6a9d552483"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:
committed by
Greg Kroah-Hartman
parent
802293e2c4
commit
410dcfa504
@@ -828,8 +828,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;
|
||||
|
||||
Reference in New Issue
Block a user