FAILED: patch "[PATCH] scsi: target: file: Use kzalloc_flex for aio_cmd" failed to apply to 6.18-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x 01f784fc9d0ab2a6dac45ee443620e517cb2a19b
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026033002-suave-karma-46c8@gregkh' --subject-prefix 'PATCH 6.18.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 01f784fc9d0ab2a6dac45ee443620e517cb2a19b Mon Sep 17 00:00:00 2001
From: Thinh Nguyen <[email protected]>
Date: Sat, 14 Mar 2026 01:17:40 +0000
Subject: [PATCH] scsi: target: file: Use kzalloc_flex for aio_cmd
The target_core_file doesn't initialize the aio_cmd->iocb for the ki_write_stream. When a write command fd_execute_rw_aio() is executed, we may get a bogus ki_write_stream value, causing unintended write failure status when checking iocb->ki_write_stream > max_write_streams in the block device.
Let's just use kzalloc_flex when allocating the aio_cmd and let ki_write_stream=0 to fix this issue.
drivers/target/target_core_file.c +1 -1
@@ -276,7 +276,7 @@ fd_execute_rw_aio(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,ssize_t len =0 ;int ret =0 , i; - aio_cmd =kmalloc_flex (*aio_cmd, bvecs, sgl_nents); + aio_cmd =kzalloc_flex (*aio_cmd, bvecs, sgl_nents);if (!aio_cmd)return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ;
Sasha Levin
maintainerPATCH 1/1 scsi: target: file: Use kzalloc_flex for aio_cmd
From: Thinh Nguyen <[email protected]>
[ Upstream commit 01f784fc9d0ab2a6dac45ee443620e517cb2a19b ]
The target_core_file doesn't initialize the aio_cmd->iocb for the ki_write_stream. When a write command fd_execute_rw_aio() is executed, we may get a bogus ki_write_stream value, causing unintended write failure status when checking iocb->ki_write_stream > max_write_streams in the block device.
Let's just use kzalloc_flex when allocating the aio_cmd and let ki_write_stream=0 to fix this issue.
--- drivers/target/target_core_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/target_core_file.c +1 -1
@@ -276,7 +276,7 @@ fd_execute_rw_aio(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,ssize_t len =0 ;int ret =0 , i; - aio_cmd =kmalloc (struct_size (aio_cmd, bvecs, sgl_nents),GFP_KERNEL ); + aio_cmd =kzalloc (struct_size (aio_cmd, bvecs, sgl_nents),GFP_KERNEL );if (!aio_cmd)return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ;
Signature · 1 line
2.53.0