[PATCH 0/4] firmware: qemu_fw_cfg: misc bug fixes

2021-12-01 Thread Johan Hovold
revealed a number of other bugs, including one that was indeed introduced by umn.edu but that was missed during the (re-)review. Included is also a related clean up. Johan Johan Hovold (4): firmware: qemu_fw_cfg: fix NULL-pointer deref on duplicate entries firmware: qemu_fw_cfg: fix kobject leak

[PATCH 2/4] firmware: qemu_fw_cfg: fix kobject leak in probe error path

2021-12-01 Thread Johan Hovold
missing kobject_put(). Fixes: 75f3e8e47f38 ("firmware: introduce sysfs driver for QEMU's fw_cfg device") Cc: sta...@vger.kernel.org # 4.6 Cc: Gabriel Somlo Signed-off-by: Johan Hovold --- drivers/firmware/qemu_fw_cfg.c | 13 ++--- 1 file changed, 6 insertions(+),

[PATCH 3/4] firmware: qemu_fw_cfg: fix sysfs information leak

2021-12-01 Thread Johan Hovold
") Cc: sta...@vger.kernel.org # 4.6 Cc: Gabriel Somlo Signed-off-by: Johan Hovold --- drivers/firmware/qemu_fw_cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c index ccb7ed62452f..f08e056ed0ae 100644 --- a/d

[PATCH 1/4] firmware: qemu_fw_cfg: fix NULL-pointer deref on duplicate entries

2021-12-01 Thread Johan Hovold
d. [1][2] [1] https://lore.kernel.org/r/202105051005.49BFABCE@keescook [2] https://lore.kernel.org/all/yig7zozvs3a8l...@kroah.com Fixes: fe3c60684377 ("firmware: Fix a reference count leak.") Cc: sta...@vger.kernel.org # 5.8 Cc: Qiushi Wu Cc: Kees Cook Cc: Greg Kroah-Hartman Signed-off-

[PATCH 4/4] firmware: qemu_fw_cfg: remove sysfs entries explicitly

2021-12-01 Thread Johan Hovold
Explicitly remove the file entries from sysfs before dropping the final reference for symmetry reasons and for consistency with the rest of the driver. Signed-off-by: Johan Hovold --- drivers/firmware/qemu_fw_cfg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/firmware

Re: [PATCH] fw_cfg: Fix memory leak in fw_cfg_register_file

2021-11-30 Thread Johan Hovold
On Tue, Nov 16, 2021 at 04:28:34PM +0100, Philippe Mathieu-Daudé wrote: > On 11/16/21 12:42, Miaoqian Lin wrote: > > When kobject_init_and_add() fails, entry should be freed just like > > when sysfs_create_bin_file() fails. > > > > Fixes: fe3c60684377 ("firmware: Fix a reference count leak.") > R