From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Anirudh Rayabharam <mail@anirudhrb.com>,
"David S. Miller" <davem@davemloft.net>,
Dominik Brodowski <linux@dominikbrodowski.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sasha Levin <sashal@kernel.org>,
netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.4 02/16] net: fujitsu: fix potential null-ptr-deref
Date: Mon, 24 May 2021 10:51:16 -0400 [thread overview]
Message-ID: <20210524145130.2499829-2-sashal@kernel.org> (raw)
In-Reply-To: <20210524145130.2499829-1-sashal@kernel.org>
From: Anirudh Rayabharam <mail@anirudhrb.com>
[ Upstream commit 52202be1cd996cde6e8969a128dc27ee45a7cb5e ]
In fmvj18x_get_hwinfo(), if ioremap fails there will be NULL pointer
deref. To fix this, check the return value of ioremap and return -1
to the caller in case of failure.
Cc: "David S. Miller" <davem@davemloft.net>
Acked-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Anirudh Rayabharam <mail@anirudhrb.com>
Link: https://lore.kernel.org/r/20210503115736.2104747-16-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/fujitsu/fmvj18x_cs.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/fujitsu/fmvj18x_cs.c b/drivers/net/ethernet/fujitsu/fmvj18x_cs.c
index a7139f588ad2..fb1a9bd24660 100644
--- a/drivers/net/ethernet/fujitsu/fmvj18x_cs.c
+++ b/drivers/net/ethernet/fujitsu/fmvj18x_cs.c
@@ -548,6 +548,11 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
return -1;
base = ioremap(link->resource[2]->start, resource_size(link->resource[2]));
+ if (!base) {
+ pcmcia_release_window(link, link->resource[2]);
+ return -1;
+ }
+
pcmcia_map_mem_page(link, link->resource[2], 0);
/*
--
2.30.2
next prev parent reply other threads:[~2021-05-24 15:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-24 14:51 [PATCH AUTOSEL 4.4 01/16] platform/x86: hp_accel: Avoid invoking _INI to speed up resume Sasha Levin
2021-05-24 14:51 ` Sasha Levin [this message]
2021-05-24 14:51 ` [PATCH AUTOSEL 4.4 03/16] net: caif: remove BUG_ON(dev == NULL) in caif_xmit Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.4 04/16] char: hpet: add checks after calling ioremap Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.4 05/16] ALSA: sb8: Add a comment note regarding an unused pointer Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.4 06/16] isdn: mISDNinfineon: check/cleanup ioremap failure correctly in setup_io Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.4 07/16] ath6kl: return error code in ath6kl_wmi_set_roam_lrssi_cmd() Sasha Levin
2021-05-31 20:47 ` Pavel Machek
2021-05-31 21:14 ` Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.4 08/16] libertas: register sysfs groups properly Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.4 09/16] media: dvb: Add check on sp8870_readreg return Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.4 10/16] media: gspca: mt9m111: Check write_bridge for timeout Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.4 11/16] media: gspca: properly check for errors in po1030_probe() Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.4 12/16] cdrom: gdrom: initialize global variable at init time Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.4 13/16] scsi: BusLogic: Fix 64-bit system enumeration error for Buslogic Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.4 14/16] openrisc: Define memory barrier mb Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.4 15/16] btrfs: do not BUG_ON in link_to_fixup_dir Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.4 16/16] drm/amdgpu: Fix a use-after-free Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210524145130.2499829-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
--cc=mail@anirudhrb.com \
--cc=netdev@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®