Skip to content

Commit 392eaef

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: tcp: Fix tcp_hybla zero congestion window growth with small rho and large cwnd. net: Fix netdev_run_todo dead-lock tcp: Fix possible double-ack w/ user dma net: only invoke dev->change_rx_flags when device is UP netrom: Fix sock_orphan() use in nr_release ax25: Quick fix for making sure unaccepted sockets get destroyed. Revert "ax25: Fix std timer socket destroy handling." [Bluetooth] Add reset quirk for A-Link BlueUSB21 dongle [Bluetooth] Add reset quirk for new Targus and Belkin dongles [Bluetooth] Fix double frees on error paths of btusb and bpa10x drivers
2 parents 85ba94b + 9d2c27e commit 392eaef

File tree

9 files changed

+38
-39
lines changed

9 files changed

+38
-39
lines changed

drivers/bluetooth/bpa10x.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ static inline int bpa10x_submit_intr_urb(struct hci_dev *hdev)
256256
BT_ERR("%s urb %p submission failed (%d)",
257257
hdev->name, urb, -err);
258258
usb_unanchor_urb(urb);
259-
kfree(buf);
260259
}
261260

262261
usb_free_urb(urb);
@@ -298,7 +297,6 @@ static inline int bpa10x_submit_bulk_urb(struct hci_dev *hdev)
298297
BT_ERR("%s urb %p submission failed (%d)",
299298
hdev->name, urb, -err);
300299
usb_unanchor_urb(urb);
301-
kfree(buf);
302300
}
303301

304302
usb_free_urb(urb);

