[PATCH 3/7] dm snapshot: fix pending pe ref

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Avoid references to 'pe->primary_pe' after freeing 'pe'.

Signed-Off-By: Alasdair G Kergon <[email protected]>
Index: linux-2.6.16-rc1/drivers/md/dm-snap.c
===================================================================
--- linux-2.6.16-rc1.orig/drivers/md/dm-snap.c	2006-02-06 23:18:03.000000000 +0000
+++ linux-2.6.16-rc1/drivers/md/dm-snap.c	2006-02-06 23:18:44.000000000 +0000
@@ -651,6 +651,7 @@ static void __invalidate_snapshot(struct
 static void pending_complete(struct pending_exception *pe, int success)
 {
 	struct exception *e;
+	struct pending_exception *primary_pe;
 	struct dm_snapshot *s = pe->snap;
 	struct bio *flush = NULL;
 
@@ -702,18 +703,20 @@ static void pending_complete(struct pend
 	flush_bios(bio_list_get(&pe->snapshot_bios));
 
  out:
+	primary_pe = pe->primary_pe;
+
 	/*
 	 * Free the pe if it's not linked to an origin write or if
 	 * it's not itself a primary pe.
 	 */
-	if (!pe->primary_pe || pe->primary_pe != pe)
+	if (!primary_pe || primary_pe != pe)
 		free_pending_exception(pe);
 
 	/*
 	 * Free the primary pe if nothing references it.
 	 */
-	if (pe->primary_pe && !atomic_read(&pe->primary_pe->sibling_count))
-		free_pending_exception(pe->primary_pe);
+	if (primary_pe && !atomic_read(&primary_pe->sibling_count))
+		free_pending_exception(primary_pe);
 
 	if (flush)
 		flush_bios(flush);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux