Commit 2ea46a31 authored by Kangjie Lu's avatar Kangjie Lu Committed by Kleber Sacilotto de Souza

tty: ipwireless: fix missing checks for ioremap

BugLink: https://bugs.launchpad.net/bugs/1832661

[ Upstream commit 1bbb1c31 ]

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: default avatarKangjie Lu <kjlu@umn.edu>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent e86a2c88
...@@ -113,6 +113,10 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) ...@@ -113,6 +113,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)) {
...@@ -133,6 +137,10 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) ...@@ -133,6 +137,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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment