]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
CONNECTOR: Don't touch queue dev after decrement of ref count.
authorLi Zefan <lizf@cn.fujitsu.com>
Fri, 11 Jan 2008 09:11:48 +0000 (01:11 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 8 Feb 2008 20:01:22 +0000 (12:01 -0800)
[CONNECTOR]: Don't touch queue dev after decrement of ref count.

[ Upstream commit: cf585ae8ae9ac7287a6d078425ea32f22bf7f1f7 ]

cn_queue_free_callback() will touch 'dev'(i.e. cbq->pdev), so it
should be called before atomic_dec(&dev->refcnt).

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/connector/cn_queue.c

index 296f51002b555a4398d0450f92d1c1392d61d70a..12ceed54ab18001f89b2e587106fa8fa7b20de82 100644 (file)
@@ -99,8 +99,8 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id
        spin_unlock_bh(&dev->queue_lock);
 
        if (found) {
-               atomic_dec(&dev->refcnt);
                cn_queue_free_callback(cbq);
+               atomic_dec(&dev->refcnt);
                return -EINVAL;
        }