mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
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: 0fc044b2b5
("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>
This commit is contained in:
@@ -104,6 +104,8 @@ static int dvb_device_open(struct inode *inode, struct file *file)
|
|||||||
err = file->f_op->open(inode, file);
|
err = file->f_op->open(inode, file);
|
||||||
up_read(&minor_rwsem);
|
up_read(&minor_rwsem);
|
||||||
mutex_unlock(&dvbdev_mutex);
|
mutex_unlock(&dvbdev_mutex);
|
||||||
|
if (err)
|
||||||
|
dvb_device_put(dvbdev);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
fail:
|
fail:
|
||||||
|
Reference in New Issue
Block a user