Skip to contentSkip to conversation

CONNECTOR: don't touch queue dev after decrement of ref count

PATCH In review Li Zefan 3 participants 3 messages Jan 9, 2008 Network drivers

lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/1 CONNECTOR: don't touch queue dev after decrement of ref count

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

---
 drivers/connector/cn_queue.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/connector/cn_queue.c +1 -1
index 23cc87a..5732ca3 100644
@@ -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;
 	}
 
Signature · 1 line
1.5.3.rc7
maintainer
#1 lore raw

From: Li Zefan <[email protected]>
Date: Wed, 09 Jan 2008 13:44:07 +0800

Quoted 5 lines

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

Excellent catch, patch applied.

Thanks.