drivers/bluetooth/btusb.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ static struct usb_device_id blacklist_table[] = {
102102
{ USB_DEVICE(0x0a5c, 0x2101), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
103103

104104
/* Broadcom BCM2046 */
105+
{ USB_DEVICE(0x0a5c, 0x2146), .driver_info = BTUSB_RESET },
105106
{ USB_DEVICE(0x0a5c, 0x2151), .driver_info = BTUSB_RESET },
106107

107108
/* Apple MacBook Pro with Broadcom chip */
@@ -113,6 +114,7 @@ static struct usb_device_id blacklist_table[] = {
113114

114115
/* Targus ACB10US */
115116
{ USB_DEVICE(0x0a5c, 0x2100), .driver_info = BTUSB_RESET },
117+
{ USB_DEVICE(0x0a5c, 0x2154), .driver_info = BTUSB_RESET },
116118

117119
/* ANYCOM Bluetooth USB-200 and USB-250 */
118120
{ USB_DEVICE(0x0a5c, 0x2111), .driver_info = BTUSB_RESET },
@@ -150,6 +152,9 @@ static struct usb_device_id blacklist_table[] = {
150152
{ USB_DEVICE(0x050d, 0x0012), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
151153
{ USB_DEVICE(0x050d, 0x0013), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
152154

155+
/* Belkin F8T016 device */
156+
{ USB_DEVICE(0x050d, 0x016a), .driver_info = BTUSB_RESET },
157+
153158
/* Digianswer devices */
154159
{ USB_DEVICE(0x08fd, 0x0001), .driver_info = BTUSB_DIGIANSWER },
155160
{ USB_DEVICE(0x08fd, 0x0002), .driver_info = BTUSB_IGNORE },
@@ -271,7 +276,6 @@ static int btusb_submit_intr_urb(struct hci_dev *hdev)
271276
BT_ERR("%s urb %p submission failed (%d)",
272277
hdev->name, urb, -err);
273278
usb_unanchor_urb(urb);
274-
kfree(buf);
275279
}
276280

277281
usb_free_urb(urb);
@@ -354,7 +358,6 @@ static int btusb_submit_bulk_urb(struct hci_dev *hdev)
354358
BT_ERR("%s urb %p submission failed (%d)",
355359
hdev->name, urb, -err);
356360
usb_unanchor_urb(urb);
357-
kfree(buf);
358361
}
359362

360363
usb_free_urb(urb);
@@ -475,7 +478,6 @@ static int btusb_submit_isoc_urb(struct hci_dev *hdev)
475478
BT_ERR("%s urb %p submission failed (%d)",
476479
hdev->name, urb, -err);
477480
usb_unanchor_urb(urb);
478-
kfree(buf);
479481
}
480482

481483
usb_free_urb(urb);

net/ax25/af_ax25.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ void ax25_destroy_socket(ax25_cb *ax25)
317317
/* Queue the unaccepted socket for death */
318318
sock_orphan(skb->sk);
319319

320+
/* 9A4GL: hack to release unaccepted sockets */
321+
skb->sk->sk_state = TCP_LISTEN;
322+
320323
ax25_start_heartbeat(sax25);
321324
sax25->state = AX25_STATE_0;
322325
}

net/ax25/ax25_std_timer.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ void ax25_std_heartbeat_expiry(ax25_cb *ax25)
3939

4040
switch (ax25->state) {
4141
case AX25_STATE_0:
42-
if (!sk ||
43-
sock_flag(sk, SOCK_DESTROY) ||
44-
sock_flag(sk, SOCK_DEAD)) {
42+
/* Magic here: If we listen() and a new link dies before it
43+
is accepted() it isn't 'dead' so doesn't get removed. */
44+
if (!sk || sock_flag(sk, SOCK_DESTROY) ||
45+
(sk->sk_state == TCP_LISTEN &&
46+
sock_flag(sk, SOCK_DEAD))) {
4547
if (sk) {
4648
sock_hold(sk);
4749
ax25_destroy_socket(ax25);

net/core/dev.c

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2918,6 +2918,12 @@ int netdev_set_master(struct net_device *slave, struct net_device *master)
29182918
return 0;
29192919
}
29202920

2921+
static void dev_change_rx_flags(struct net_device *dev, int flags)
2922+
{
2923+
if (dev->flags & IFF_UP && dev->change_rx_flags)
2924+
dev->change_rx_flags(dev, flags);
2925+
}
2926+
29212927
static int __dev_set_promiscuity(struct net_device *dev, int inc)
29222928
{
29232929
unsigned short old_flags = dev->flags;
@@ -2955,8 +2961,7 @@ static int __dev_set_promiscuity(struct net_device *dev, int inc)
29552961
current->uid, current->gid,
29562962
audit_get_sessionid(current));
29572963

2958-
if (dev->change_rx_flags)
2959-
dev->change_rx_flags(dev, IFF_PROMISC);
2964+
dev_change_rx_flags(dev, IFF_PROMISC);
29602965
}
29612966
return 0;
29622967
}
@@ -3022,8 +3027,7 @@ int dev_set_allmulti(struct net_device *dev, int inc)
30223027
}
30233028
}
30243029
if (dev->flags ^ old_flags) {
3025-
if (dev->change_rx_flags)
3026-
dev->change_rx_flags(dev, IFF_ALLMULTI);
3030+
dev_change_rx_flags(dev, IFF_ALLMULTI);
30273031
dev_set_rx_mode(dev);
30283032
}
30293033
return 0;
@@ -3347,8 +3351,8 @@ int dev_change_flags(struct net_device *dev, unsigned flags)
33473351
* Load in the correct multicast list now the flags have changed.
33483352
*/
33493353

3350-
if (dev->change_rx_flags && (old_flags ^ flags) & IFF_MULTICAST)
3351-
dev->change_rx_flags(dev, IFF_MULTICAST);
3354+
if ((old_flags ^ flags) & IFF_MULTICAST)
3355+
dev_change_rx_flags(dev, IFF_MULTICAST);
33523356

33533357
dev_set_rx_mode(dev);
33543358

@@ -3808,14 +3812,11 @@ static int dev_new_index(struct net *net)
38083812
}
38093813

38103814
/* Delayed registration/unregisteration */
3811-
static DEFINE_SPINLOCK(net_todo_list_lock);
38123815
static LIST_HEAD(net_todo_list);
38133816

38143817
static void net_set_todo(struct net_device *dev)
38153818
{
3816-
spin_lock(&net_todo_list_lock);
38173819
list_add_tail(&dev->todo_list, &net_todo_list);
3818-
spin_unlock(&net_todo_list_lock);
38193820
}
38203821

