bcachefs: Fix null deref in bch2_ioctl_read_super
authorDan Robertson <dan@dlrobertson.com>
Thu, 13 May 2021 00:54:37 +0000 (20:54 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:03 +0000 (17:09 -0400)
commit2b25de552f8a8d9cae5b54c83137c67e03ee1957
treecaf0f48a106483a71fa82d8810e23a967d3f6860
parentec4ab9d2fc08132113dc5d45ac68af2158377122
bcachefs: Fix null deref in bch2_ioctl_read_super

Do not attempt to cleanup the returned value of bch2_device_lookup if
the returned value was an error pointer. We currently check to see if
the returned value is null and run the cleanup otherwise. As a result,
we attempt to run the cleanup on a error pointer.

Signed-off-by: Dan Robertson <dan@dlrobertson.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/chardev.c