diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2024-05-30 23:58:26 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2024-05-30 23:58:26 -0400 |
commit | bba1f6758a9ec90c1adac5dcf78f8a15f1bad65b (patch) | |
tree | 47f2857d30e241862f7c8acb5c41b83382c5c93d /drivers/media | |
parent | b4cf5fc01ce83e5c0bcf3dbb9f929428646b9098 (diff) | |
download | linux-stable-bba1f6758a9ec90c1adac5dcf78f8a15f1bad65b.tar.gz linux-stable-bba1f6758a9ec90c1adac5dcf78f8a15f1bad65b.tar.bz2 linux-stable-bba1f6758a9ec90c1adac5dcf78f8a15f1bad65b.zip |
lirc: rc_dev_get_from_fd(): fix file leak
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>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/rc/lirc_dev.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index 52aea4167718..717c441b4a86 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -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; |