From 1b8adfc4945860444d64719d076c4e14c0544384 Mon Sep 17 00:00:00 2001 From: Olaf Faaland Date: Mon, 21 Mar 2016 13:32:23 -0700 Subject: [PATCH] LU-7893 osd-zfs: calls dmu_objset_disown() with NULL When a ZFS-backed target is mounted, and dmu_objset_own() fails, osd_mount() follows a goto err: and calls dmu_objset_disown(NULL). This triggers a kernel panic due to NULL pointer dereference. Call dmu_objset_disown() only if objset_t o->od_os is non-NULL. Signed-off-by: Olaf Faaland Change-Id: I04ce39fbf97a87978c5819731ee1eba9debe6db2 Reviewed-on: http://review.whamcloud.com/19052 Tested-by: Jenkins Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/osd-zfs/osd_handler.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c index 9c19163..43ae76d 100644 --- a/lustre/osd-zfs/osd_handler.c +++ b/lustre/osd-zfs/osd_handler.c @@ -1028,7 +1028,8 @@ static int osd_mount(const struct lu_env *env, osd_unlinked_drain(env, o); err: if (rc) { - dmu_objset_disown(o->od_os, o); + if (o->od_os) + dmu_objset_disown(o->od_os, o); o->od_os = NULL; } -- 1.8.3.1