From: Oleg Drokin Date: Wed, 24 Jun 2015 14:09:24 +0000 (-0400) Subject: staging/lustre/lov: Move target sysfs symlink removal to LOV freeing X-Git-Tag: v4.14-rc1~4839^2~734 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3c150f0081647c0b96ce0d61d541b9b470433676;p=platform%2Fkernel%2Flinux-rpi.git staging/lustre/lov: Move target sysfs symlink removal to LOV freeing This helps to avoid use after free on unmount. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index cd6ed58..5f4c115 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -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: