Patch "s390/dasd: fix error checks in dasd_copy_pair_store()" has been added to the 6.6-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

    s390/dasd: fix error checks in dasd_copy_pair_store()

to the 6.6-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:
     s390-dasd-fix-error-checks-in-dasd_copy_pair_store.patch
and it can be found in the queue-6.6 subdirectory.

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



commit 8171315fd1d8e164c60f62786d607b7cbd4dfb51
Author: Carlos López <clopez@xxxxxxx>
Date:   Mon Jul 15 13:24:34 2024 +0200

    s390/dasd: fix error checks in dasd_copy_pair_store()
    
    [ Upstream commit 8e64d2356cbc800b4cd0e3e614797f76bcf0cdb8 ]
    
    dasd_add_busid() can return an error via ERR_PTR() if an allocation
    fails. However, two callsites in dasd_copy_pair_store() do not check
    the result, potentially resulting in a NULL pointer dereference. Fix
    this by checking the result with IS_ERR() and returning the error up
    the stack.
    
    Fixes: a91ff09d39f9b ("s390/dasd: add copy pair setup")
    Signed-off-by: Carlos López <clopez@xxxxxxx>
    Signed-off-by: Stefan Haberland <sth@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240715112434.2111291-3-sth@xxxxxxxxxxxxx
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c
index c4e36650c4264..91522dba9fd98 100644
--- a/drivers/s390/block/dasd_devmap.c
+++ b/drivers/s390/block/dasd_devmap.c
@@ -2258,13 +2258,19 @@ static ssize_t dasd_copy_pair_store(struct device *dev,
 
 	/* allocate primary devmap if needed */
 	prim_devmap = dasd_find_busid(prim_busid);
-	if (IS_ERR(prim_devmap))
+	if (IS_ERR(prim_devmap)) {
 		prim_devmap = dasd_add_busid(prim_busid, DASD_FEATURE_DEFAULT);
+		if (IS_ERR(prim_devmap))
+			return PTR_ERR(prim_devmap);
+	}
 
 	/* allocate secondary devmap if needed */
 	sec_devmap = dasd_find_busid(sec_busid);
-	if (IS_ERR(sec_devmap))
+	if (IS_ERR(sec_devmap)) {
 		sec_devmap = dasd_add_busid(sec_busid, DASD_FEATURE_DEFAULT);
+		if (IS_ERR(sec_devmap))
+			return PTR_ERR(sec_devmap);
+	}
 
 	/* setting copy relation is only allowed for offline secondary */
 	if (sec_devmap->device)




[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