Commit 6b8c3a1
firmware: qemu_fw_cfg: fix kobject leak in probe error path
commit 47a1db8 upstream.
An initialised kobject must be freed using kobject_put() to avoid
leaking associated resources (e.g. the object name).
Commit fe3c606 ("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: 75f3e8e ("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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 889c733 commit 6b8c3a1
1 file changed
Lines changed: 6 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
603 | 603 | | |
604 | 604 | | |
605 | 605 | | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
| 606 | + | |
| 607 | + | |
610 | 608 | | |
611 | 609 | | |
612 | 610 | | |
613 | 611 | | |
614 | | - | |
| 612 | + | |
615 | 613 | | |
616 | 614 | | |
617 | 615 | | |
| |||
620 | 618 | | |
621 | 619 | | |
622 | 620 | | |
623 | | - | |
| 621 | + | |
624 | 622 | | |
625 | | - | |
| 623 | + | |
| 624 | + | |
626 | 625 | | |
627 | 626 | | |
628 | 627 | | |
| |||
0 commit comments