Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 75492
b: refs/heads/master
c: f951375
h: refs/heads/master
v: v3
  • Loading branch information
Dave Young authored and David S. Miller committed Jan 11, 2008
1 parent aca9450 commit 297da5f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ecd2ebdea350c40e73c00d400d74c8a09c072082
refs/heads/master: f951375d470c1a20d92c34377991197e6bf17990
22 changes: 13 additions & 9 deletions trunk/net/bluetooth/rfcomm/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ static void rfcomm_dev_destruct(struct rfcomm_dev *dev)

BT_DBG("dev %p dlc %p", dev, dlc);

write_lock_bh(&rfcomm_dev_lock);
list_del_init(&dev->list);
write_unlock_bh(&rfcomm_dev_lock);
/* Refcount should only hit zero when called from rfcomm_dev_del()
which will have taken us off the list. Everything else are
refcounting bugs. */
BUG_ON(!list_empty(&dev->list));

rfcomm_dlc_lock(dlc);
/* Detach DLC if it's owned by this dev */
Expand All @@ -109,11 +110,6 @@ static void rfcomm_dev_destruct(struct rfcomm_dev *dev)

tty_unregister_device(rfcomm_tty_driver, dev->id);

/* Refcount should only hit zero when called from rfcomm_dev_del()
which will have taken us off the list. Everything else are
refcounting bugs. */
BUG_ON(!list_empty(&dev->list));

kfree(dev);

/* It's safe to call module_put() here because socket still
Expand Down Expand Up @@ -313,7 +309,15 @@ static void rfcomm_dev_del(struct rfcomm_dev *dev)
{
BT_DBG("dev %p", dev);

set_bit(RFCOMM_TTY_RELEASED, &dev->flags);
if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags))
BUG_ON(1);
else
set_bit(RFCOMM_TTY_RELEASED, &dev->flags);

write_lock_bh(&rfcomm_dev_lock);
list_del_init(&dev->list);
write_unlock_bh(&rfcomm_dev_lock);

rfcomm_dev_put(dev);
}

Expand Down

0 comments on commit 297da5f

Please sign in to comment.