Skip to content

Commit

Permalink
nvme-fabrics: fix memory leak when parsing host ID option
Browse files Browse the repository at this point in the history
We use match_strdup() to get a copy of the option string for host ID string, but
we just pass it to uuid_parse() and don't store the string pointer, so we need to
kfree() the string after parsing it.

Signed-off-by: Roland Dreier <[email protected]>
Reviewed-by: Sagi Grimberg <[email protected]>
Reviewed-by: Johannes Thumshirn <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
  • Loading branch information
rolandd authored and Christoph Hellwig committed Jan 15, 2018
1 parent 8adb8c1 commit df351ef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/nvme/host/fabrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,9 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
ret = -ENOMEM;
goto out;
}
if (uuid_parse(p, &hostid)) {
ret = uuid_parse(p, &hostid);
kfree(p);
if (ret) {
pr_err("Invalid hostid %s\n", p);
ret = -EINVAL;
goto out;
Expand Down

0 comments on commit df351ef

Please sign in to comment.