]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
i3c: Fix potential refcount leak in i3c_master_register_new_i3c_devs
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Thu, 21 Sep 2023 08:24:10 +0000 (16:24 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:08:27 +0000 (11:08 +0100)
commitd48fe8d98171e0fffdeaa8b37ce0a6444bff819b
treeae5678684e606390ec06abe92e978c9d1a3bffab
parent855d6fb2cc7b1284ff17bce822e68810c0acc4d7
i3c: Fix potential refcount leak in i3c_master_register_new_i3c_devs

[ Upstream commit cab63f64887616e3c4e31cfd8103320be6ebc8d3 ]

put_device() needs to be called on failure of device_register()
to give up the reference initialized in it to avoid refcount leak.

Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Link: https://lore.kernel.org/r/20230921082410.25548-1-dinghao.liu@zju.edu.cn
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/i3c/master.c