Skip to content

Commit d18e0a7

Browse files
committed
rpmsg: Fix possible refcount leak in rpmsg_register_device_override()
JIRA: https://issues.redhat.com/browse/RHEL-78824 commit d7bd416 Author: Hangyu Hua <hbh25y@gmail.com> Date: Fri Jun 24 10:41:20 2022 +0800 rpmsg: Fix possible refcount leak in rpmsg_register_device_override() rpmsg_register_device_override need to call put_device to free vch when driver_set_override fails. Fix this by adding a put_device() to the error path. Fixes: bb17d11 ("rpmsg: Fix calling device_lock() on non-initialized device") Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Hangyu Hua <hbh25y@gmail.com> Link: https://lore.kernel.org/r/20220624024120.11576-1-hbh25y@gmail.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Jared Kangas <jkangas@redhat.com>
1 parent fece841 commit d18e0a7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/rpmsg/rpmsg_core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ int rpmsg_register_device_override(struct rpmsg_device *rpdev,
618618
strlen(driver_override));
619619
if (ret) {
620620
dev_err(dev, "device_set_override failed: %d\n", ret);
621+
put_device(dev);
621622
return ret;
622623
}
623624
}

0 commit comments

Comments
 (0)