diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2023-10-31 12:53:33 +0300 |
---|---|---|
committer | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2023-12-13 13:04:46 +0300 |
commit | a2dd235df435a05d389240be748909ada91201d2 (patch) | |
tree | e7c43c697b0cc63665d5dd806b495e15576ef243 | |
parent | d8b45ee43a0562867d4fbe196e7747226c0a3d13 (diff) | |
download | linux-a2dd235df435a05d389240be748909ada91201d2.tar.xz |
media: dvbdev: drop refcount on error path in dvb_device_open()
If call to file->f_op->open() fails, then call dvb_device_put(dvbdev).
Fixes: 0fc044b2b5e2 ("media: dvbdev: adopts refcnt to avoid UAF")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r-- | drivers/media/dvb-core/dvbdev.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c index 305bb21d843c..49f0eb7d0b9d 100644 --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -104,6 +104,8 @@ static int dvb_device_open(struct inode *inode, struct file *file) err = file->f_op->open(inode, file); up_read(&minor_rwsem); mutex_unlock(&dvbdev_mutex); + if (err) + dvb_device_put(dvbdev); return err; } fail: |