Patch "scsi: snic: Fix possible UAF in snic_tgt_create()" has been added to the 4.9-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: snic: Fix possible UAF in snic_tgt_create()

to the 4.9-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-snic-fix-possible-uaf-in-snic_tgt_create.patch
and it can be found in the queue-4.9 subdirectory.

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



commit 600bb1f102dad4f82fb3740cbbcc35f8637e43c2
Author: Gaosheng Cui <cuigaosheng1@xxxxxxxxxx>
Date:   Thu Nov 17 11:51:00 2022 +0800

    scsi: snic: Fix possible UAF in snic_tgt_create()
    
    [ Upstream commit e118df492320176af94deec000ae034cc92be754 ]
    
    Smatch reports a warning as follows:
    
    drivers/scsi/snic/snic_disc.c:307 snic_tgt_create() warn:
      '&tgt->list' not removed from list
    
    If device_add() fails in snic_tgt_create(), tgt will be freed, but
    tgt->list will not be removed from snic->disc.tgt_list, then list traversal
    may cause UAF.
    
    Remove from snic->disc.tgt_list before free().
    
    Fixes: c8806b6c9e82 ("snic: driver for Cisco SCSI HBA")
    Signed-off-by: Gaosheng Cui <cuigaosheng1@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221117035100.2944812-1-cuigaosheng1@xxxxxxxxxx
    Acked-by: Narsimhulu Musini <nmusini@xxxxxxxxx>
    Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/scsi/snic/snic_disc.c b/drivers/scsi/snic/snic_disc.c
index b106596cc0cf..69c5e26a9d5b 100644
--- a/drivers/scsi/snic/snic_disc.c
+++ b/drivers/scsi/snic/snic_disc.c
@@ -317,6 +317,9 @@ snic_tgt_create(struct snic *snic, struct snic_tgt_id *tgtid)
 			      ret);
 
 		put_device(&snic->shost->shost_gendev);
+		spin_lock_irqsave(snic->shost->host_lock, flags);
+		list_del(&tgt->list);
+		spin_unlock_irqrestore(snic->shost->host_lock, flags);
 		kfree(tgt);
 		tgt = NULL;
 



[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