mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-27 14:14:24 +08:00
media: vidtv: move kfree(dvb) to vidtv_bridge_dev_release()
Adding kfree(dvb) to vidtv_bridge_remove() will remove the memory
too soon: if an application still has an open filehandle to the device
when the driver is unloaded, then when that filehandle is closed, a
use-after-free access takes place to the freed memory.
Move the kfree(dvb) to vidtv_bridge_dev_release() instead.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Fixes: 76e21bb8be
("media: vidtv: Fix memory leak in remove")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
fe47b6d758
commit
112024a3b6
@ -557,7 +557,6 @@ static int vidtv_bridge_remove(struct platform_device *pdev)
|
||||
dvb_dmxdev_release(&dvb->dmx_dev);
|
||||
dvb_dmx_release(&dvb->demux);
|
||||
dvb_unregister_adapter(&dvb->adapter);
|
||||
kfree(dvb);
|
||||
dev_info(&pdev->dev, "Successfully removed vidtv\n");
|
||||
|
||||
return 0;
|
||||
@ -565,6 +564,10 @@ static int vidtv_bridge_remove(struct platform_device *pdev)
|
||||
|
||||
static void vidtv_bridge_dev_release(struct device *dev)
|
||||
{
|
||||
struct vidtv_dvb *dvb;
|
||||
|
||||
dvb = dev_get_drvdata(dev);
|
||||
kfree(dvb);
|
||||
}
|
||||
|
||||
static struct platform_device vidtv_bridge_dev = {
|
||||
|
Loading…
Reference in New Issue
Block a user