Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df351ef7 authored by Roland Dreier's avatar Roland Dreier Committed by Christoph Hellwig
Browse files

nvme-fabrics: fix memory leak when parsing host ID option



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: default avatarRoland Dreier <roland@purestorage.com>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 8adb8c14
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;