Skip to content

Commit c5586d0

Browse files
JiangJiascminyard
authored andcommitted
ipmi:ssif: Add check for kstrdup
Add check for the return value of kstrdup() and return the error if it fails in order to avoid NULL pointer dereference. Fixes: c4436c9 ("ipmi_ssif: avoid registering duplicate ssif interface") Signed-off-by: Jiasheng Jiang <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
1 parent 02210d5 commit c5586d0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/char/ipmi/ipmi_ssif.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,6 +1600,11 @@ static int ssif_add_infos(struct i2c_client *client)
16001600
info->addr_src = SI_ACPI;
16011601
info->client = client;
16021602
info->adapter_name = kstrdup(client->adapter->name, GFP_KERNEL);
1603+
if (!info->adapter_name) {
1604+
kfree(info);
1605+
return -ENOMEM;
1606+
}
1607+
16031608
info->binfo.addr = client->addr;
16041609
list_add_tail(&info->link, &ssif_infos);
16051610
return 0;

0 commit comments

Comments
 (0)