summaryrefslogtreecommitdiff
path: root/drivers/target
diff options
context:
space:
mode:
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>2026-03-31 18:21:15 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-04-11 15:29:19 +0300
commit4eaff1728d0e69b95933412241bbccf4f797dba8 (patch)
tree3e83226e0b54dcd7033c9c980c141aebe33a992a /drivers/target
parente5a75bf026c686b91a7dc6f9c5caf5016745d1fe (diff)
downloadlinux-4eaff1728d0e69b95933412241bbccf4f797dba8.tar.xz
scsi: target: file: Use kzalloc_flex for aio_cmd
[ 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. Fixes: 732f25a2895a ("fs: add a write stream field to the kiocb") Fixes: c27683da6406 ("block: expose write streams for block device nodes") Cc: stable@vger.kernel.org Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Link: https://patch.msgid.link/f1a2f81c62f043e31f80bb92d5f29893400c8ee2.1773450782.git.Thinh.Nguyen@synopsys.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> [ changed kmalloc() to kzalloc() ] Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
index b2610073e8cc..26d52f1f36df 100644
--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -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;