From 453715a78df69ef2948d7f49fc8b74a6a3ec6237 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Wed, 12 Apr 2017 16:56:39 -0700 Subject: [PATCH] Only shutdown locks that were setup Lock shutdown was crashing trying to deref a null linf on cleanup from mont errors that happened before locks were setup. Make sure lock shutdown only tries to do work if the locks have been setup. Signed-off-by: Zach Brown --- kmod/src/lock.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/kmod/src/lock.c b/kmod/src/lock.c index e9f1c5a4..6078b024 100644 --- a/kmod/src/lock.c +++ b/kmod/src/lock.c @@ -336,11 +336,14 @@ void scoutfs_lock_shutdown(struct super_block *sb) DECLARE_LOCK_INFO(sb, linf); struct held_locks *held = linf->held; - spin_lock(&held->lock); - linf->shutdown = true; - spin_unlock(&held->lock); + if (linf) { + held = linf->held; + spin_lock(&held->lock); + linf->shutdown = true; + spin_unlock(&held->lock); - wake_up(&held->waitq); + wake_up(&held->waitq); + } } void scoutfs_lock_destroy(struct super_block *sb)