megaraid_sas: missing curly braces in megasas_detach_one()
Subsystems (3)
PATCH 2/2 megaraid_sas: missing curly braces in megasas_detach_one()
The indenting indicates that there are supposed to be some curly braces here. Presumably it means we free something unintentionally leading to a use after free.
---
Not tested.
drivers/scsi/megaraid/megaraid_sas_base.c +2 -1
@@ -5932,7 +5932,7 @@ static void megasas_detach_one(struct pci_dev *pdev) fusion->max_map_sz, fusion->ld_map[i], fusion->ld_map_phys[i]); -if (fusion->ld_drv_map[i]) +if (fusion->ld_drv_map[i]) {free_pages ((ulong )fusion->ld_drv_map[i], fusion->drv_map_pages);if (fusion->pd_seq_sync)
@@ -5940,6 +5940,7 @@ static void megasas_detach_one(struct pci_dev *pdev) pd_seq_map_sz, fusion->pd_seq_sync[i], fusion->pd_seq_phys[i]); + } }free_pages ((ulong )instance->ctrl_context, instance->ctrl_context_pages);
Quoted 11 lines
-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Saturday, November 07, 2015 9:47 PM
To: Kashyap Desai; Sumit Saxena
Cc: Uday Lingala; James E.J. Bottomley; [email protected]; [email protected]; [email protected]
Subject: [patch 2/2]megaraid_sas: missing curly braces inmegasas_detach_one()The indenting indicates that there are supposed to be some curly braces here. Presumably it means we free something unintentionally leading to
a
Quoted 1 line
use after free.
NACK. Indentation is wrong. We don't need to add braces. We will fix indentation and resend patch. Since this is not critical, let's ignore for now.
Quoted 30 lines
Fixes 3761cb4cf65e ('megaraid_sas: JBOD sequence number support')Signed-off-by Dan Carpenter <[email protected]>---
Not tested.drivers/scsi/megaraid/megaraid_sas_base.c +1
-1@@ -5932,7 +5932,7 @@ static void megasas_detach_one(struct pci_dev *pdev) fusion->max_map_sz, fusion->ld_map[i], fusion->ld_map_phys[i]); -if (fusion->ld_drv_map[i]) +if (fusion->ld_drv_map[i]) {free_pages ((ulong )fusion->ld_drv_map[i], fusion->drv_map_pages);drivers/scsi/megaraid/megaraid_sas_base.c +1
-0if (fusion->pd_seq_sync)@@ -5940,6 +5940,7 @@ static void megasas_detach_one(struct pci_dev *pdev) pd_seq_map_sz, fusion->pd_seq_sync[i], fusion->pd_seq_phys[i]); + } } free_pages((ulong)instance->ctrl_context,
instance->ctrl_context_pages);