aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2007-08-28 07:02:24 +0200
committerWilly Tarreau <w@1wt.eu>2007-08-28 12:14:54 +0200
commit1bb9509b816c7a60362a26d1ca40f0187bca5681 (patch)
treeacb26d3688c02b61b50abc73a9476ff7f762ab7f /net
parentd5ed625ecf13099711051731d243a808b9bea0da (diff)
[PATCH] Revert "Keep rfcomm_dev on the list until it is freed"
Randy Dunlap and Boris B. Zhmurov reported build failure of rfcomm/tty.c since 2.6.20.17. Marcel Holtmann confirmed that the following patch was inappropriate for this kernel. Remove it. This reverts commit 8c25e9c9cd1fed0d5f57075b584c39a4b9af9830. Cc: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/rfcomm/tty.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index 26e8c022ad9..e1b866323d4 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -93,10 +93,6 @@ 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);
-
rfcomm_dlc_lock(dlc);
/* Detach DLC if it's owned by this dev */
if (dlc->owner == dev)
@@ -158,13 +154,8 @@ static inline struct rfcomm_dev *rfcomm_dev_get(int id)
read_lock(&rfcomm_dev_lock);
dev = __rfcomm_dev_get(id);
-
- if (dev) {
- if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags))
- dev = NULL;
- else
- rfcomm_dev_hold(dev);
- }
+ if (dev)
+ rfcomm_dev_hold(dev);
read_unlock(&rfcomm_dev_lock);
@@ -272,12 +263,6 @@ out:
tty_register_device(rfcomm_tty_driver, dev->id, rfcomm_get_device(dev));
- if (IS_ERR(dev->tty_dev)) {
- list_del(&dev->list);
- kfree(dev);
- return PTR_ERR(dev->tty_dev);
- }
-
return dev->id;
}
@@ -285,7 +270,10 @@ static void rfcomm_dev_del(struct rfcomm_dev *dev)
{
BT_DBG("dev %p", dev);
- 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);
}
@@ -339,7 +327,7 @@ static int rfcomm_create_dev(struct sock *sk, void __user *arg)
if (copy_from_user(&req, arg, sizeof(req)))
return -EFAULT;
- BT_DBG("sk %p dev_id %d flags 0x%x", sk, req.dev_id, req.flags);
+ BT_DBG("sk %p dev_id %id flags 0x%x", sk, req.dev_id, req.flags);
if (req.flags != NOCAP_FLAGS && !capable(CAP_NET_ADMIN))
return -EPERM;
@@ -380,7 +368,7 @@ static int rfcomm_release_dev(void __user *arg)
if (copy_from_user(&req, arg, sizeof(req)))
return -EFAULT;
- BT_DBG("dev_id %d flags 0x%x", req.dev_id, req.flags);
+ BT_DBG("dev_id %id flags 0x%x", req.dev_id, req.flags);
if (!(dev = rfcomm_dev_get(req.dev_id)))
return -ENODEV;
@@ -429,8 +417,6 @@ static int rfcomm_get_dev_list(void __user *arg)
list_for_each(p, &rfcomm_dev_list) {
struct rfcomm_dev *dev = list_entry(p, struct rfcomm_dev, list);
- if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags))
- continue;
(di + n)->id = dev->id;
(di + n)->flags = dev->flags;
(di + n)->state = dev->dlc->state;