]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
scsi: hisi_sas: Check sas_port before using it
authorXiang Chen <chenxiang66@hisilicon.com>
Thu, 26 Dec 2019 06:52:00 +0000 (07:52 +0100)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 24 Jan 2020 12:36:42 +0000 (09:36 -0300)
BugLink: https://launchpad.net/bugs/1855952
Need to check the structure sas_port before using it.

Link: https://lore.kernel.org/r/1573551059-107873-2-git-send-email-john.garry@huawei.com
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 8c39673d5474b95374df2104dc1f65205c5278b8)
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Acked-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/scsi/hisi_sas/hisi_sas_main.c

index cb746cfc2fa89d37d3f6fb8e8bc1a2a2d3a7407d..4a991e79ff237f5ec3b3796340fa001b970cbda3 100644 (file)
@@ -1000,12 +1000,13 @@ static void hisi_sas_port_notify_formed(struct asd_sas_phy *sas_phy)
        struct hisi_hba *hisi_hba = sas_ha->lldd_ha;
        struct hisi_sas_phy *phy = sas_phy->lldd_phy;
        struct asd_sas_port *sas_port = sas_phy->port;
-       struct hisi_sas_port *port = to_hisi_sas_port(sas_port);
+       struct hisi_sas_port *port;
        unsigned long flags;
 
        if (!sas_port)
                return;
 
+       port = to_hisi_sas_port(sas_port);
        spin_lock_irqsave(&hisi_hba->lock, flags);
        port->port_attached = 1;
        port->id = phy->port_id;