]> git.baikalelectronics.ru Git - kernel.git/commit
mfd: pcf50633-adc: Fix potential memleak in pcf50633_adc_async_read()
authorQiheng Lin <linqiheng@huawei.com>
Thu, 8 Dec 2022 06:15:55 +0000 (14:15 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:28 +0000 (09:33 +0100)
commit05b16d620691ebede33516f9a208421e8bc3ea3d
tree8fa3b535af5c10457113f4f8dd107db9fd7c10c4
parente853c89d1a9487cfaa9d4c25532944b78f01606c
mfd: pcf50633-adc: Fix potential memleak in pcf50633_adc_async_read()

[ Upstream commit f828960d4533bd7bf1db2b731f69b34836e3301c ]

`req` is allocated in pcf50633_adc_async_read(), but
adc_enqueue_request() could fail to insert the `req` into queue.
We need to check the return value and free it in the case of failure.

Fixes: 6a76d5e02ab3 ("mfd: PCF50633 adc driver")
Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20221208061555.8776-1-linqiheng@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mfd/pcf50633-adc.c