From: Dmitry Eremin Date: Tue, 25 Feb 2014 20:17:24 +0000 (+0400) Subject: LU-4629 obdclass: fix use after release X-Git-Tag: 2.5.58~65 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=7ccd55044110312c15d7e87a9a9cc3c72597b917 LU-4629 obdclass: fix use after release Pointer 'type->typ_name' checked for NULL at line 195 will be passed to function and may be dereferenced there by passing argument 1 to function 'lprocfs_try_remove_proc_entry' at line 246. Signed-off-by: Dmitry Eremin Change-Id: I697ffab97a5bd1ab55339722d87a3dfca5c1e173 Reviewed-on: http://review.whamcloud.com/9388 Tested-by: Jenkins Reviewed-by: John L. Hammond Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 89c315e..bf8b6ce 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -234,19 +234,21 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops, RETURN (0); failed: +#ifdef LPROCFS + if (type->typ_name != NULL) { +#ifndef HAVE_ONLY_PROCFS_SEQ + lprocfs_try_remove_proc_entry(type->typ_name, proc_lustre_root); +#else + remove_proc_subtree(type->typ_name, proc_lustre_root); +#endif + } +#endif if (type->typ_name != NULL) OBD_FREE(type->typ_name, strlen(name) + 1); if (type->typ_md_ops != NULL) OBD_FREE_PTR(type->typ_md_ops); if (type->typ_dt_ops != NULL) OBD_FREE_PTR(type->typ_dt_ops); -#ifdef LPROCFS -#ifndef HAVE_ONLY_PROCFS_SEQ - lprocfs_try_remove_proc_entry(type->typ_name, proc_lustre_root); -#else - remove_proc_subtree(type->typ_name, proc_lustre_root); -#endif -#endif OBD_FREE(type, sizeof(*type)); RETURN(rc); }