Patch "ata: pata_platform: Fix a NULL pointer dereference in __pata_platform_probe()" has been added to the 5.15-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

    ata: pata_platform: Fix a NULL pointer dereference in __pata_platform_probe()

to the 5.15-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:
     ata-pata_platform-fix-a-null-pointer-dereference-in-.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 90f2c29d576e5d334b8ab4ec4ea7d3cef563db91
Author: Zhou Qingyang <zhou1615@xxxxxxx>
Date:   Tue Jan 25 00:45:25 2022 +0800

    ata: pata_platform: Fix a NULL pointer dereference in __pata_platform_probe()
    
    [ Upstream commit 9b6d90e2085ca2ce72ef9ea78658bf270855e62e ]
    
    In __pata_platform_probe(), devm_kzalloc() is assigned to ap->ops and
    there is a dereference of it right after that, which could introduce a
    NULL pointer dereference bug.
    
    Fix this by adding a NULL check of ap->ops.
    
    This bug was found by a static analyzer.
    
    Builds with 'make allyesconfig' show no new warnings,
    and our static analyzer no longer warns about this code.
    
    Fixes: f3d5e4f18dba ("ata: pata_of_platform: Allow to use 16-bit wide data transfer")
    Signed-off-by: Zhou Qingyang <zhou1615@xxxxxxx>
    Signed-off-by: Damien Le Moal <damien.lemoal@xxxxxxxxxxxxxxxxxx>
    Reviewed-by: Sergey Shtylyov <s.shtylyov@xxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index 028329428b75d..87c7c90676ca0 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -128,6 +128,8 @@ int __pata_platform_probe(struct device *dev, struct resource *io_res,
 	ap = host->ports[0];
 
 	ap->ops = devm_kzalloc(dev, sizeof(*ap->ops), GFP_KERNEL);
+	if (!ap->ops)
+		return -ENOMEM;
 	ap->ops->inherits = &ata_sff_port_ops;
 	ap->ops->cable_detect = ata_cable_unknown;
 	ap->ops->set_mode = pata_platform_set_mode;



[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