]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: most: hdm-usb: Remove invalid reference error
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>
Fri, 11 Mar 2016 18:41:47 +0000 (00:11 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 12 Mar 2016 06:09:09 +0000 (22:09 -0800)
commit e3479f77("staging: most: hdm-usb: Remove create_workqueue()")
cancel_work_sync(&anchor->clear_work_obj) is introduced after freeing
`anchor` causing a invalid reference error. This patch removes this
error by shifting the call to cancel_work_sync before freeing
`anchor`.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/most/hdm-usb/hdm_usb.c

index 78031abaf8570f0b216e0ca0edb692a7ac68de05..aeae071f28232170fe0685a7675b4262f7e9ec8b 100644 (file)
@@ -221,11 +221,10 @@ static void free_anchored_buffers(struct most_dev *mdev, unsigned int channel)
                }
                spin_lock_irqsave(&mdev->anchor_list_lock[channel], flags);
                list_del(&anchor->list);
+               cancel_work_sync(&anchor->clear_work_obj);
                kfree(anchor);
        }
        spin_unlock_irqrestore(&mdev->anchor_list_lock[channel], flags);
-
-       cancel_work_sync(&anchor->clear_work_obj);
 }
 
 /**