diff options
author | Corey Minyard <minyard@acm.org> | 2023-06-19 19:43:33 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-09-13 10:42:44 +0300 |
commit | 74a1194cce60a90723d0fe148863c18931a31153 (patch) | |
tree | 2c6a310d7e7b4672693f70bb0c947b1982249f8f | |
parent | 2e7d90a81b9cee4103d2c2bb9b6be60fae74806a (diff) | |
download | linux-74a1194cce60a90723d0fe148863c18931a31153.tar.xz |
ipmi:ssif: Fix a memory leak when scanning for an adapter
[ Upstream commit b8d72e32e1453d37ee5c8a219f24e7eeadc471ef ]
The adapter scan ssif_info_find() sets info->adapter_name if the adapter
info came from SMBIOS, as it's not set in that case. However, this
function can be called more than once, and it will leak the adapter name
if it had already been set. So check for NULL before setting it.
Fixes: c4436c9149c5 ("ipmi_ssif: avoid registering duplicate ssif interface")
Signed-off-by: Corey Minyard <minyard@acm.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/char/ipmi/ipmi_ssif.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c index e94d0750d5cc..248459f97c67 100644 --- a/drivers/char/ipmi/ipmi_ssif.c +++ b/drivers/char/ipmi/ipmi_ssif.c @@ -1403,7 +1403,7 @@ static struct ssif_addr_info *ssif_info_find(unsigned short addr, restart: list_for_each_entry(info, &ssif_infos, link) { if (info->binfo.addr == addr) { - if (info->addr_src == SI_SMBIOS) + if (info->addr_src == SI_SMBIOS && !info->adapter_name) info->adapter_name = kstrdup(adapter_name, GFP_KERNEL); |