提交 044bbf55 编写于 作者: K Kangjie Lu 提交者: Xie XiuQi

tty: ipwireless: fix missing checks for ioremap

[ Upstream commit 1bbb1c318cd8a3a39e8c3e2e83d5e90542d6c3e3 ]

ipw->attr_memory and ipw->common_memory are assigned with the
return value of ioremap. ioremap may fail, but no checks
are enforced. The fix inserts the checks to avoid potential
NULL pointer dereferences.
Signed-off-by: NKangjie Lu <kjlu@umn.edu>
Reviewed-by: NDavid Sterba <dsterba@suse.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 b3d9a1be
...@@ -114,6 +114,10 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) ...@@ -114,6 +114,10 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data)
ipw->common_memory = ioremap(p_dev->resource[2]->start, ipw->common_memory = ioremap(p_dev->resource[2]->start,
resource_size(p_dev->resource[2])); resource_size(p_dev->resource[2]));
if (!ipw->common_memory) {
ret = -ENOMEM;
goto exit1;
}
if (!request_mem_region(p_dev->resource[2]->start, if (!request_mem_region(p_dev->resource[2]->start,
resource_size(p_dev->resource[2]), resource_size(p_dev->resource[2]),
IPWIRELESS_PCCARD_NAME)) { IPWIRELESS_PCCARD_NAME)) {
...@@ -134,6 +138,10 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) ...@@ -134,6 +138,10 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data)
ipw->attr_memory = ioremap(p_dev->resource[3]->start, ipw->attr_memory = ioremap(p_dev->resource[3]->start,
resource_size(p_dev->resource[3])); resource_size(p_dev->resource[3]));
if (!ipw->attr_memory) {
ret = -ENOMEM;
goto exit3;
}
if (!request_mem_region(p_dev->resource[3]->start, if (!request_mem_region(p_dev->resource[3]->start,
resource_size(p_dev->resource[3]), resource_size(p_dev->resource[3]),
IPWIRELESS_PCCARD_NAME)) { IPWIRELESS_PCCARD_NAME)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册