diff options
author | Johan Hovold <johan@kernel.org> | 2021-12-01 14:25:26 +0100 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2022-01-14 18:50:52 -0500 |
commit | 6004e351da50565fb561be85d45151dc9c370023 (patch) | |
tree | bacfd55cba922adb06bb4e75fc44e43db7b5e99c /drivers/pps | |
parent | d3e305592d69e21e36b76d24ca3c01971a2d09be (diff) | |
download | linux-6004e351da50565fb561be85d45151dc9c370023.tar.bz2 |
firmware: qemu_fw_cfg: fix kobject leak in probe error path
An initialised kobject must be freed using kobject_put() to avoid
leaking associated resources (e.g. the object name).
Commit fe3c60684377 ("firmware: Fix a reference count leak.") "fixed"
the leak in the first error path of the file registration helper but
left the second one unchanged. This "fix" would however result in a NULL
pointer dereference due to the release function also removing the never
added entry from the fw_cfg_entry_cache list. This has now been
addressed.
Fix the remaining kobject leak by restoring the common error path and
adding the missing kobject_put().
Fixes: 75f3e8e47f38 ("firmware: introduce sysfs driver for QEMU's fw_cfg device")
Cc: stable@vger.kernel.org # 4.6
Cc: Gabriel Somlo <somlo@cmu.edu>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20211201132528.30025-3-johan@kernel.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/pps')
0 files changed, 0 insertions, 0 deletions