nvme: fix potential memory leak in option parsing
authorChengguang Xu <cgxu519@gmx.com>
Sat, 14 Apr 2018 12:06:19 +0000 (20:06 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Jun 2018 19:02:53 +0000 (04:02 +0900)
commitb19122a48f01544456f4b4efe423b9aa7c21be6d
tree634ffb0f66909795202d0a50329bf375dd9926fc
parent665d3c7f1e506ed9310e3038ab0966520fa5749a
nvme: fix potential memory leak in option parsing

[ Upstream commit 59a2f3f00fd744dbad22593f47552037d3154ca6 ]

When specifying same string type option several times,
current option parsing may cause memory leak. Hence,
call kfree for previous one in this case.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvme/host/fabrics.c