提交 75261ff8 编写于 作者: Z Zhou Qingyang 提交者: Zheng Zengkai

media: saa7146: mxb: Fix a NULL pointer dereference in mxb_attach()

stable inclusion
from stable-v5.10.94
commit 7009a5fbc589484c1b6e6e5ed1c47b64b62c5769
bugzilla: https://gitee.com/openeuler/kernel/issues/I531X9

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=7009a5fbc589484c1b6e6e5ed1c47b64b62c5769

--------------------------------

[ Upstream commit 0407c49e ]

In mxb_attach(dev, info), saa7146_vv_init() is called to allocate a
new memory for dev->vv_data. saa7146_vv_release() will be called on
failure of mxb_probe(dev). There is a dereference of dev->vv_data
in saa7146_vv_release(), which could lead to a NULL pointer dereference
on failure of saa7146_vv_init().

Fix this bug by adding a check of saa7146_vv_init().

This bug was found by a static analyzer. The analysis employs
differential checking to identify inconsistent security operations
(e.g., checks or kfrees) between two code paths and confirms that the
inconsistent operations are not recovered in the current function or
the callers, so they constitute bugs.

Note that, as a bug found by static analysis, it can be a false
positive or hard to trigger. Multiple researchers have cross-reviewed
the bug.

Builds with CONFIG_VIDEO_MXB=m show no new warnings,
and our static analyzer no longer warns about this code.

Fixes: 03b1930e ("V4L/DVB: saa7146: fix regression of the av7110/budget-av driver")
Signed-off-by: NZhou Qingyang <zhou1615@umn.edu>
Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 814ae83d
...@@ -683,10 +683,16 @@ static struct saa7146_ext_vv vv_data; ...@@ -683,10 +683,16 @@ static struct saa7146_ext_vv vv_data;
static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info)
{ {
struct mxb *mxb; struct mxb *mxb;
int ret;
DEB_EE("dev:%p\n", dev); DEB_EE("dev:%p\n", dev);
saa7146_vv_init(dev, &vv_data); ret = saa7146_vv_init(dev, &vv_data);
if (ret) {
ERR("Error in saa7146_vv_init()");
return ret;
}
if (mxb_probe(dev)) { if (mxb_probe(dev)) {
saa7146_vv_release(dev); saa7146_vv_release(dev);
return -1; return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册