]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
scsi: target: pscsi: Fix bio_put() for error case
authorNaohiro Aota <naohiro.aota@wdc.com>
Wed, 14 Feb 2024 14:43:56 +0000 (23:43 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Mar 2024 12:34:59 +0000 (13:34 +0100)
commit4ebc079f0c7dcda1270843ab0f38ab4edb8f7921
treea227a4f144c515af085a685c9ec458c77694d301
parent9eb04add2a26ce692a4003773beaa5ad8e486929
scsi: target: pscsi: Fix bio_put() for error case

commit de959094eb2197636f7c803af0943cb9d3b35804 upstream.

As of commit 066ff571011d ("block: turn bio_kmalloc into a simple kmalloc
wrapper"), a bio allocated by bio_kmalloc() must be freed by bio_uninit()
and kfree(). That is not done properly for the error case, hitting WARN and
NULL pointer dereference in bio_free().

Fixes: 066ff571011d ("block: turn bio_kmalloc into a simple kmalloc wrapper")
CC: stable@vger.kernel.org # 6.1+
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Link: https://lore.kernel.org/r/20240214144356.101814-1-naohiro.aota@wdc.com
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/target/target_core_pscsi.c