Skip to content

Commit 458af54

Browse files
AdrianBunkLinus Torvalds
authored andcommitted
[PATCH] drivers/scsi/dpt_i2o.c: fix a NULL pointer dereference
The Coverity checker spotted this obvious NULL pointer dereference. Signed-off-by: Adrian Bunk <[email protected]> Acked-by: Mark Salyzyn <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 2012a11 commit 458af54

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/scsi/dpt_i2o.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ static int adpt_hba_reset(adpt_hba* pHba)
816816
static void adpt_i2o_sys_shutdown(void)
817817
{
818818
adpt_hba *pHba, *pNext;
819-
struct adpt_i2o_post_wait_data *p1, *p2;
819+
struct adpt_i2o_post_wait_data *p1, *old;
820820

821821
printk(KERN_INFO"Shutting down Adaptec I2O controllers.\n");
822822
printk(KERN_INFO" This could take a few minutes if there are many devices attached\n");
@@ -830,13 +830,14 @@ static void adpt_i2o_sys_shutdown(void)
830830
}
831831

832832
/* Remove any timedout entries from the wait queue. */
833-
p2 = NULL;
834833
// spin_lock_irqsave(&adpt_post_wait_lock, flags);
835834
/* Nothing should be outstanding at this point so just
836835
* free them
837836
*/
838-
for(p1 = adpt_post_wait_queue; p1; p2 = p1, p1 = p2->next) {
839-
kfree(p1);
837+
for(p1 = adpt_post_wait_queue; p1;) {
838+
old = p1;
839+
p1 = p1->next;
840+
kfree(old);
840841
}
841842
// spin_unlock_irqrestore(&adpt_post_wait_lock, flags);
842843
adpt_post_wait_queue = NULL;

0 commit comments

Comments
 (0)