aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorSelvan Mani <smani@micron.com>2015-06-24 10:48:46 -0400
committerJens Axboe <axboe@fb.com>2015-06-24 10:48:46 -0400
commit98f57c5196f7a1f681246858f5860c1120d01ca9 (patch)
tree1bda5604571185810e22be1258890d9664bff43a /drivers/block
parent51ef72bda70841fddd595142ed0e7e0fc571c500 (diff)
mtip32xx: Fix accessing freed memory
In mtip_pci_remove(), driver data 'dd' is accessed after freeing it. This is a residue of SRSI code cleanup in the patch 016a41c38821 "mtip32xx: fix crash on surprise removal of the drive". Removed the bit flags MTIP_DDF_REMOVE_DONE_BIT and MTIP_PF_SR_CLEANUP_BIT. Reported-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Vignesh Gunasekaran <vgunasekaran@micron.com> Signed-off-by: Selvan Mani <smani@micron.com> Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/mtip32xx/mtip32xx.c19
-rw-r--r--drivers/block/mtip32xx/mtip32xx.h2
2 files changed, 0 insertions, 21 deletions
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 144e7d97b647..4a2ef09e6704 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -163,12 +163,6 @@ static bool mtip_check_surprise_removal(struct pci_dev *pdev)
163 else 163 else
164 dev_warn(&dd->pdev->dev, 164 dev_warn(&dd->pdev->dev,
165 "%s: dd->queue is NULL\n", __func__); 165 "%s: dd->queue is NULL\n", __func__);
166 if (dd->port) {
167 set_bit(MTIP_PF_SR_CLEANUP_BIT, &dd->port->flags);
168 wake_up_interruptible(&dd->port->svc_wait);
169 } else
170 dev_warn(&dd->pdev->dev,
171 "%s: dd->port is NULL\n", __func__);
172 return true; /* device removed */ 166 return true; /* device removed */
173 } 167 }
174 168
@@ -2938,10 +2932,6 @@ static int mtip_service_thread(void *data)
2938 test_bit(MTIP_PF_SVC_THD_STOP_BIT, &port->flags)) 2932 test_bit(MTIP_PF_SVC_THD_STOP_BIT, &port->flags))
2939 goto st_out; 2933 goto st_out;
2940 2934
2941 /* If I am an orphan, start self cleanup */
2942 if (test_bit(MTIP_PF_SR_CLEANUP_BIT, &port->flags))
2943 break;
2944
2945 if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, 2935 if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT,
2946 &dd->dd_flag))) 2936 &dd->dd_flag)))
2947 goto st_out; 2937 goto st_out;
@@ -2995,14 +2985,6 @@ restart_eh:
2995 } 2985 }
2996 } 2986 }
2997 2987
2998 /* wait for pci remove to exit */
2999 while (1) {
3000 if (test_bit(MTIP_DDF_REMOVE_DONE_BIT, &dd->dd_flag))
3001 break;
3002 msleep_interruptible(1000);
3003 if (kthread_should_stop())
3004 goto st_out;
3005 }
3006st_out: 2988st_out:
3007 return 0; 2989 return 0;
3008} 2990}
@@ -4486,7 +4468,6 @@ static void mtip_pci_remove(struct pci_dev *pdev)
4486 spin_unlock_irqrestore(&dev_lock, flags); 4468 spin_unlock_irqrestore(&dev_lock, flags);
4487 4469
4488 kfree(dd); 4470 kfree(dd);
4489 set_bit(MTIP_DDF_REMOVE_DONE_BIT, &dd->dd_flag);
4490 4471
4491 pcim_iounmap_regions(pdev, 1 << MTIP_ABAR); 4472 pcim_iounmap_regions(pdev, 1 << MTIP_ABAR);
4492 pci_set_drvdata(pdev, NULL); 4473 pci_set_drvdata(pdev, NULL);
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h
index d7a545974c78..3274784008eb 100644
--- a/drivers/block/mtip32xx/mtip32xx.h
+++ b/drivers/block/mtip32xx/mtip32xx.h
@@ -142,7 +142,6 @@ enum {
142 MTIP_PF_SVC_THD_ACTIVE_BIT = 4, 142 MTIP_PF_SVC_THD_ACTIVE_BIT = 4,
143 MTIP_PF_ISSUE_CMDS_BIT = 5, 143 MTIP_PF_ISSUE_CMDS_BIT = 5,
144 MTIP_PF_REBUILD_BIT = 6, 144 MTIP_PF_REBUILD_BIT = 6,
145 MTIP_PF_SR_CLEANUP_BIT = 7,
146 MTIP_PF_SVC_THD_STOP_BIT = 8, 145 MTIP_PF_SVC_THD_STOP_BIT = 8,
147 146
148 /* below are bit numbers in 'dd_flag' defined in driver_data */ 147 /* below are bit numbers in 'dd_flag' defined in driver_data */
@@ -150,7 +149,6 @@ enum {
150 MTIP_DDF_REMOVE_PENDING_BIT = 1, 149 MTIP_DDF_REMOVE_PENDING_BIT = 1,
151 MTIP_DDF_OVER_TEMP_BIT = 2, 150 MTIP_DDF_OVER_TEMP_BIT = 2,
152 MTIP_DDF_WRITE_PROTECT_BIT = 3, 151 MTIP_DDF_WRITE_PROTECT_BIT = 3,
153 MTIP_DDF_REMOVE_DONE_BIT = 4,
154 MTIP_DDF_CLEANUP_BIT = 5, 152 MTIP_DDF_CLEANUP_BIT = 5,
155 MTIP_DDF_RESUME_BIT = 6, 153 MTIP_DDF_RESUME_BIT = 6,
156 MTIP_DDF_INIT_DONE_BIT = 7, 154 MTIP_DDF_INIT_DONE_BIT = 7,