提交 81676485 编写于 作者: A Alexey Khoroshilov 提交者: Tomi Valkeinen

m501fb: don't return zero on failure path in sm501fb_probe()

If no framebuffers found, sm501fb_probe() breaks off initialization,
deallocates sm501fb_info, but returns zero. As a result, use after free
can happen in sm501fb_remove().

The patch adds -ENODEV as a return value in this case.

Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: NAlexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
上级 d301a5ac
...@@ -1988,6 +1988,7 @@ static int sm501fb_probe(struct platform_device *pdev) ...@@ -1988,6 +1988,7 @@ static int sm501fb_probe(struct platform_device *pdev)
if (info->fb[HEAD_PANEL] == NULL && if (info->fb[HEAD_PANEL] == NULL &&
info->fb[HEAD_CRT] == NULL) { info->fb[HEAD_CRT] == NULL) {
dev_err(dev, "no framebuffers found\n"); dev_err(dev, "no framebuffers found\n");
ret = -ENODEV;
goto err_alloc; goto err_alloc;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册