fs: dlm: drop lkb ref in bug case
authorAlexander Aring <aahringo@redhat.com>
Thu, 17 Nov 2022 22:11:41 +0000 (17:11 -0500)
committerDavid Teigland <teigland@redhat.com>
Mon, 21 Nov 2022 15:45:49 +0000 (09:45 -0600)
This patch will drop the lkb reference in an very unlikely case which
should in practice not happened. However if it happens we cleanup the
reference just in case.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
fs/dlm/ast.c

index 078bbbd..982d093 100644 (file)
@@ -186,7 +186,7 @@ void dlm_callback_work(struct work_struct *work)
        spin_unlock(&lkb->lkb_cb_lock);
 
        if (WARN_ON(rv == DLM_DEQUEUE_CALLBACK_EMPTY))
-               return;
+               goto out;
 
        for (;;) {
                castfn = lkb->lkb_astfn;
@@ -217,6 +217,7 @@ void dlm_callback_work(struct work_struct *work)
                spin_unlock(&lkb->lkb_cb_lock);
        }
 
+out:
        /* undo kref_get from dlm_add_callback, may cause lkb to be freed */
        dlm_put_lkb(lkb);
 }