Patch "lightnvm: fix out-of-bounds write to array devices->info[]" has been added to the 5.8-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

    lightnvm: fix out-of-bounds write to array devices->info[]

to the 5.8-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:
     lightnvm-fix-out-of-bounds-write-to-array-devices-in.patch
and it can be found in the queue-5.8 subdirectory.

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



commit 50398c78356ea2b7fbc259bdf2a251309bf39da3
Author: Colin Ian King <colin.king@xxxxxxxxxxxxx>
Date:   Fri Oct 16 15:33:51 2020 +0100

    lightnvm: fix out-of-bounds write to array devices->info[]
    
    [ Upstream commit a48faebe65b0db55a73b9220c3d919eee849bb79 ]
    
    There is an off-by-one array check that can lead to a out-of-bounds
    write to devices->info[i].  Fix this by checking by using >= rather
    than > for the size check. Also replace hard-coded array size limit
    with ARRAY_SIZE on the array.
    
    Addresses-Coverity: ("Out-of-bounds write")
    Fixes: cd9e9808d18f ("lightnvm: Support for Open-Channel SSDs")
    Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index db38a68abb6c0..a6f4ca438bca1 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -1315,8 +1315,9 @@ static long nvm_ioctl_get_devices(struct file *file, void __user *arg)
 		strlcpy(info->bmname, "gennvm", sizeof(info->bmname));
 		i++;
 
-		if (i > 31) {
-			pr_err("max 31 devices can be reported.\n");
+		if (i >= ARRAY_SIZE(devices->info)) {
+			pr_err("max %zd devices can be reported.\n",
+			       ARRAY_SIZE(devices->info));
 			break;
 		}
 	}



[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