Skip to content

Commit

Permalink
HSI: core: Fix return freed object in hsi_new_client
Browse files Browse the repository at this point in the history
cl is freed on error of calling device_register, but this
object is return later, which will cause uaf issue. Fix it
by return NULL on error.

Signed-off-by: Chengfeng Ye <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
  • Loading branch information
Ychame authored and sre committed Nov 25, 2021
1 parent fa55b7d commit a1ee1c0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/hsi/hsi_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ struct hsi_client *hsi_new_client(struct hsi_port *port,
if (device_register(&cl->device) < 0) {
pr_err("hsi: failed to register client: %s\n", info->name);
put_device(&cl->device);
goto err;
}

return cl;
Expand Down

0 comments on commit a1ee1c0

Please sign in to comment.