Patch "scsi: scsi_debug: Fix a warning in resp_report_zones()" has been added to the 6.0-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    scsi: scsi_debug: Fix a warning in resp_report_zones()

to the 6.0-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     scsi-scsi_debug-fix-a-warning-in-resp_report_zones.patch
and it can be found in the queue-6.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a254789cd2e10d6e5d6a01c8262b954a67572893
Author: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx>
Date:   Fri Nov 11 23:06:12 2022 -0800

    scsi: scsi_debug: Fix a warning in resp_report_zones()
    
    [ Upstream commit 07f2ca139d9a7a1ba71c4c03997c8de161db2346 ]
    
    As 'alloc_len' is user controlled data, if user tries to allocate memory
    larger than(>=) MAX_ORDER, then kcalloc() will fail, it creates a stack
    trace and messes up dmesg with a warning.
    
    Add __GFP_NOWARN in order to avoid too large allocation warning.  This is
    detected by static analysis using smatch.
    
    Fixes: 7db0e0c8190a ("scsi: scsi_debug: Fix buffer size of REPORT ZONES command")
    Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221112070612.2121535-1-harshit.m.mogalapalli@xxxxxxxxxx
    Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 077782eb55e7..3452fef3f749 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -4504,7 +4504,7 @@ static int resp_report_zones(struct scsi_cmnd *scp,
 
 	rep_max_zones = (alloc_len - 64) >> ilog2(RZONES_DESC_HD);
 
-	arr = kzalloc(alloc_len, GFP_ATOMIC);
+	arr = kzalloc(alloc_len, GFP_ATOMIC | __GFP_NOWARN);
 	if (!arr) {
 		mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC,
 				INSUFF_RES_ASCQ);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux