diff options
author | Johan Hovold <johan@kernel.org> | 2021-12-01 16:25:25 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-12-21 12:14:52 +0300 |
commit | a57ac7acdcc1665662e369993898194def56e888 (patch) | |
tree | b6e009635c950619d5e4d73fcb6c8a717e772e72 /fs/hostfs | |
parent | cab00a3e5e5efabecdbfe9d54dc8d779b2e59be3 (diff) | |
download | linux-a57ac7acdcc1665662e369993898194def56e888.tar.xz |
firmware: qemu_fw_cfg: fix NULL-pointer deref on duplicate entries
Commit fe3c60684377 ("firmware: Fix a reference count leak.") "fixed"
a kobject leak in the file registration helper by properly calling
kobject_put() for the entry in case registration of the object fails
(e.g. due to a name collision).
This would however result in a NULL pointer dereference when the
release function tries to remove the never added entry from the
fw_cfg_entry_cache list.
Fix this by moving the list-removal out of the release function.
Note that the offending commit was one of the benign looking umn.edu
fixes which was reviewed but not reverted. [1][2]
[1] https://lore.kernel.org/r/202105051005.49BFABCE@keescook
[2] https://lore.kernel.org/all/YIg7ZOZvS3a8LjSv@kroah.com
Fixes: fe3c60684377 ("firmware: Fix a reference count leak.")
Cc: stable@vger.kernel.org # 5.8
Cc: Qiushi Wu <wu000273@umn.edu>
Cc: Kees Cook <keescook@chromium.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20211201132528.30025-2-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/hostfs')
0 files changed, 0 insertions, 0 deletions