38213822
static void rollback_registered(struct net_device *dev)
@@ -4142,33 +4143,24 @@ static void netdev_wait_allrefs(struct net_device *dev)
41424143
* free_netdev(y1);
41434144
* free_netdev(y2);
41444145
*
4145-
* We are invoked by rtnl_unlock() after it drops the semaphore.
4146+
* We are invoked by rtnl_unlock().
41464147
* This allows us to deal with problems:
41474148
* 1) We can delete sysfs objects which invoke hotplug
41484149
* without deadlocking with linkwatch via keventd.
41494150
* 2) Since we run with the RTNL semaphore not held, we can sleep
41504151
* safely in order to wait for the netdev refcnt to drop to zero.
4152+
*
4153+
* We must not return until all unregister events added during
4154+
* the interval the lock was held have been completed.
41514155
*/
4152-
static DEFINE_MUTEX(net_todo_run_mutex);
41534156
void netdev_run_todo(void)
41544157
{
41554158
struct list_head list;
41564159

4157-
/* Need to guard against multiple cpu's getting out of order. */
4158-
mutex_lock(&net_todo_run_mutex);
4159-
4160-
/* Not safe to do outside the semaphore. We must not return
4161-
* until all unregister events invoked by the local processor
4162-
* have been completed (either by this todo run, or one on
4163-
* another cpu).
4164-
*/
4165-
if (list_empty(&net_todo_list))
4166-
goto out;
4167-
41684160
/* Snapshot list, allow later requests */
4169-
spin_lock(&net_todo_list_lock);
41704161
list_replace_init(&net_todo_list, &list);
4171-
spin_unlock(&net_todo_list_lock);
4162+
4163+
__rtnl_unlock();
41724164

41734165
while (!list_empty(&list)) {
41744166
struct net_device *dev
@@ -4200,9 +4192,6 @@ void netdev_run_todo(void)
42004192
/* Free network device */
42014193
kobject_put(&dev->dev.kobj);
42024194
}
4203-
4204-
out:
4205-
mutex_unlock(&net_todo_run_mutex);
42064195
}
42074196

42084197
static struct net_device_stats *internal_stats(struct net_device *dev)

net/core/rtnetlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void __rtnl_unlock(void)
7373

7474
void rtnl_unlock(void)
7575
{
76-
mutex_unlock(&rtnl_mutex);
76+
/* This fellow will unlock it for us. */
7777
netdev_run_todo();
7878
}
7979

net/ipv4/tcp_hybla.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,11 @@ static void hybla_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
150150
ca->snd_cwnd_cents -= 128;
151151
tp->snd_cwnd_cnt = 0;
152152
}
153-
153+
/* check when cwnd has not been incremented for a while */
154+
if (increment == 0 && odd == 0 && tp->snd_cwnd_cnt >= tp->snd_cwnd) {
155+
tp->snd_cwnd++;
156+
tp->snd_cwnd_cnt = 0;
157+
}
154158
/* clamp down slowstart cwnd to ssthresh value. */
155159
if (is_slowstart)
156160
tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh);

net/ipv4/tcp_input.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4879,7 +4879,8 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
48794879
goto no_ack;
48804880
}
48814881

4882-
__tcp_ack_snd_check(sk, 0);
4882+
if (!copied_early || tp->rcv_nxt != tp->rcv_wup)
4883+
__tcp_ack_snd_check(sk, 0);
48834884
no_ack:
48844885
#ifdef CONFIG_NET_DMA
48854886
if (copied_early)

net/netrom/af_netrom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ static int nr_release(struct socket *sock)
525525
if (sk == NULL) return 0;
526526

527527
sock_hold(sk);
528+
sock_orphan(sk);
528529
lock_sock(sk);
529530
nr = nr_sk(sk);
530531

@@ -548,7 +549,6 @@ static int nr_release(struct socket *sock)
548549
sk->sk_state = TCP_CLOSE;
549550
sk->sk_shutdown |= SEND_SHUTDOWN;
550551
sk->sk_state_change(sk);
551-
sock_orphan(sk);
552552
sock_set_flag(sk, SOCK_DESTROY);
553553
break;
554554

0 commit comments

Comments
 (0)