Skip to content

Commit

Permalink
Bluetooth: 6lowpan: use after free in disconnect_devices()
Browse files Browse the repository at this point in the history
This was accidentally changed from list_for_each_entry_safe() to
list_for_each_entry() so now it has a use after free bug.  I've changed
it back.

Fixes: 9030582 ('Bluetooth: 6lowpan: Converting rwlocks to use RCU')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Dan Carpenter authored and Marcel Holtmann committed Oct 30, 2014
1 parent 38130c3 commit daac197
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/bluetooth/6lowpan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ static const struct file_operations lowpan_control_fops = {

static void disconnect_devices(void)
{
struct lowpan_dev *entry, *new_dev;
struct lowpan_dev *entry, *tmp, *new_dev;
struct list_head devices;

INIT_LIST_HEAD(&devices);
Expand All @@ -1408,7 +1408,7 @@ static void disconnect_devices(void)

rcu_read_unlock();

list_for_each_entry(entry, &devices, list) {
list_for_each_entry_safe(entry, tmp, &devices, list) {
ifdown(entry->netdev);
BT_DBG("Unregistering netdev %s %p",
entry->netdev->name, entry->netdev);
Expand Down

0 comments on commit daac197

Please sign in to comment.