Skip to content

Commit b8d72e3

Browse files
committed
ipmi:ssif: Fix a memory leak when scanning for an adapter
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: c4436c9 ("ipmi_ssif: avoid registering duplicate ssif interface") Signed-off-by: Corey Minyard <[email protected]>
1 parent c5586d0 commit b8d72e3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/char/ipmi/ipmi_ssif.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1400,7 +1400,7 @@ static struct ssif_addr_info *ssif_info_find(unsigned short addr,
14001400
restart:
14011401
list_for_each_entry(info, &ssif_infos, link) {
14021402
if (info->binfo.addr == addr) {
1403-
if (info->addr_src == SI_SMBIOS)
1403+
if (info->addr_src == SI_SMBIOS && !info->adapter_name)
14041404
info->adapter_name = kstrdup(adapter_name,
14051405
GFP_KERNEL);
14061406

0 commit comments

Comments
 (0)