Skip to contentSkip to conversation

staging/lustre/lov: Move target sysfs symlink removal to LOV freeing

PATCH New [email protected] 1 participant 1 message Jun 24, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging/lustre/lov: Move target sysfs symlink removal to LOV freeing

From: Oleg Drokin <[email protected]>

This helps to avoid use after free on unmount.

---
 drivers/staging/lustre/lustre/lov/lov_obd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/lov/lov_obd.c +4 -3
index 96c55ac..134b663 100644
@@ -107,6 +107,10 @@ static void lov_putref(struct obd_device *obd)
 			/* Disconnect */
 			__lov_del_obd(obd, tgt);
 		}
+
+		if (lov->lov_tgts_kobj)
+			kobject_put(lov->lov_tgts_kobj);
+
 	} else {
 		mutex_unlock(&lov->lov_lock);
 	}
@@ -322,9 +326,6 @@ static int lov_disconnect(struct obd_export *exp)
 		}
 	}
 
-	if (lov->lov_tgts_kobj)
-		kobject_put(lov->lov_tgts_kobj);
-
 	obd_putref(obd);
 
 out:
Signature · 1 line
2.1.0