Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Pull networking update from David Miller:
"A couple weeks of bug fixing in there. The largest chunk is all the
broken crap Amerigo Wang found in the netpoll layer."

1) netpoll and it's users has several serious bugs:
a) uses GFP_KERNEL with locks held
b) interfaces requiring interrupts disabled are called with them
enabled
c) and vice versa
d) VLAN tag demuxing, as per all other RX packet input paths, is not
applied

All from Amerigo Wang.

2) Hopefully cure the ipv4 mapped ipv6 address TCP early demux bugs for
good, from Neal Cardwell.

3) Unlike AF_UNIX, AF_PACKET sockets don't set a default credentials
when the user doesn't specify one explicitly during sendmsg().
Instead we attach an empty (zero) SCM credential block which is
definitely not what we want. Fix from Eric Dumazet.

4) IPv6 illegally invokes netdevice notifiers with RCU lock held, fix
from Ben Hutchings.

5) inet_csk_route_child_sock() checks wrong inet options pointer, fix
from Christoph Paasch.

6) When AF_PACKET is used for transmit, packet loopback doesn't behave
properly when a socket fanout is enabled, from Eric Leblond.

7) On bluetooth l2cap channel create failure, we leak the socket, from
Jaganath Kanakkassery.

8) Fix all the netprio file handling bugs found by Al Viro, from John
Fastabend.

9) Several error return and NULL deref bug fixes in networking drivers
from Julia Lawall.

10) A large smattering of struct padding et al. kernel memory leaks to
userspace found of Mathias Krause.

11) Conntrack expections in netfilter can access an uninitialized timer,
fix from Pablo Neira Ayuso.

12) Several netfilter SIP tracker bug fixes from Patrick McHardy.

13) IPSEC ipv6 routes are not initialized correctly all the time,
resulting in an OOPS in inet_putpeer(). Also from Patrick McHardy.

14) Bridging does rcu_dereference() outside of RCU protected area, from
Stephen Hemminger.

15) Fix routing cache removal performance regression when looking up
output routes that have a local destination. From Zheng Yan.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (87 commits)
af_netlink: force credentials passing [CVE-2012-3520]
ipv4: fix ip header ident selection in __ip_make_skb()
ipv4: Use newinet->inet_opt in inet_csk_route_child_sock()
tcp: fix possible socket refcount problem
net: tcp: move sk_rx_dst_set call after tcp_create_openreq_child()
net/core/dev.c: fix kernel-doc warning
netconsole: remove a redundant netconsole_target_put()
net: ipv6: fix oops in inet_putpeer()
net/stmmac: fix issue of clk_get for Loongson1B.
caif: Do not dereference NULL in chnl_recv_cb()
af_packet: don't emit packet on orig fanout group
drivers/net/irda: fix error return code
drivers/net/wan/dscc4.c: fix error return code
drivers/net/wimax/i2400m/fw.c: fix error return code
smsc75xx: add missing entry to MAINTAINERS
net: qmi_wwan: new devices: UML290 and K5006-Z
net: sh_eth: Add eth support for R8A7779 device
netdev/phy: skip disabled mdio-mux nodes
dt: introduce for_each_available_child_of_node, of_get_next_available_child
net: netprio: fix cgrp create and write priomap race
...

+638 -576
+17 -2
Documentation/networking/netconsole.txt
··· 51 51 initialized and attempts to bring up the supplied dev at the supplied 52 52 address. 53 53 54 - The remote host can run either 'netcat -u -l -p <port>', 55 - 'nc -l -u <port>' or syslogd. 54 + The remote host has several options to receive the kernel messages, 55 + for example: 56 + 57 + 1) syslogd 58 + 59 + 2) netcat 60 + 61 + On distributions using a BSD-based netcat version (e.g. Fedora, 62 + openSUSE and Ubuntu) the listening port must be specified without 63 + the -p switch: 64 + 65 + 'nc -u -l -p <port>' / 'nc -u -l <port>' or 66 + 'netcat -u -l -p <port>' / 'netcat -u -l <port>' 67 + 68 + 3) socat 69 + 70 + 'socat udp-recv:<port> -' 56 71 57 72 Dynamic reconfiguration: 58 73 ========================
+6
MAINTAINERS
··· 7288 7288 S: Supported 7289 7289 F: drivers/usb/serial/whiteheat* 7290 7290 7291 + USB SMSC75XX ETHERNET DRIVER 7292 + M: Steve Glendinning <steve.glendinning@shawell.net> 7293 + L: netdev@vger.kernel.org 7294 + S: Maintained 7295 + F: drivers/net/usb/smsc75xx.* 7296 + 7291 7297 USB SMSC95XX ETHERNET DRIVER 7292 7298 M: Steve Glendinning <steve.glendinning@shawell.net> 7293 7299 L: netdev@vger.kernel.org
+2
drivers/bluetooth/ath3k.c
··· 79 79 { USB_DEVICE(0x13d3, 0x3362) }, 80 80 { USB_DEVICE(0x0CF3, 0xE004) }, 81 81 { USB_DEVICE(0x0930, 0x0219) }, 82 + { USB_DEVICE(0x0489, 0xe057) }, 82 83 83 84 /* Atheros AR5BBU12 with sflash firmware */ 84 85 { USB_DEVICE(0x0489, 0xE02C) }, ··· 105 104 { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, 106 105 { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, 107 106 { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, 107 + { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 }, 108 108 109 109 /* Atheros AR5BBU22 with sflash firmware */ 110 110 { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 },
+2
drivers/bluetooth/btusb.c
··· 98 98 { USB_DEVICE(0x0a5c, 0x21e6) }, 99 99 { USB_DEVICE(0x0a5c, 0x21e8) }, 100 100 { USB_DEVICE(0x0a5c, 0x21f3) }, 101 + { USB_DEVICE(0x0a5c, 0x21f4) }, 101 102 { USB_DEVICE(0x413c, 0x8197) }, 102 103 103 104 /* Foxconn - Hon Hai */ ··· 134 133 { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, 135 134 { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, 136 135 { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, 136 + { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 }, 137 137 138 138 /* Atheros AR5BBU12 with sflash firmware */ 139 139 { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },
+5 -7
drivers/net/bonding/bond_main.c
··· 398 398 sizeof(qdisc_skb_cb(skb)->slave_dev_queue_mapping)); 399 399 skb->queue_mapping = qdisc_skb_cb(skb)->slave_dev_queue_mapping; 400 400 401 - if (unlikely(netpoll_tx_running(slave_dev))) 401 + if (unlikely(netpoll_tx_running(bond->dev))) 402 402 bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb); 403 403 else 404 404 dev_queue_xmit(skb); ··· 1235 1235 struct netpoll *np; 1236 1236 int err = 0; 1237 1237 1238 - np = kzalloc(sizeof(*np), GFP_KERNEL); 1238 + np = kzalloc(sizeof(*np), GFP_ATOMIC); 1239 1239 err = -ENOMEM; 1240 1240 if (!np) 1241 1241 goto out; 1242 1242 1243 - err = __netpoll_setup(np, slave->dev); 1243 + err = __netpoll_setup(np, slave->dev, GFP_ATOMIC); 1244 1244 if (err) { 1245 1245 kfree(np); 1246 1246 goto out; ··· 1257 1257 return; 1258 1258 1259 1259 slave->np = NULL; 1260 - synchronize_rcu_bh(); 1261 - __netpoll_cleanup(np); 1262 - kfree(np); 1260 + __netpoll_free_rcu(np); 1263 1261 } 1264 1262 static inline bool slave_dev_support_netpoll(struct net_device *slave_dev) 1265 1263 { ··· 1290 1292 read_unlock(&bond->lock); 1291 1293 } 1292 1294 1293 - static int bond_netpoll_setup(struct net_device *dev, struct netpoll_info *ni) 1295 + static int bond_netpoll_setup(struct net_device *dev, struct netpoll_info *ni, gfp_t gfp) 1294 1296 { 1295 1297 struct bonding *bond = netdev_priv(dev); 1296 1298 struct slave *slave;
+3 -1
drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
··· 174 174 175 175 new_bus->phy_mask = ~0; 176 176 new_bus->irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL); 177 - if (!new_bus->irq) 177 + if (!new_bus->irq) { 178 + ret = -ENOMEM; 178 179 goto out_unmap_regs; 180 + } 179 181 180 182 new_bus->parent = &ofdev->dev; 181 183 dev_set_drvdata(&ofdev->dev, new_bus);
+6 -2
drivers/net/ethernet/freescale/fs_enet/mii-fec.c
··· 137 137 snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start); 138 138 139 139 fec->fecp = ioremap(res.start, resource_size(&res)); 140 - if (!fec->fecp) 140 + if (!fec->fecp) { 141 + ret = -ENOMEM; 141 142 goto out_fec; 143 + } 142 144 143 145 if (get_bus_freq) { 144 146 clock = get_bus_freq(ofdev->dev.of_node); ··· 174 172 175 173 new_bus->phy_mask = ~0; 176 174 new_bus->irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL); 177 - if (!new_bus->irq) 175 + if (!new_bus->irq) { 176 + ret = -ENOMEM; 178 177 goto out_unmap_regs; 178 + } 179 179 180 180 new_bus->parent = &ofdev->dev; 181 181 dev_set_drvdata(&ofdev->dev, new_bus);
+3 -1
drivers/net/ethernet/mellanox/mlx4/mcg.c
··· 432 432 if ((be32_to_cpu(mgm->qp[i]) & MGM_QPN_MASK) == qpn) { 433 433 /* Entry already exists, add to duplicates */ 434 434 dqp = kmalloc(sizeof *dqp, GFP_KERNEL); 435 - if (!dqp) 435 + if (!dqp) { 436 + err = -ENOMEM; 436 437 goto out_mailbox; 438 + } 437 439 dqp->qpn = qpn; 438 440 list_add_tail(&dqp->list, &entry->duplicates); 439 441 found = true;
+2 -2
drivers/net/ethernet/renesas/Kconfig
··· 8 8 (CPU_SUBTYPE_SH7710 || CPU_SUBTYPE_SH7712 || \ 9 9 CPU_SUBTYPE_SH7763 || CPU_SUBTYPE_SH7619 || \ 10 10 CPU_SUBTYPE_SH7724 || CPU_SUBTYPE_SH7734 || \ 11 - CPU_SUBTYPE_SH7757 || ARCH_R8A7740) 11 + CPU_SUBTYPE_SH7757 || ARCH_R8A7740 || ARCH_R8A7779) 12 12 select CRC32 13 13 select NET_CORE 14 14 select MII ··· 18 18 Renesas SuperH Ethernet device driver. 19 19 This driver supporting CPUs are: 20 20 - SH7619, SH7710, SH7712, SH7724, SH7734, SH7763, SH7757, 21 - and R8A7740. 21 + R8A7740 and R8A7779.
+8 -3
drivers/net/ethernet/renesas/sh_eth.c
··· 78 78 #endif 79 79 80 80 /* There is CPU dependent code */ 81 - #if defined(CONFIG_CPU_SUBTYPE_SH7724) 81 + #if defined(CONFIG_CPU_SUBTYPE_SH7724) || defined(CONFIG_ARCH_R8A7779) 82 82 #define SH_ETH_RESET_DEFAULT 1 83 83 static void sh_eth_set_duplex(struct net_device *ndev) 84 84 { ··· 93 93 static void sh_eth_set_rate(struct net_device *ndev) 94 94 { 95 95 struct sh_eth_private *mdp = netdev_priv(ndev); 96 + unsigned int bits = ECMR_RTM; 97 + 98 + #if defined(CONFIG_ARCH_R8A7779) 99 + bits |= ECMR_ELB; 100 + #endif 96 101 97 102 switch (mdp->speed) { 98 103 case 10: /* 10BASE */ 99 - sh_eth_write(ndev, sh_eth_read(ndev, ECMR) & ~ECMR_RTM, ECMR); 104 + sh_eth_write(ndev, sh_eth_read(ndev, ECMR) & ~bits, ECMR); 100 105 break; 101 106 case 100:/* 100BASE */ 102 - sh_eth_write(ndev, sh_eth_read(ndev, ECMR) | ECMR_RTM, ECMR); 107 + sh_eth_write(ndev, sh_eth_read(ndev, ECMR) | bits, ECMR); 103 108 break; 104 109 default: 105 110 break;
+1 -1
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 2077 2077 goto error_netdev_register; 2078 2078 } 2079 2079 2080 - priv->stmmac_clk = clk_get(priv->device, NULL); 2080 + priv->stmmac_clk = clk_get(priv->device, STMMAC_RESOURCE_NAME); 2081 2081 if (IS_ERR(priv->stmmac_clk)) { 2082 2082 pr_warning("%s: warning: cannot get CSR clock\n", __func__); 2083 2083 goto error_clk_get;
+2 -1
drivers/net/ethernet/ti/davinci_cpdma.c
··· 538 538 539 539 int cpdma_chan_destroy(struct cpdma_chan *chan) 540 540 { 541 - struct cpdma_ctlr *ctlr = chan->ctlr; 541 + struct cpdma_ctlr *ctlr; 542 542 unsigned long flags; 543 543 544 544 if (!chan) 545 545 return -EINVAL; 546 + ctlr = chan->ctlr; 546 547 547 548 spin_lock_irqsave(&ctlr->lock, flags); 548 549 if (chan->state != CPDMA_STATE_IDLE)
+1
drivers/net/irda/ks959-sir.c
··· 542 542 sprintf(hwname, "usb#%d", kingsun->usbdev->devnum); 543 543 kingsun->irlap = irlap_open(netdev, &kingsun->qos, hwname); 544 544 if (!kingsun->irlap) { 545 + err = -ENOMEM; 545 546 dev_err(&kingsun->usbdev->dev, "irlap_open failed\n"); 546 547 goto free_mem; 547 548 }
+1
drivers/net/irda/ksdazzle-sir.c
··· 436 436 sprintf(hwname, "usb#%d", kingsun->usbdev->devnum); 437 437 kingsun->irlap = irlap_open(netdev, &kingsun->qos, hwname); 438 438 if (!kingsun->irlap) { 439 + err = -ENOMEM; 439 440 dev_err(&kingsun->usbdev->dev, "irlap_open failed\n"); 440 441 goto free_mem; 441 442 }
-6
drivers/net/netconsole.c
··· 640 640 * rtnl_lock already held 641 641 */ 642 642 if (nt->np.dev) { 643 - spin_unlock_irqrestore( 644 - &target_list_lock, 645 - flags); 646 643 __netpoll_cleanup(&nt->np); 647 - spin_lock_irqsave(&target_list_lock, 648 - flags); 649 644 dev_put(nt->np.dev); 650 645 nt->np.dev = NULL; 651 - netconsole_target_put(nt); 652 646 } 653 647 nt->enabled = 0; 654 648 stopped = true;
+1 -1
drivers/net/phy/mdio-mux.c
··· 132 132 pb->mii_bus = parent_bus; 133 133 134 134 ret_val = -ENODEV; 135 - for_each_child_of_node(dev->of_node, child_bus_node) { 135 + for_each_available_child_of_node(dev->of_node, child_bus_node) { 136 136 u32 v; 137 137 138 138 r = of_property_read_u32(child_bus_node, "reg", &v);
+9 -7
drivers/net/team/team.c
··· 795 795 } 796 796 797 797 #ifdef CONFIG_NET_POLL_CONTROLLER 798 - static int team_port_enable_netpoll(struct team *team, struct team_port *port) 798 + static int team_port_enable_netpoll(struct team *team, struct team_port *port, 799 + gfp_t gfp) 799 800 { 800 801 struct netpoll *np; 801 802 int err; 802 803 803 - np = kzalloc(sizeof(*np), GFP_KERNEL); 804 + np = kzalloc(sizeof(*np), gfp); 804 805 if (!np) 805 806 return -ENOMEM; 806 807 807 - err = __netpoll_setup(np, port->dev); 808 + err = __netpoll_setup(np, port->dev, gfp); 808 809 if (err) { 809 810 kfree(np); 810 811 return err; ··· 834 833 } 835 834 836 835 #else 837 - static int team_port_enable_netpoll(struct team *team, struct team_port *port) 836 + static int team_port_enable_netpoll(struct team *team, struct team_port *port, 837 + gfp_t gfp) 838 838 { 839 839 return 0; 840 840 } ··· 915 913 } 916 914 917 915 if (team_netpoll_info(team)) { 918 - err = team_port_enable_netpoll(team, port); 916 + err = team_port_enable_netpoll(team, port, GFP_KERNEL); 919 917 if (err) { 920 918 netdev_err(dev, "Failed to enable netpoll on device %s\n", 921 919 portname); ··· 1445 1443 } 1446 1444 1447 1445 static int team_netpoll_setup(struct net_device *dev, 1448 - struct netpoll_info *npifo) 1446 + struct netpoll_info *npifo, gfp_t gfp) 1449 1447 { 1450 1448 struct team *team = netdev_priv(dev); 1451 1449 struct team_port *port; ··· 1453 1451 1454 1452 mutex_lock(&team->lock); 1455 1453 list_for_each_entry(port, &team->port_list, list) { 1456 - err = team_port_enable_netpoll(team, port); 1454 + err = team_port_enable_netpoll(team, port, gfp); 1457 1455 if (err) { 1458 1456 __team_netpoll_cleanup(team); 1459 1457 break;
+44 -207
drivers/net/usb/qmi_wwan.c
··· 247 247 */ 248 248 static int qmi_wwan_bind_shared(struct usbnet *dev, struct usb_interface *intf) 249 249 { 250 - int rv; 251 250 struct qmi_wwan_state *info = (void *)&dev->data; 252 - 253 - /* ZTE makes devices where the interface descriptors and endpoint 254 - * configurations of two or more interfaces are identical, even 255 - * though the functions are completely different. If set, then 256 - * driver_info->data is a bitmap of acceptable interface numbers 257 - * allowing us to bind to one such interface without binding to 258 - * all of them 259 - */ 260 - if (dev->driver_info->data && 261 - !test_bit(intf->cur_altsetting->desc.bInterfaceNumber, &dev->driver_info->data)) { 262 - dev_info(&intf->dev, "not on our whitelist - ignored"); 263 - rv = -ENODEV; 264 - goto err; 265 - } 266 251 267 252 /* control and data is shared */ 268 253 info->control = intf; 269 254 info->data = intf; 270 - rv = qmi_wwan_register_subdriver(dev); 271 - 272 - err: 273 - return rv; 255 + return qmi_wwan_register_subdriver(dev); 274 256 } 275 257 276 258 static void qmi_wwan_unbind(struct usbnet *dev, struct usb_interface *intf) ··· 338 356 .manage_power = qmi_wwan_manage_power, 339 357 }; 340 358 341 - static const struct driver_info qmi_wwan_force_int0 = { 342 - .description = "Qualcomm WWAN/QMI device", 343 - .flags = FLAG_WWAN, 344 - .bind = qmi_wwan_bind_shared, 345 - .unbind = qmi_wwan_unbind, 346 - .manage_power = qmi_wwan_manage_power, 347 - .data = BIT(0), /* interface whitelist bitmap */ 348 - }; 349 - 350 - static const struct driver_info qmi_wwan_force_int1 = { 351 - .description = "Qualcomm WWAN/QMI device", 352 - .flags = FLAG_WWAN, 353 - .bind = qmi_wwan_bind_shared, 354 - .unbind = qmi_wwan_unbind, 355 - .manage_power = qmi_wwan_manage_power, 356 - .data = BIT(1), /* interface whitelist bitmap */ 357 - }; 358 - 359 - static const struct driver_info qmi_wwan_force_int2 = { 360 - .description = "Qualcomm WWAN/QMI device", 361 - .flags = FLAG_WWAN, 362 - .bind = qmi_wwan_bind_shared, 363 - .unbind = qmi_wwan_unbind, 364 - .manage_power = qmi_wwan_manage_power, 365 - .data = BIT(2), /* interface whitelist bitmap */ 366 - }; 367 - 368 - static const struct driver_info qmi_wwan_force_int3 = { 369 - .description = "Qualcomm WWAN/QMI device", 370 - .flags = FLAG_WWAN, 371 - .bind = qmi_wwan_bind_shared, 372 - .unbind = qmi_wwan_unbind, 373 - .manage_power = qmi_wwan_manage_power, 374 - .data = BIT(3), /* interface whitelist bitmap */ 375 - }; 376 - 377 - static const struct driver_info qmi_wwan_force_int4 = { 378 - .description = "Qualcomm WWAN/QMI device", 379 - .flags = FLAG_WWAN, 380 - .bind = qmi_wwan_bind_shared, 381 - .unbind = qmi_wwan_unbind, 382 - .manage_power = qmi_wwan_manage_power, 383 - .data = BIT(4), /* interface whitelist bitmap */ 384 - }; 385 - 386 - /* Sierra Wireless provide equally useless interface descriptors 387 - * Devices in QMI mode can be switched between two different 388 - * configurations: 389 - * a) USB interface #8 is QMI/wwan 390 - * b) USB interfaces #8, #19 and #20 are QMI/wwan 391 - * 392 - * Both configurations provide a number of other interfaces (serial++), 393 - * some of which have the same endpoint configuration as we expect, so 394 - * a whitelist or blacklist is necessary. 395 - * 396 - * FIXME: The below whitelist should include BIT(20). It does not 397 - * because I cannot get it to work... 398 - */ 399 - static const struct driver_info qmi_wwan_sierra = { 400 - .description = "Sierra Wireless wwan/QMI device", 401 - .flags = FLAG_WWAN, 402 - .bind = qmi_wwan_bind_shared, 403 - .unbind = qmi_wwan_unbind, 404 - .manage_power = qmi_wwan_manage_power, 405 - .data = BIT(8) | BIT(19), /* interface whitelist bitmap */ 406 - }; 407 - 408 359 #define HUAWEI_VENDOR_ID 0x12D1 360 + 361 + /* map QMI/wwan function by a fixed interface number */ 362 + #define QMI_FIXED_INTF(vend, prod, num) \ 363 + USB_DEVICE_INTERFACE_NUMBER(vend, prod, num), \ 364 + .driver_info = (unsigned long)&qmi_wwan_shared 409 365 410 366 /* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */ 411 367 #define QMI_GOBI1K_DEVICE(vend, prod) \ 412 - USB_DEVICE(vend, prod), \ 413 - .driver_info = (unsigned long)&qmi_wwan_force_int3 368 + QMI_FIXED_INTF(vend, prod, 3) 414 369 415 - /* Gobi 2000 and Gobi 3000 QMI/wwan interface number is 0 according to qcserial */ 370 + /* Gobi 2000/3000 QMI/wwan interface number is 0 according to qcserial */ 416 371 #define QMI_GOBI_DEVICE(vend, prod) \ 417 - USB_DEVICE(vend, prod), \ 418 - .driver_info = (unsigned long)&qmi_wwan_force_int0 372 + QMI_FIXED_INTF(vend, prod, 0) 419 373 420 374 static const struct usb_device_id products[] = { 375 + /* 1. CDC ECM like devices match on the control interface */ 421 376 { /* Huawei E392, E398 and possibly others sharing both device id and more... */ 422 - .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO, 423 - .idVendor = HUAWEI_VENDOR_ID, 424 - .bInterfaceClass = USB_CLASS_VENDOR_SPEC, 425 - .bInterfaceSubClass = 1, 426 - .bInterfaceProtocol = 9, /* CDC Ethernet *control* interface */ 377 + USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 9), 427 378 .driver_info = (unsigned long)&qmi_wwan_info, 428 379 }, 429 380 { /* Vodafone/Huawei K5005 (12d1:14c8) and similar modems */ 430 - .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO, 431 - .idVendor = HUAWEI_VENDOR_ID, 432 - .bInterfaceClass = USB_CLASS_VENDOR_SPEC, 433 - .bInterfaceSubClass = 1, 434 - .bInterfaceProtocol = 57, /* CDC Ethernet *control* interface */ 381 + USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 57), 435 382 .driver_info = (unsigned long)&qmi_wwan_info, 436 383 }, 437 - { /* Huawei E392, E398 and possibly others in "Windows mode" 438 - * using a combined control and data interface without any CDC 439 - * functional descriptors 440 - */ 441 - .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO, 442 - .idVendor = HUAWEI_VENDOR_ID, 443 - .bInterfaceClass = USB_CLASS_VENDOR_SPEC, 444 - .bInterfaceSubClass = 1, 445 - .bInterfaceProtocol = 17, 384 + 385 + /* 2. Combined interface devices matching on class+protocol */ 386 + { /* Huawei E392, E398 and possibly others in "Windows mode" */ 387 + USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 17), 446 388 .driver_info = (unsigned long)&qmi_wwan_shared, 447 389 }, 448 390 { /* Pantech UML290 */ 449 - .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, 450 - .idVendor = 0x106c, 451 - .idProduct = 0x3718, 452 - .bInterfaceClass = 0xff, 453 - .bInterfaceSubClass = 0xf0, 454 - .bInterfaceProtocol = 0xff, 391 + USB_DEVICE_AND_INTERFACE_INFO(0x106c, 0x3718, USB_CLASS_VENDOR_SPEC, 0xf0, 0xff), 455 392 .driver_info = (unsigned long)&qmi_wwan_shared, 456 393 }, 457 - { /* ZTE MF820D */ 458 - .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, 459 - .idVendor = 0x19d2, 460 - .idProduct = 0x0167, 461 - .bInterfaceClass = 0xff, 462 - .bInterfaceSubClass = 0xff, 463 - .bInterfaceProtocol = 0xff, 464 - .driver_info = (unsigned long)&qmi_wwan_force_int4, 465 - }, 466 - { /* ZTE MF821D */ 467 - .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, 468 - .idVendor = 0x19d2, 469 - .idProduct = 0x0326, 470 - .bInterfaceClass = 0xff, 471 - .bInterfaceSubClass = 0xff, 472 - .bInterfaceProtocol = 0xff, 473 - .driver_info = (unsigned long)&qmi_wwan_force_int4, 474 - }, 475 - { /* ZTE (Vodafone) K3520-Z */ 476 - .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, 477 - .idVendor = 0x19d2, 478 - .idProduct = 0x0055, 479 - .bInterfaceClass = 0xff, 480 - .bInterfaceSubClass = 0xff, 481 - .bInterfaceProtocol = 0xff, 482 - .driver_info = (unsigned long)&qmi_wwan_force_int1, 483 - }, 484 - { /* ZTE (Vodafone) K3565-Z */ 485 - .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, 486 - .idVendor = 0x19d2, 487 - .idProduct = 0x0063, 488 - .bInterfaceClass = 0xff, 489 - .bInterfaceSubClass = 0xff, 490 - .bInterfaceProtocol = 0xff, 491 - .driver_info = (unsigned long)&qmi_wwan_force_int4, 492 - }, 493 - { /* ZTE (Vodafone) K3570-Z */ 494 - .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, 495 - .idVendor = 0x19d2, 496 - .idProduct = 0x1008, 497 - .bInterfaceClass = 0xff, 498 - .bInterfaceSubClass = 0xff, 499 - .bInterfaceProtocol = 0xff, 500 - .driver_info = (unsigned long)&qmi_wwan_force_int4, 501 - }, 502 - { /* ZTE (Vodafone) K3571-Z */ 503 - .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, 504 - .idVendor = 0x19d2, 505 - .idProduct = 0x1010, 506 - .bInterfaceClass = 0xff, 507 - .bInterfaceSubClass = 0xff, 508 - .bInterfaceProtocol = 0xff, 509 - .driver_info = (unsigned long)&qmi_wwan_force_int4, 510 - }, 511 - { /* ZTE (Vodafone) K3765-Z */ 512 - .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, 513 - .idVendor = 0x19d2, 514 - .idProduct = 0x2002, 515 - .bInterfaceClass = 0xff, 516 - .bInterfaceSubClass = 0xff, 517 - .bInterfaceProtocol = 0xff, 518 - .driver_info = (unsigned long)&qmi_wwan_force_int4, 519 - }, 520 - { /* ZTE (Vodafone) K4505-Z */ 521 - .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, 522 - .idVendor = 0x19d2, 523 - .idProduct = 0x0104, 524 - .bInterfaceClass = 0xff, 525 - .bInterfaceSubClass = 0xff, 526 - .bInterfaceProtocol = 0xff, 527 - .driver_info = (unsigned long)&qmi_wwan_force_int4, 528 - }, 529 - { /* ZTE MF60 */ 530 - .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, 531 - .idVendor = 0x19d2, 532 - .idProduct = 0x1402, 533 - .bInterfaceClass = 0xff, 534 - .bInterfaceSubClass = 0xff, 535 - .bInterfaceProtocol = 0xff, 536 - .driver_info = (unsigned long)&qmi_wwan_force_int2, 537 - }, 538 - { /* Sierra Wireless MC77xx in QMI mode */ 539 - .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, 540 - .idVendor = 0x1199, 541 - .idProduct = 0x68a2, 542 - .bInterfaceClass = 0xff, 543 - .bInterfaceSubClass = 0xff, 544 - .bInterfaceProtocol = 0xff, 545 - .driver_info = (unsigned long)&qmi_wwan_sierra, 394 + { /* Pantech UML290 - newer firmware */ 395 + USB_DEVICE_AND_INTERFACE_INFO(0x106c, 0x3718, USB_CLASS_VENDOR_SPEC, 0xf1, 0xff), 396 + .driver_info = (unsigned long)&qmi_wwan_shared, 546 397 }, 547 398 548 - /* Gobi 1000 devices */ 399 + /* 3. Combined interface devices matching on interface number */ 400 + {QMI_FIXED_INTF(0x19d2, 0x0055, 1)}, /* ZTE (Vodafone) K3520-Z */ 401 + {QMI_FIXED_INTF(0x19d2, 0x0063, 4)}, /* ZTE (Vodafone) K3565-Z */ 402 + {QMI_FIXED_INTF(0x19d2, 0x0104, 4)}, /* ZTE (Vodafone) K4505-Z */ 403 + {QMI_FIXED_INTF(0x19d2, 0x0167, 4)}, /* ZTE MF820D */ 404 + {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */ 405 + {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */ 406 + {QMI_FIXED_INTF(0x19d2, 0x1010, 4)}, /* ZTE (Vodafone) K3571-Z */ 407 + {QMI_FIXED_INTF(0x19d2, 0x1018, 3)}, /* ZTE (Vodafone) K5006-Z */ 408 + {QMI_FIXED_INTF(0x19d2, 0x1402, 2)}, /* ZTE MF60 */ 409 + {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ 410 + {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ 411 + {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ 412 + {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */ 413 + {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */ 414 + {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */ 415 + 416 + /* 4. Gobi 1000 devices */ 549 417 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ 550 418 {QMI_GOBI1K_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ 551 419 {QMI_GOBI1K_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ ··· 411 579 {QMI_GOBI1K_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */ 412 580 {QMI_GOBI1K_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */ 413 581 414 - /* Gobi 2000 and 3000 devices */ 582 + /* 5. Gobi 2000 and 3000 devices */ 415 583 {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ 416 584 {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */ 417 585 {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */ ··· 421 589 {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */ 422 590 {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */ 423 591 {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */ 592 + {QMI_GOBI_DEVICE(0x1199, 0x68a5)}, /* Sierra Wireless Modem */ 593 + {QMI_GOBI_DEVICE(0x1199, 0x68a9)}, /* Sierra Wireless Modem */ 424 594 {QMI_GOBI_DEVICE(0x1199, 0x9001)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ 425 595 {QMI_GOBI_DEVICE(0x1199, 0x9002)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ 426 596 {QMI_GOBI_DEVICE(0x1199, 0x9003)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ ··· 434 600 {QMI_GOBI_DEVICE(0x1199, 0x9009)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ 435 601 {QMI_GOBI_DEVICE(0x1199, 0x900a)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ 436 602 {QMI_GOBI_DEVICE(0x1199, 0x9011)}, /* Sierra Wireless Gobi 2000 Modem device (MC8305) */ 603 + {QMI_FIXED_INTF(0x1199, 0x9011, 5)}, /* alternate interface number!? */ 437 604 {QMI_GOBI_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */ 438 605 {QMI_GOBI_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */ 439 606 {QMI_GOBI_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */ 440 607 {QMI_GOBI_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */ 441 608 {QMI_GOBI_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */ 609 + {QMI_GOBI_DEVICE(0x1199, 0x901b)}, /* Sierra Wireless MC7770 */ 610 + 442 611 { } /* END */ 443 612 }; 444 613 MODULE_DEVICE_TABLE(usb, products);
+12 -40
drivers/net/usb/sierra_net.c
··· 68 68 */ 69 69 #define SIERRA_NET_USBCTL_BUF_LEN 1024 70 70 71 - /* list of interface numbers - used for constructing interface lists */ 72 - struct sierra_net_iface_info { 73 - const u32 infolen; /* number of interface numbers on list */ 74 - const u8 *ifaceinfo; /* pointer to the array holding the numbers */ 75 - }; 76 - 77 71 struct sierra_net_info_data { 78 72 u16 rx_urb_size; 79 - struct sierra_net_iface_info whitelist; 80 73 }; 81 74 82 75 /* Private data structure */ ··· 630 637 return usbnet_change_mtu(net, new_mtu); 631 638 } 632 639 633 - static int is_whitelisted(const u8 ifnum, 634 - const struct sierra_net_iface_info *whitelist) 635 - { 636 - if (whitelist) { 637 - const u8 *list = whitelist->ifaceinfo; 638 - int i; 639 - 640 - for (i = 0; i < whitelist->infolen; i++) { 641 - if (list[i] == ifnum) 642 - return 1; 643 - } 644 - } 645 - return 0; 646 - } 647 - 648 640 static int sierra_net_get_fw_attr(struct usbnet *dev, u16 *datap) 649 641 { 650 642 int result = 0; ··· 684 706 dev_dbg(&dev->udev->dev, "%s", __func__); 685 707 686 708 ifacenum = intf->cur_altsetting->desc.bInterfaceNumber; 687 - /* We only accept certain interfaces */ 688 - if (!is_whitelisted(ifacenum, &data->whitelist)) { 689 - dev_dbg(&dev->udev->dev, "Ignoring interface: %d", ifacenum); 690 - return -ENODEV; 691 - } 692 709 numendpoints = intf->cur_altsetting->desc.bNumEndpoints; 693 710 /* We have three endpoints, bulk in and out, and a status */ 694 711 if (numendpoints != 3) { ··· 918 945 return NULL; 919 946 } 920 947 921 - static const u8 sierra_net_ifnum_list[] = { 7, 10, 11 }; 922 948 static const struct sierra_net_info_data sierra_net_info_data_direct_ip = { 923 949 .rx_urb_size = 8 * 1024, 924 - .whitelist = { 925 - .infolen = ARRAY_SIZE(sierra_net_ifnum_list), 926 - .ifaceinfo = sierra_net_ifnum_list 927 - } 928 950 }; 929 951 930 952 static const struct driver_info sierra_net_info_direct_ip = { ··· 933 965 .data = (unsigned long)&sierra_net_info_data_direct_ip, 934 966 }; 935 967 968 + #define DIRECT_IP_DEVICE(vend, prod) \ 969 + {USB_DEVICE_INTERFACE_NUMBER(vend, prod, 7), \ 970 + .driver_info = (unsigned long)&sierra_net_info_direct_ip}, \ 971 + {USB_DEVICE_INTERFACE_NUMBER(vend, prod, 10), \ 972 + .driver_info = (unsigned long)&sierra_net_info_direct_ip}, \ 973 + {USB_DEVICE_INTERFACE_NUMBER(vend, prod, 11), \ 974 + .driver_info = (unsigned long)&sierra_net_info_direct_ip} 975 + 936 976 static const struct usb_device_id products[] = { 937 - {USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless USB-to-WWAN modem */ 938 - .driver_info = (unsigned long) &sierra_net_info_direct_ip}, 939 - {USB_DEVICE(0x0F3D, 0x68A3), /* AT&T Direct IP modem */ 940 - .driver_info = (unsigned long) &sierra_net_info_direct_ip}, 941 - {USB_DEVICE(0x1199, 0x68AA), /* Sierra Wireless Direct IP LTE modem */ 942 - .driver_info = (unsigned long) &sierra_net_info_direct_ip}, 943 - {USB_DEVICE(0x0F3D, 0x68AA), /* AT&T Direct IP LTE modem */ 944 - .driver_info = (unsigned long) &sierra_net_info_direct_ip}, 977 + DIRECT_IP_DEVICE(0x1199, 0x68A3), /* Sierra Wireless USB-to-WWAN modem */ 978 + DIRECT_IP_DEVICE(0x0F3D, 0x68A3), /* AT&T Direct IP modem */ 979 + DIRECT_IP_DEVICE(0x1199, 0x68AA), /* Sierra Wireless Direct IP LTE modem */ 980 + DIRECT_IP_DEVICE(0x0F3D, 0x68AA), /* AT&T Direct IP LTE modem */ 945 981 946 982 {}, /* last item */ 947 983 };
+1 -1
drivers/net/vmxnet3/vmxnet3_drv.c
··· 3019 3019 netdev->watchdog_timeo = 5 * HZ; 3020 3020 3021 3021 INIT_WORK(&adapter->work, vmxnet3_reset_work); 3022 + set_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state); 3022 3023 3023 3024 if (adapter->intr.type == VMXNET3_IT_MSIX) { 3024 3025 int i; ··· 3044 3043 goto err_register; 3045 3044 } 3046 3045 3047 - set_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state); 3048 3046 vmxnet3_check_link(adapter, false); 3049 3047 atomic_inc(&devices_found); 3050 3048 return 0;
+3 -2
drivers/net/wan/dscc4.c
··· 774 774 } 775 775 /* Global interrupt queue */ 776 776 writel((u32)(((IRQ_RING_SIZE >> 5) - 1) << 20), ioaddr + IQLENR1); 777 + 778 + rc = -ENOMEM; 779 + 777 780 priv->iqcfg = (__le32 *) pci_alloc_consistent(pdev, 778 781 IRQ_RING_SIZE*sizeof(__le32), &priv->iqcfg_dma); 779 782 if (!priv->iqcfg) 780 783 goto err_free_irq_5; 781 784 writel(priv->iqcfg_dma, ioaddr + IQCFG); 782 - 783 - rc = -ENOMEM; 784 785 785 786 /* 786 787 * SCC 0-3 private rx/tx irq structures
+3 -1
drivers/net/wimax/i2400m/fw.c
··· 326 326 unsigned barker; 327 327 328 328 options_orig = kstrdup(_options, GFP_KERNEL); 329 - if (options_orig == NULL) 329 + if (options_orig == NULL) { 330 + result = -ENOMEM; 330 331 goto error_parse; 332 + } 331 333 options = options_orig; 332 334 333 335 while ((token = strsep(&options, ",")) != NULL) {
+1 -1
drivers/net/wireless/at76c50x-usb.c
··· 342 342 return ret; 343 343 } 344 344 345 - static u8 at76_dfu_get_state(struct usb_device *udev, u8 *state) 345 + static int at76_dfu_get_state(struct usb_device *udev, u8 *state) 346 346 { 347 347 int ret; 348 348
+2 -4
drivers/net/wireless/ath/ath5k/base.c
··· 2056 2056 void 2057 2057 ath5k_beacon_config(struct ath5k_hw *ah) 2058 2058 { 2059 - unsigned long flags; 2060 - 2061 - spin_lock_irqsave(&ah->block, flags); 2059 + spin_lock_bh(&ah->block); 2062 2060 ah->bmisscount = 0; 2063 2061 ah->imask &= ~(AR5K_INT_BMISS | AR5K_INT_SWBA); 2064 2062 ··· 2083 2085 2084 2086 ath5k_hw_set_imr(ah, ah->imask); 2085 2087 mmiowb(); 2086 - spin_unlock_irqrestore(&ah->block, flags); 2088 + spin_unlock_bh(&ah->block); 2087 2089 } 2088 2090 2089 2091 static void ath5k_tasklet_beacon(unsigned long data)
+2 -3
drivers/net/wireless/ath/ath5k/mac80211-ops.c
··· 254 254 struct ath5k_vif *avf = (void *)vif->drv_priv; 255 255 struct ath5k_hw *ah = hw->priv; 256 256 struct ath_common *common = ath5k_hw_common(ah); 257 - unsigned long flags; 258 257 259 258 mutex_lock(&ah->lock); 260 259 ··· 299 300 } 300 301 301 302 if (changes & BSS_CHANGED_BEACON) { 302 - spin_lock_irqsave(&ah->block, flags); 303 + spin_lock_bh(&ah->block); 303 304 ath5k_beacon_update(hw, vif); 304 - spin_unlock_irqrestore(&ah->block, flags); 305 + spin_unlock_bh(&ah->block); 305 306 } 306 307 307 308 if (changes & BSS_CHANGED_BEACON_ENABLED)
+12 -6
drivers/net/wireless/ath/ath9k/mac.c
··· 773 773 } 774 774 EXPORT_SYMBOL(ath9k_hw_intrpend); 775 775 776 - void ath9k_hw_disable_interrupts(struct ath_hw *ah) 776 + void ath9k_hw_kill_interrupts(struct ath_hw *ah) 777 777 { 778 778 struct ath_common *common = ath9k_hw_common(ah); 779 - 780 - if (!(ah->imask & ATH9K_INT_GLOBAL)) 781 - atomic_set(&ah->intr_ref_cnt, -1); 782 - else 783 - atomic_dec(&ah->intr_ref_cnt); 784 779 785 780 ath_dbg(common, INTERRUPT, "disable IER\n"); 786 781 REG_WRITE(ah, AR_IER, AR_IER_DISABLE); ··· 787 792 REG_WRITE(ah, AR_INTR_SYNC_ENABLE, 0); 788 793 (void) REG_READ(ah, AR_INTR_SYNC_ENABLE); 789 794 } 795 + } 796 + EXPORT_SYMBOL(ath9k_hw_kill_interrupts); 797 + 798 + void ath9k_hw_disable_interrupts(struct ath_hw *ah) 799 + { 800 + if (!(ah->imask & ATH9K_INT_GLOBAL)) 801 + atomic_set(&ah->intr_ref_cnt, -1); 802 + else 803 + atomic_dec(&ah->intr_ref_cnt); 804 + 805 + ath9k_hw_kill_interrupts(ah); 790 806 } 791 807 EXPORT_SYMBOL(ath9k_hw_disable_interrupts); 792 808
+1
drivers/net/wireless/ath/ath9k/mac.h
··· 738 738 void ath9k_hw_set_interrupts(struct ath_hw *ah); 739 739 void ath9k_hw_enable_interrupts(struct ath_hw *ah); 740 740 void ath9k_hw_disable_interrupts(struct ath_hw *ah); 741 + void ath9k_hw_kill_interrupts(struct ath_hw *ah); 741 742 742 743 void ar9002_hw_attach_mac_ops(struct ath_hw *ah); 743 744
+3 -1
drivers/net/wireless/ath/ath9k/main.c
··· 462 462 if (!ath9k_hw_intrpend(ah)) 463 463 return IRQ_NONE; 464 464 465 - if(test_bit(SC_OP_HW_RESET, &sc->sc_flags)) 465 + if (test_bit(SC_OP_HW_RESET, &sc->sc_flags)) { 466 + ath9k_hw_kill_interrupts(ah); 466 467 return IRQ_HANDLED; 468 + } 467 469 468 470 /* 469 471 * Figure out the reason(s) for the interrupt. Note
+1
drivers/net/wireless/ath/ath9k/pci.c
··· 321 321 * Otherwise the chip never moved to full sleep, 322 322 * when no interface is up. 323 323 */ 324 + ath9k_stop_btcoex(sc); 324 325 ath9k_hw_disable(sc->sc_ah); 325 326 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_FULL_SLEEP); 326 327
+1 -1
drivers/net/wireless/ath/ath9k/recv.c
··· 1044 1044 struct ieee80211_hw *hw = sc->hw; 1045 1045 struct ieee80211_hdr *hdr; 1046 1046 int retval; 1047 - bool decrypt_error = false; 1048 1047 struct ath_rx_status rs; 1049 1048 enum ath9k_rx_qtype qtype; 1050 1049 bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA); ··· 1065 1066 tsf_lower = tsf & 0xffffffff; 1066 1067 1067 1068 do { 1069 + bool decrypt_error = false; 1068 1070 /* If handling rx interrupt and flush is in progress => exit */ 1069 1071 if (test_bit(SC_OP_RXFLUSH, &sc->sc_flags) && (flush == 0)) 1070 1072 break;
+4 -2
drivers/net/wireless/rndis_wlan.c
··· 1803 1803 struct cfg80211_pmksa *pmksa, 1804 1804 int max_pmkids) 1805 1805 { 1806 + struct ndis_80211_pmkid *new_pmkids; 1806 1807 int i, err, newlen; 1807 1808 unsigned int count; 1808 1809 ··· 1834 1833 /* add new pmkid */ 1835 1834 newlen = sizeof(*pmkids) + (count + 1) * sizeof(pmkids->bssid_info[0]); 1836 1835 1837 - pmkids = krealloc(pmkids, newlen, GFP_KERNEL); 1838 - if (!pmkids) { 1836 + new_pmkids = krealloc(pmkids, newlen, GFP_KERNEL); 1837 + if (!new_pmkids) { 1839 1838 err = -ENOMEM; 1840 1839 goto error; 1841 1840 } 1841 + pmkids = new_pmkids; 1842 1842 1843 1843 pmkids->length = cpu_to_le32(newlen); 1844 1844 pmkids->bssid_info_count = cpu_to_le32(count + 1);
+27
drivers/of/base.c
··· 364 364 EXPORT_SYMBOL(of_get_next_child); 365 365 366 366 /** 367 + * of_get_next_available_child - Find the next available child node 368 + * @node: parent node 369 + * @prev: previous child of the parent node, or NULL to get first 370 + * 371 + * This function is like of_get_next_child(), except that it 372 + * automatically skips any disabled nodes (i.e. status = "disabled"). 373 + */ 374 + struct device_node *of_get_next_available_child(const struct device_node *node, 375 + struct device_node *prev) 376 + { 377 + struct device_node *next; 378 + 379 + read_lock(&devtree_lock); 380 + next = prev ? prev->sibling : node->child; 381 + for (; next; next = next->sibling) { 382 + if (!of_device_is_available(next)) 383 + continue; 384 + if (of_node_get(next)) 385 + break; 386 + } 387 + of_node_put(prev); 388 + read_unlock(&devtree_lock); 389 + return next; 390 + } 391 + EXPORT_SYMBOL(of_get_next_available_child); 392 + 393 + /** 367 394 * of_find_node_by_path - Find a node matching a full OF path 368 395 * @path: The full path to match 369 396 *
+15 -15
include/linux/if_team.h
··· 96 96 } 97 97 #endif 98 98 99 - static inline int team_dev_queue_xmit(struct team *team, struct team_port *port, 100 - struct sk_buff *skb) 101 - { 102 - BUILD_BUG_ON(sizeof(skb->queue_mapping) != 103 - sizeof(qdisc_skb_cb(skb)->slave_dev_queue_mapping)); 104 - skb_set_queue_mapping(skb, qdisc_skb_cb(skb)->slave_dev_queue_mapping); 105 - 106 - skb->dev = port->dev; 107 - if (unlikely(netpoll_tx_running(port->dev))) { 108 - team_netpoll_send_skb(port, skb); 109 - return 0; 110 - } 111 - return dev_queue_xmit(skb); 112 - } 113 - 114 99 struct team_mode_ops { 115 100 int (*init)(struct team *team); 116 101 void (*exit)(struct team *team); ··· 184 199 struct team_mode_ops ops; 185 200 long mode_priv[TEAM_MODE_PRIV_LONGS]; 186 201 }; 202 + 203 + static inline int team_dev_queue_xmit(struct team *team, struct team_port *port, 204 + struct sk_buff *skb) 205 + { 206 + BUILD_BUG_ON(sizeof(skb->queue_mapping) != 207 + sizeof(qdisc_skb_cb(skb)->slave_dev_queue_mapping)); 208 + skb_set_queue_mapping(skb, qdisc_skb_cb(skb)->slave_dev_queue_mapping); 209 + 210 + skb->dev = port->dev; 211 + if (unlikely(netpoll_tx_running(team->dev))) { 212 + team_netpoll_send_skb(port, skb); 213 + return 0; 214 + } 215 + return dev_queue_xmit(skb); 216 + } 187 217 188 218 static inline struct hlist_head *team_port_index_hash(struct team *team, 189 219 int port_index)
+4 -1
include/linux/netdevice.h
··· 953 953 #ifdef CONFIG_NET_POLL_CONTROLLER 954 954 void (*ndo_poll_controller)(struct net_device *dev); 955 955 int (*ndo_netpoll_setup)(struct net_device *dev, 956 - struct netpoll_info *info); 956 + struct netpoll_info *info, 957 + gfp_t gfp); 957 958 void (*ndo_netpoll_cleanup)(struct net_device *dev); 958 959 #endif 959 960 int (*ndo_set_vf_mac)(struct net_device *dev, ··· 1522 1521 struct sk_buff **(*gro_receive)(struct sk_buff **head, 1523 1522 struct sk_buff *skb); 1524 1523 int (*gro_complete)(struct sk_buff *skb); 1524 + bool (*id_match)(struct packet_type *ptype, 1525 + struct sock *sk); 1525 1526 void *af_packet_priv; 1526 1527 struct list_head list; 1527 1528 };
+1 -1
include/linux/netfilter/nf_conntrack_sip.h
··· 164 164 unsigned int dataoff, unsigned int datalen, 165 165 const char *name, 166 166 unsigned int *matchoff, unsigned int *matchlen, 167 - union nf_inet_addr *addr); 167 + union nf_inet_addr *addr, bool delim); 168 168 extern int ct_sip_parse_numerical_param(const struct nf_conn *ct, const char *dptr, 169 169 unsigned int off, unsigned int datalen, 170 170 const char *name,
+24 -18
include/linux/netpoll.h
··· 23 23 u8 remote_mac[ETH_ALEN]; 24 24 25 25 struct list_head rx; /* rx_np list element */ 26 + struct rcu_head rcu; 26 27 }; 27 28 28 29 struct netpoll_info { ··· 39 38 struct delayed_work tx_work; 40 39 41 40 struct netpoll *netpoll; 41 + struct rcu_head rcu; 42 42 }; 43 43 44 44 void netpoll_send_udp(struct netpoll *np, const char *msg, int len); 45 45 void netpoll_print_options(struct netpoll *np); 46 46 int netpoll_parse_options(struct netpoll *np, char *opt); 47 - int __netpoll_setup(struct netpoll *np, struct net_device *ndev); 47 + int __netpoll_setup(struct netpoll *np, struct net_device *ndev, gfp_t gfp); 48 48 int netpoll_setup(struct netpoll *np); 49 49 int netpoll_trap(void); 50 50 void netpoll_set_trap(int trap); 51 51 void __netpoll_cleanup(struct netpoll *np); 52 + void __netpoll_free_rcu(struct netpoll *np); 52 53 void netpoll_cleanup(struct netpoll *np); 53 - int __netpoll_rx(struct sk_buff *skb); 54 + int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo); 54 55 void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, 55 56 struct net_device *dev); 56 57 static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) 57 58 { 59 + unsigned long flags; 60 + local_irq_save(flags); 58 61 netpoll_send_skb_on_dev(np, skb, np->dev); 62 + local_irq_restore(flags); 59 63 } 60 64 61 65 62 66 63 67 #ifdef CONFIG_NETPOLL 68 + static inline bool netpoll_rx_on(struct sk_buff *skb) 69 + { 70 + struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo); 71 + 72 + return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags); 73 + } 74 + 64 75 static inline bool netpoll_rx(struct sk_buff *skb) 65 76 { 66 77 struct netpoll_info *npinfo; ··· 80 67 bool ret = false; 81 68 82 69 local_irq_save(flags); 83 - npinfo = rcu_dereference_bh(skb->dev->npinfo); 84 70 85 - if (!npinfo || (list_empty(&npinfo->rx_np) && !npinfo->rx_flags)) 71 + if (!netpoll_rx_on(skb)) 86 72 goto out; 87 73 74 + npinfo = rcu_dereference_bh(skb->dev->npinfo); 88 75 spin_lock(&npinfo->rx_lock); 89 76 /* check rx_flags again with the lock held */ 90 - if (npinfo->rx_flags && __netpoll_rx(skb)) 77 + if (npinfo->rx_flags && __netpoll_rx(skb, npinfo)) 91 78 ret = true; 92 79 spin_unlock(&npinfo->rx_lock); 93 80 94 81 out: 95 82 local_irq_restore(flags); 96 83 return ret; 97 - } 98 - 99 - static inline int netpoll_rx_on(struct sk_buff *skb) 100 - { 101 - struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo); 102 - 103 - return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags); 104 84 } 105 85 106 86 static inline int netpoll_receive_skb(struct sk_buff *skb) ··· 125 119 } 126 120 } 127 121 128 - static inline int netpoll_tx_running(struct net_device *dev) 122 + static inline bool netpoll_tx_running(struct net_device *dev) 129 123 { 130 124 return irqs_disabled(); 131 125 } ··· 133 127 #else 134 128 static inline bool netpoll_rx(struct sk_buff *skb) 135 129 { 136 - return 0; 130 + return false; 137 131 } 138 - static inline int netpoll_rx_on(struct sk_buff *skb) 132 + static inline bool netpoll_rx_on(struct sk_buff *skb) 139 133 { 140 - return 0; 134 + return false; 141 135 } 142 136 static inline int netpoll_receive_skb(struct sk_buff *skb) 143 137 { ··· 153 147 static inline void netpoll_netdev_init(struct net_device *dev) 154 148 { 155 149 } 156 - static inline int netpoll_tx_running(struct net_device *dev) 150 + static inline bool netpoll_tx_running(struct net_device *dev) 157 151 { 158 - return 0; 152 + return false; 159 153 } 160 154 #endif 161 155
+7
include/linux/of.h
··· 190 190 extern struct device_node *of_get_next_parent(struct device_node *node); 191 191 extern struct device_node *of_get_next_child(const struct device_node *node, 192 192 struct device_node *prev); 193 + extern struct device_node *of_get_next_available_child( 194 + const struct device_node *node, struct device_node *prev); 195 + 193 196 #define for_each_child_of_node(parent, child) \ 194 197 for (child = of_get_next_child(parent, NULL); child != NULL; \ 195 198 child = of_get_next_child(parent, child)) 199 + 200 + #define for_each_available_child_of_node(parent, child) \ 201 + for (child = of_get_next_available_child(parent, NULL); child != NULL; \ 202 + child = of_get_next_available_child(parent, child)) 196 203 197 204 static inline int of_get_child_count(const struct device_node *np) 198 205 {
+1 -1
include/net/llc.h
··· 133 133 extern void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb); 134 134 extern void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb); 135 135 136 - extern int llc_station_init(void); 136 + extern void llc_station_init(void); 137 137 extern void llc_station_exit(void); 138 138 139 139 #ifdef CONFIG_PROC_FS
+3 -1
include/net/scm.h
··· 70 70 } 71 71 72 72 static __inline__ int scm_send(struct socket *sock, struct msghdr *msg, 73 - struct scm_cookie *scm) 73 + struct scm_cookie *scm, bool forcecreds) 74 74 { 75 75 memset(scm, 0, sizeof(*scm)); 76 + if (forcecreds) 77 + scm_set_cred(scm, task_tgid(current), current_cred()); 76 78 unix_get_peersec_dgram(sock, scm); 77 79 if (msg->msg_controllen <= 0) 78 80 return 0;
+2
include/net/xfrm.h
··· 292 292 struct flowi *fl, 293 293 int reverse); 294 294 int (*get_tos)(const struct flowi *fl); 295 + void (*init_dst)(struct net *net, 296 + struct xfrm_dst *dst); 295 297 int (*init_path)(struct xfrm_dst *path, 296 298 struct dst_entry *dst, 297 299 int nfheader_len);
+31 -21
net/8021q/vlan_dev.c
··· 137 137 return rc; 138 138 } 139 139 140 + static inline netdev_tx_t vlan_netpoll_send_skb(struct vlan_dev_priv *vlan, struct sk_buff *skb) 141 + { 142 + #ifdef CONFIG_NET_POLL_CONTROLLER 143 + if (vlan->netpoll) 144 + netpoll_send_skb(vlan->netpoll, skb); 145 + #else 146 + BUG(); 147 + #endif 148 + return NETDEV_TX_OK; 149 + } 150 + 140 151 static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb, 141 152 struct net_device *dev) 142 153 { 154 + struct vlan_dev_priv *vlan = vlan_dev_priv(dev); 143 155 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data); 144 156 unsigned int len; 145 157 int ret; ··· 162 150 * OTHER THINGS LIKE FDDI/TokenRing/802.3 SNAPs... 163 151 */ 164 152 if (veth->h_vlan_proto != htons(ETH_P_8021Q) || 165 - vlan_dev_priv(dev)->flags & VLAN_FLAG_REORDER_HDR) { 153 + vlan->flags & VLAN_FLAG_REORDER_HDR) { 166 154 u16 vlan_tci; 167 - vlan_tci = vlan_dev_priv(dev)->vlan_id; 155 + vlan_tci = vlan->vlan_id; 168 156 vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb); 169 157 skb = __vlan_hwaccel_put_tag(skb, vlan_tci); 170 158 } 171 159 172 - skb->dev = vlan_dev_priv(dev)->real_dev; 160 + skb->dev = vlan->real_dev; 173 161 len = skb->len; 174 - if (netpoll_tx_running(dev)) 175 - return skb->dev->netdev_ops->ndo_start_xmit(skb, skb->dev); 162 + if (unlikely(netpoll_tx_running(dev))) 163 + return vlan_netpoll_send_skb(vlan, skb); 164 + 176 165 ret = dev_queue_xmit(skb); 177 166 178 167 if (likely(ret == NET_XMIT_SUCCESS || ret == NET_XMIT_CN)) { 179 168 struct vlan_pcpu_stats *stats; 180 169 181 - stats = this_cpu_ptr(vlan_dev_priv(dev)->vlan_pcpu_stats); 170 + stats = this_cpu_ptr(vlan->vlan_pcpu_stats); 182 171 u64_stats_update_begin(&stats->syncp); 183 172 stats->tx_packets++; 184 173 stats->tx_bytes += len; 185 174 u64_stats_update_end(&stats->syncp); 186 175 } else { 187 - this_cpu_inc(vlan_dev_priv(dev)->vlan_pcpu_stats->tx_dropped); 176 + this_cpu_inc(vlan->vlan_pcpu_stats->tx_dropped); 188 177 } 189 178 190 179 return ret; ··· 682 669 return; 683 670 } 684 671 685 - static int vlan_dev_netpoll_setup(struct net_device *dev, struct netpoll_info *npinfo) 672 + static int vlan_dev_netpoll_setup(struct net_device *dev, struct netpoll_info *npinfo, 673 + gfp_t gfp) 686 674 { 687 - struct vlan_dev_priv *info = vlan_dev_priv(dev); 688 - struct net_device *real_dev = info->real_dev; 675 + struct vlan_dev_priv *vlan = vlan_dev_priv(dev); 676 + struct net_device *real_dev = vlan->real_dev; 689 677 struct netpoll *netpoll; 690 678 int err = 0; 691 679 692 - netpoll = kzalloc(sizeof(*netpoll), GFP_KERNEL); 680 + netpoll = kzalloc(sizeof(*netpoll), gfp); 693 681 err = -ENOMEM; 694 682 if (!netpoll) 695 683 goto out; 696 684 697 - err = __netpoll_setup(netpoll, real_dev); 685 + err = __netpoll_setup(netpoll, real_dev, gfp); 698 686 if (err) { 699 687 kfree(netpoll); 700 688 goto out; 701 689 } 702 690 703 - info->netpoll = netpoll; 691 + vlan->netpoll = netpoll; 704 692 705 693 out: 706 694 return err; ··· 709 695 710 696 static void vlan_dev_netpoll_cleanup(struct net_device *dev) 711 697 { 712 - struct vlan_dev_priv *info = vlan_dev_priv(dev); 713 - struct netpoll *netpoll = info->netpoll; 698 + struct vlan_dev_priv *vlan= vlan_dev_priv(dev); 699 + struct netpoll *netpoll = vlan->netpoll; 714 700 715 701 if (!netpoll) 716 702 return; 717 703 718 - info->netpoll = NULL; 704 + vlan->netpoll = NULL; 719 705 720 - /* Wait for transmitting packets to finish before freeing. */ 721 - synchronize_rcu_bh(); 722 - 723 - __netpoll_cleanup(netpoll); 724 - kfree(netpoll); 706 + __netpoll_free_rcu(netpoll); 725 707 } 726 708 #endif /* CONFIG_NET_POLL_CONTROLLER */ 727 709
+1
net/atm/common.c
··· 812 812 813 813 if (!vcc->dev || !test_bit(ATM_VF_ADDR, &vcc->flags)) 814 814 return -ENOTCONN; 815 + memset(&pvc, 0, sizeof(pvc)); 815 816 pvc.sap_family = AF_ATMPVC; 816 817 pvc.sap_addr.itf = vcc->dev->number; 817 818 pvc.sap_addr.vpi = vcc->vpi;
+1
net/atm/pvc.c
··· 95 95 return -ENOTCONN; 96 96 *sockaddr_len = sizeof(struct sockaddr_atmpvc); 97 97 addr = (struct sockaddr_atmpvc *)sockaddr; 98 + memset(addr, 0, sizeof(*addr)); 98 99 addr->sap_family = AF_ATMPVC; 99 100 addr->sap_addr.itf = vcc->dev->number; 100 101 addr->sap_addr.vpi = vcc->vpi;
+22 -6
net/bluetooth/hci_event.c
··· 1365 1365 return false; 1366 1366 1367 1367 e = hci_inquiry_cache_lookup_resolve(hdev, BDADDR_ANY, NAME_NEEDED); 1368 + if (!e) 1369 + return false; 1370 + 1368 1371 if (hci_resolve_name(hdev, e) == 0) { 1369 1372 e->name_state = NAME_PENDING; 1370 1373 return true; ··· 1396 1393 return; 1397 1394 1398 1395 e = hci_inquiry_cache_lookup_resolve(hdev, bdaddr, NAME_PENDING); 1399 - if (e) { 1396 + /* If the device was not found in a list of found devices names of which 1397 + * are pending. there is no need to continue resolving a next name as it 1398 + * will be done upon receiving another Remote Name Request Complete 1399 + * Event */ 1400 + if (!e) 1401 + return; 1402 + 1403 + list_del(&e->list); 1404 + if (name) { 1400 1405 e->name_state = NAME_KNOWN; 1401 - list_del(&e->list); 1402 - if (name) 1403 - mgmt_remote_name(hdev, bdaddr, ACL_LINK, 0x00, 1404 - e->data.rssi, name, name_len); 1406 + mgmt_remote_name(hdev, bdaddr, ACL_LINK, 0x00, 1407 + e->data.rssi, name, name_len); 1408 + } else { 1409 + e->name_state = NAME_NOT_KNOWN; 1405 1410 } 1406 1411 1407 1412 if (hci_resolve_next_name(hdev)) ··· 1773 1762 if (conn->type == ACL_LINK) { 1774 1763 conn->state = BT_CONFIG; 1775 1764 hci_conn_hold(conn); 1776 - conn->disc_timeout = HCI_DISCONN_TIMEOUT; 1765 + 1766 + if (!conn->out && !hci_conn_ssp_enabled(conn) && 1767 + !hci_find_link_key(hdev, &ev->bdaddr)) 1768 + conn->disc_timeout = HCI_PAIRING_TIMEOUT; 1769 + else 1770 + conn->disc_timeout = HCI_DISCONN_TIMEOUT; 1777 1771 } else 1778 1772 conn->state = BT_CONNECTED; 1779 1773
+2
net/bluetooth/hci_sock.c
··· 694 694 *addr_len = sizeof(*haddr); 695 695 haddr->hci_family = AF_BLUETOOTH; 696 696 haddr->hci_dev = hdev->id; 697 + haddr->hci_channel= 0; 697 698 698 699 release_sock(sk); 699 700 return 0; ··· 1010 1009 { 1011 1010 struct hci_filter *f = &hci_pi(sk)->filter; 1012 1011 1012 + memset(&uf, 0, sizeof(uf)); 1013 1013 uf.type_mask = f->type_mask; 1014 1014 uf.opcode = f->opcode; 1015 1015 uf.event_mask[0] = *((u32 *) f->event_mask + 0);
+1
net/bluetooth/l2cap_core.c
··· 1181 1181 sk = chan->sk; 1182 1182 1183 1183 hci_conn_hold(conn->hcon); 1184 + conn->hcon->disc_timeout = HCI_DISCONN_TIMEOUT; 1184 1185 1185 1186 bacpy(&bt_sk(sk)->src, conn->src); 1186 1187 bacpy(&bt_sk(sk)->dst, conn->dst);
+2 -1
net/bluetooth/l2cap_sock.c
··· 245 245 246 246 BT_DBG("sock %p, sk %p", sock, sk); 247 247 248 + memset(la, 0, sizeof(struct sockaddr_l2)); 248 249 addr->sa_family = AF_BLUETOOTH; 249 250 *len = sizeof(struct sockaddr_l2); 250 251 ··· 1175 1174 1176 1175 chan = l2cap_chan_create(); 1177 1176 if (!chan) { 1178 - l2cap_sock_kill(sk); 1177 + sk_free(sk); 1179 1178 return NULL; 1180 1179 } 1181 1180
+2
net/bluetooth/rfcomm/sock.c
··· 528 528 529 529 BT_DBG("sock %p, sk %p", sock, sk); 530 530 531 + memset(sa, 0, sizeof(*sa)); 531 532 sa->rc_family = AF_BLUETOOTH; 532 533 sa->rc_channel = rfcomm_pi(sk)->channel; 533 534 if (peer) ··· 823 822 } 824 823 825 824 sec.level = rfcomm_pi(sk)->sec_level; 825 + sec.key_size = 0; 826 826 827 827 len = min_t(unsigned int, len, sizeof(sec)); 828 828 if (copy_to_user(optval, (char *) &sec, len))
+1 -1
net/bluetooth/rfcomm/tty.c
··· 456 456 457 457 size = sizeof(*dl) + dev_num * sizeof(*di); 458 458 459 - dl = kmalloc(size, GFP_KERNEL); 459 + dl = kzalloc(size, GFP_KERNEL); 460 460 if (!dl) 461 461 return -ENOMEM; 462 462
+9 -10
net/bluetooth/sco.c
··· 131 131 sco_sock_clear_timer(sk); 132 132 sco_chan_del(sk, err); 133 133 bh_unlock_sock(sk); 134 + 135 + sco_conn_lock(conn); 136 + conn->sk = NULL; 137 + sco_pi(sk)->conn = NULL; 138 + sco_conn_unlock(conn); 139 + 140 + if (conn->hcon) 141 + hci_conn_put(conn->hcon); 142 + 134 143 sco_sock_kill(sk); 135 144 } 136 145 ··· 829 820 conn = sco_pi(sk)->conn; 830 821 831 822 BT_DBG("sk %p, conn %p, err %d", sk, conn, err); 832 - 833 - if (conn) { 834 - sco_conn_lock(conn); 835 - conn->sk = NULL; 836 - sco_pi(sk)->conn = NULL; 837 - sco_conn_unlock(conn); 838 - 839 - if (conn->hcon) 840 - hci_conn_put(conn->hcon); 841 - } 842 823 843 824 sk->sk_state = BT_CLOSED; 844 825 sk->sk_err = err;
+4 -1
net/bluetooth/smp.c
··· 579 579 580 580 if (!test_and_set_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags)) 581 581 smp = smp_chan_create(conn); 582 + else 583 + smp = conn->smp_chan; 582 584 583 - smp = conn->smp_chan; 585 + if (!smp) 586 + return SMP_UNSPECIFIED; 584 587 585 588 smp->preq[0] = SMP_CMD_PAIRING_REQ; 586 589 memcpy(&smp->preq[1], req, sizeof(*req));
+13 -17
net/bridge/br_device.c
··· 31 31 struct net_bridge_mdb_entry *mdst; 32 32 struct br_cpu_netstats *brstats = this_cpu_ptr(br->stats); 33 33 34 + rcu_read_lock(); 34 35 #ifdef CONFIG_BRIDGE_NETFILTER 35 36 if (skb->nf_bridge && (skb->nf_bridge->mask & BRNF_BRIDGED_DNAT)) { 36 37 br_nf_pre_routing_finish_bridge_slow(skb); 38 + rcu_read_unlock(); 37 39 return NETDEV_TX_OK; 38 40 } 39 41 #endif ··· 50 48 skb_reset_mac_header(skb); 51 49 skb_pull(skb, ETH_HLEN); 52 50 53 - rcu_read_lock(); 54 51 if (is_broadcast_ether_addr(dest)) 55 52 br_flood_deliver(br, skb); 56 53 else if (is_multicast_ether_addr(dest)) { ··· 207 206 static void br_netpoll_cleanup(struct net_device *dev) 208 207 { 209 208 struct net_bridge *br = netdev_priv(dev); 210 - struct net_bridge_port *p, *n; 209 + struct net_bridge_port *p; 211 210 212 - list_for_each_entry_safe(p, n, &br->port_list, list) { 211 + list_for_each_entry(p, &br->port_list, list) 213 212 br_netpoll_disable(p); 214 - } 215 213 } 216 214 217 - static int br_netpoll_setup(struct net_device *dev, struct netpoll_info *ni) 215 + static int br_netpoll_setup(struct net_device *dev, struct netpoll_info *ni, 216 + gfp_t gfp) 218 217 { 219 218 struct net_bridge *br = netdev_priv(dev); 220 - struct net_bridge_port *p, *n; 219 + struct net_bridge_port *p; 221 220 int err = 0; 222 221 223 - list_for_each_entry_safe(p, n, &br->port_list, list) { 222 + list_for_each_entry(p, &br->port_list, list) { 224 223 if (!p->dev) 225 224 continue; 226 - 227 - err = br_netpoll_enable(p); 225 + err = br_netpoll_enable(p, gfp); 228 226 if (err) 229 227 goto fail; 230 228 } ··· 236 236 goto out; 237 237 } 238 238 239 - int br_netpoll_enable(struct net_bridge_port *p) 239 + int br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp) 240 240 { 241 241 struct netpoll *np; 242 242 int err = 0; 243 243 244 - np = kzalloc(sizeof(*p->np), GFP_KERNEL); 244 + np = kzalloc(sizeof(*p->np), gfp); 245 245 err = -ENOMEM; 246 246 if (!np) 247 247 goto out; 248 248 249 - err = __netpoll_setup(np, p->dev); 249 + err = __netpoll_setup(np, p->dev, gfp); 250 250 if (err) { 251 251 kfree(np); 252 252 goto out; ··· 267 267 268 268 p->np = NULL; 269 269 270 - /* Wait for transmitting packets to finish before freeing. */ 271 - synchronize_rcu_bh(); 272 - 273 - __netpoll_cleanup(np); 274 - kfree(np); 270 + __netpoll_free_rcu(np); 275 271 } 276 272 277 273 #endif
+1 -1
net/bridge/br_forward.c
··· 65 65 { 66 66 skb->dev = to->dev; 67 67 68 - if (unlikely(netpoll_tx_running(to->dev))) { 68 + if (unlikely(netpoll_tx_running(to->br->dev))) { 69 69 if (packet_length(skb) > skb->dev->mtu && !skb_is_gso(skb)) 70 70 kfree_skb(skb); 71 71 else {
+5 -1
net/bridge/br_if.c
··· 361 361 if (err) 362 362 goto err2; 363 363 364 - if (br_netpoll_info(br) && ((err = br_netpoll_enable(p)))) 364 + if (br_netpoll_info(br) && ((err = br_netpoll_enable(p, GFP_KERNEL)))) 365 365 goto err3; 366 366 367 367 err = netdev_set_master(dev, br->dev); ··· 427 427 if (!p || p->br != br) 428 428 return -EINVAL; 429 429 430 + /* Since more than one interface can be attached to a bridge, 431 + * there still maybe an alternate path for netconsole to use; 432 + * therefore there is no reason for a NETDEV_RELEASE event. 433 + */ 430 434 del_nbp(p); 431 435 432 436 spin_lock_bh(&br->lock);
+2 -2
net/bridge/br_private.h
··· 316 316 netpoll_send_skb(np, skb); 317 317 } 318 318 319 - extern int br_netpoll_enable(struct net_bridge_port *p); 319 + extern int br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp); 320 320 extern void br_netpoll_disable(struct net_bridge_port *p); 321 321 #else 322 322 static inline struct netpoll_info *br_netpoll_info(struct net_bridge *br) ··· 329 329 { 330 330 } 331 331 332 - static inline int br_netpoll_enable(struct net_bridge_port *p) 332 + static inline int br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp) 333 333 { 334 334 return 0; 335 335 }
+4
net/caif/chnl_net.c
··· 94 94 95 95 /* check the version of IP */ 96 96 ip_version = skb_header_pointer(skb, 0, 1, &buf); 97 + if (!ip_version) { 98 + kfree_skb(skb); 99 + return -EINVAL; 100 + } 97 101 98 102 switch (*ip_version >> 4) { 99 103 case 4:
+15 -2
net/core/dev.c
··· 1642 1642 return pt_prev->func(skb, skb->dev, pt_prev, orig_dev); 1643 1643 } 1644 1644 1645 + static inline bool skb_loop_sk(struct packet_type *ptype, struct sk_buff *skb) 1646 + { 1647 + if (ptype->af_packet_priv == NULL) 1648 + return false; 1649 + 1650 + if (ptype->id_match) 1651 + return ptype->id_match(ptype, skb->sk); 1652 + else if ((struct sock *)ptype->af_packet_priv == skb->sk) 1653 + return true; 1654 + 1655 + return false; 1656 + } 1657 + 1645 1658 /* 1646 1659 * Support routine. Sends outgoing frames to any network 1647 1660 * taps currently in use. ··· 1672 1659 * they originated from - MvS (miquels@drinkel.ow.org) 1673 1660 */ 1674 1661 if ((ptype->dev == dev || !ptype->dev) && 1675 - (ptype->af_packet_priv == NULL || 1676 - (struct sock *)ptype->af_packet_priv != skb->sk)) { 1662 + (!skb_loop_sk(ptype, skb))) { 1677 1663 if (pt_prev) { 1678 1664 deliver_skb(skb2, pt_prev, skb->dev); 1679 1665 pt_prev = ptype; ··· 5744 5732 5745 5733 /** 5746 5734 * netdev_wait_allrefs - wait until all references are gone. 5735 + * @dev: target net_device 5747 5736 * 5748 5737 * This is called when unregistering network devices. 5749 5738 *
+79 -32
net/core/netpoll.c
··· 26 26 #include <linux/workqueue.h> 27 27 #include <linux/slab.h> 28 28 #include <linux/export.h> 29 + #include <linux/if_vlan.h> 29 30 #include <net/tcp.h> 30 31 #include <net/udp.h> 31 32 #include <asm/unaligned.h> ··· 55 54 MAX_UDP_CHUNK) 56 55 57 56 static void zap_completion_queue(void); 58 - static void arp_reply(struct sk_buff *skb); 57 + static void netpoll_arp_reply(struct sk_buff *skb, struct netpoll_info *npinfo); 59 58 60 59 static unsigned int carrier_timeout = 4; 61 60 module_param(carrier_timeout, uint, 0644); ··· 168 167 struct napi_struct *napi; 169 168 int budget = 16; 170 169 170 + WARN_ON_ONCE(!irqs_disabled()); 171 + 171 172 list_for_each_entry(napi, &dev->napi_list, dev_list) { 173 + local_irq_enable(); 172 174 if (napi->poll_owner != smp_processor_id() && 173 175 spin_trylock(&napi->poll_lock)) { 174 - budget = poll_one_napi(dev->npinfo, napi, budget); 176 + rcu_read_lock_bh(); 177 + budget = poll_one_napi(rcu_dereference_bh(dev->npinfo), 178 + napi, budget); 179 + rcu_read_unlock_bh(); 175 180 spin_unlock(&napi->poll_lock); 176 181 177 - if (!budget) 182 + if (!budget) { 183 + local_irq_disable(); 178 184 break; 185 + } 179 186 } 187 + local_irq_disable(); 180 188 } 181 189 } 182 190 ··· 195 185 struct sk_buff *skb; 196 186 197 187 while ((skb = skb_dequeue(&npi->arp_tx))) 198 - arp_reply(skb); 188 + netpoll_arp_reply(skb, npi); 199 189 } 200 190 } 201 191 202 192 static void netpoll_poll_dev(struct net_device *dev) 203 193 { 204 194 const struct net_device_ops *ops; 195 + struct netpoll_info *ni = rcu_dereference_bh(dev->npinfo); 205 196 206 197 if (!dev || !netif_running(dev)) 207 198 return; ··· 217 206 poll_napi(dev); 218 207 219 208 if (dev->flags & IFF_SLAVE) { 220 - if (dev->npinfo) { 209 + if (ni) { 221 210 struct net_device *bond_dev = dev->master; 222 211 struct sk_buff *skb; 223 - while ((skb = skb_dequeue(&dev->npinfo->arp_tx))) { 212 + struct netpoll_info *bond_ni = rcu_dereference_bh(bond_dev->npinfo); 213 + while ((skb = skb_dequeue(&ni->arp_tx))) { 224 214 skb->dev = bond_dev; 225 - skb_queue_tail(&bond_dev->npinfo->arp_tx, skb); 215 + skb_queue_tail(&bond_ni->arp_tx, skb); 226 216 } 227 217 } 228 218 } 229 219 230 - service_arp_queue(dev->npinfo); 220 + service_arp_queue(ni); 231 221 232 222 zap_completion_queue(); 233 223 } ··· 314 302 return 0; 315 303 } 316 304 305 + /* call with IRQ disabled */ 317 306 void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, 318 307 struct net_device *dev) 319 308 { ··· 322 309 unsigned long tries; 323 310 const struct net_device_ops *ops = dev->netdev_ops; 324 311 /* It is up to the caller to keep npinfo alive. */ 325 - struct netpoll_info *npinfo = np->dev->npinfo; 312 + struct netpoll_info *npinfo; 326 313 314 + WARN_ON_ONCE(!irqs_disabled()); 315 + 316 + npinfo = rcu_dereference_bh(np->dev->npinfo); 327 317 if (!npinfo || !netif_running(dev) || !netif_device_present(dev)) { 328 318 __kfree_skb(skb); 329 319 return; ··· 335 319 /* don't get messages out of order, and no recursion */ 336 320 if (skb_queue_len(&npinfo->txq) == 0 && !netpoll_owner_active(dev)) { 337 321 struct netdev_queue *txq; 338 - unsigned long flags; 339 322 340 323 txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb)); 341 324 342 - local_irq_save(flags); 343 325 /* try until next clock tick */ 344 326 for (tries = jiffies_to_usecs(1)/USEC_PER_POLL; 345 327 tries > 0; --tries) { 346 328 if (__netif_tx_trylock(txq)) { 347 329 if (!netif_xmit_stopped(txq)) { 330 + if (vlan_tx_tag_present(skb) && 331 + !(netif_skb_features(skb) & NETIF_F_HW_VLAN_TX)) { 332 + skb = __vlan_put_tag(skb, vlan_tx_tag_get(skb)); 333 + if (unlikely(!skb)) 334 + break; 335 + skb->vlan_tci = 0; 336 + } 337 + 348 338 status = ops->ndo_start_xmit(skb, dev); 349 339 if (status == NETDEV_TX_OK) 350 340 txq_trans_update(txq); ··· 369 347 } 370 348 371 349 WARN_ONCE(!irqs_disabled(), 372 - "netpoll_send_skb(): %s enabled interrupts in poll (%pF)\n", 350 + "netpoll_send_skb_on_dev(): %s enabled interrupts in poll (%pF)\n", 373 351 dev->name, ops->ndo_start_xmit); 374 352 375 - local_irq_restore(flags); 376 353 } 377 354 378 355 if (status != NETDEV_TX_OK) { ··· 444 423 } 445 424 EXPORT_SYMBOL(netpoll_send_udp); 446 425 447 - static void arp_reply(struct sk_buff *skb) 426 + static void netpoll_arp_reply(struct sk_buff *skb, struct netpoll_info *npinfo) 448 427 { 449 - struct netpoll_info *npinfo = skb->dev->npinfo; 450 428 struct arphdr *arp; 451 429 unsigned char *arp_ptr; 452 430 int size, type = ARPOP_REPLY, ptype = ETH_P_ARP; ··· 563 543 spin_unlock_irqrestore(&npinfo->rx_lock, flags); 564 544 } 565 545 566 - int __netpoll_rx(struct sk_buff *skb) 546 + int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo) 567 547 { 568 548 int proto, len, ulen; 569 549 int hits = 0; 570 550 const struct iphdr *iph; 571 551 struct udphdr *uh; 572 - struct netpoll_info *npinfo = skb->dev->npinfo; 573 552 struct netpoll *np, *tmp; 574 553 575 554 if (list_empty(&npinfo->rx_np)) ··· 582 563 atomic_read(&trapped)) { 583 564 skb_queue_tail(&npinfo->arp_tx, skb); 584 565 return 1; 566 + } 567 + 568 + if (skb->protocol == cpu_to_be16(ETH_P_8021Q)) { 569 + skb = vlan_untag(skb); 570 + if (unlikely(!skb)) 571 + goto out; 585 572 } 586 573 587 574 proto = ntohs(eth_hdr(skb)->h_proto); ··· 740 715 } 741 716 EXPORT_SYMBOL(netpoll_parse_options); 742 717 743 - int __netpoll_setup(struct netpoll *np, struct net_device *ndev) 718 + int __netpoll_setup(struct netpoll *np, struct net_device *ndev, gfp_t gfp) 744 719 { 745 720 struct netpoll_info *npinfo; 746 721 const struct net_device_ops *ops; ··· 759 734 } 760 735 761 736 if (!ndev->npinfo) { 762 - npinfo = kmalloc(sizeof(*npinfo), GFP_KERNEL); 737 + npinfo = kmalloc(sizeof(*npinfo), gfp); 763 738 if (!npinfo) { 764 739 err = -ENOMEM; 765 740 goto out; ··· 777 752 778 753 ops = np->dev->netdev_ops; 779 754 if (ops->ndo_netpoll_setup) { 780 - err = ops->ndo_netpoll_setup(ndev, npinfo); 755 + err = ops->ndo_netpoll_setup(ndev, npinfo, gfp); 781 756 if (err) 782 757 goto free_npinfo; 783 758 } ··· 882 857 refill_skbs(); 883 858 884 859 rtnl_lock(); 885 - err = __netpoll_setup(np, ndev); 860 + err = __netpoll_setup(np, ndev, GFP_KERNEL); 886 861 rtnl_unlock(); 887 862 888 863 if (err) ··· 902 877 return 0; 903 878 } 904 879 core_initcall(netpoll_init); 880 + 881 + static void rcu_cleanup_netpoll_info(struct rcu_head *rcu_head) 882 + { 883 + struct netpoll_info *npinfo = 884 + container_of(rcu_head, struct netpoll_info, rcu); 885 + 886 + skb_queue_purge(&npinfo->arp_tx); 887 + skb_queue_purge(&npinfo->txq); 888 + 889 + /* we can't call cancel_delayed_work_sync here, as we are in softirq */ 890 + cancel_delayed_work(&npinfo->tx_work); 891 + 892 + /* clean after last, unfinished work */ 893 + __skb_queue_purge(&npinfo->txq); 894 + /* now cancel it again */ 895 + cancel_delayed_work(&npinfo->tx_work); 896 + kfree(npinfo); 897 + } 905 898 906 899 void __netpoll_cleanup(struct netpoll *np) 907 900 { ··· 946 903 ops->ndo_netpoll_cleanup(np->dev); 947 904 948 905 RCU_INIT_POINTER(np->dev->npinfo, NULL); 949 - 950 - /* avoid racing with NAPI reading npinfo */ 951 - synchronize_rcu_bh(); 952 - 953 - skb_queue_purge(&npinfo->arp_tx); 954 - skb_queue_purge(&npinfo->txq); 955 - cancel_delayed_work_sync(&npinfo->tx_work); 956 - 957 - /* clean after last, unfinished work */ 958 - __skb_queue_purge(&npinfo->txq); 959 - kfree(npinfo); 906 + call_rcu_bh(&npinfo->rcu, rcu_cleanup_netpoll_info); 960 907 } 961 908 } 962 909 EXPORT_SYMBOL_GPL(__netpoll_cleanup); 910 + 911 + static void rcu_cleanup_netpoll(struct rcu_head *rcu_head) 912 + { 913 + struct netpoll *np = container_of(rcu_head, struct netpoll, rcu); 914 + 915 + __netpoll_cleanup(np); 916 + kfree(np); 917 + } 918 + 919 + void __netpoll_free_rcu(struct netpoll *np) 920 + { 921 + call_rcu_bh(&np->rcu, rcu_cleanup_netpoll); 922 + } 923 + EXPORT_SYMBOL_GPL(__netpoll_free_rcu); 963 924 964 925 void netpoll_cleanup(struct netpoll *np) 965 926 {
+7 -23
net/core/netprio_cgroup.c
··· 101 101 u32 max_len; 102 102 struct netprio_map *map; 103 103 104 - rtnl_lock(); 105 104 max_len = atomic_read(&max_prioidx) + 1; 106 105 map = rtnl_dereference(dev->priomap); 107 106 if (!map || map->priomap_len < max_len) 108 107 ret = extend_netdev_table(dev, max_len); 109 - rtnl_unlock(); 110 108 111 109 return ret; 112 110 } ··· 254 256 if (!dev) 255 257 goto out_free_devname; 256 258 259 + rtnl_lock(); 257 260 ret = write_update_netdev_table(dev); 258 261 if (ret < 0) 259 262 goto out_put_dev; 260 263 261 - rcu_read_lock(); 262 - map = rcu_dereference(dev->priomap); 264 + map = rtnl_dereference(dev->priomap); 263 265 if (map) 264 266 map->priomap[prioidx] = priority; 265 - rcu_read_unlock(); 266 267 267 268 out_put_dev: 269 + rtnl_unlock(); 268 270 dev_put(dev); 269 271 270 272 out_free_devname: ··· 275 277 void net_prio_attach(struct cgroup *cgrp, struct cgroup_taskset *tset) 276 278 { 277 279 struct task_struct *p; 278 - char *tmp = kzalloc(sizeof(char) * PATH_MAX, GFP_KERNEL); 279 - 280 - if (!tmp) { 281 - pr_warn("Unable to attach cgrp due to alloc failure!\n"); 282 - return; 283 - } 284 280 285 281 cgroup_taskset_for_each(p, cgrp, tset) { 286 282 unsigned int fd; ··· 288 296 continue; 289 297 } 290 298 291 - rcu_read_lock(); 299 + spin_lock(&files->file_lock); 292 300 fdt = files_fdtable(files); 293 301 for (fd = 0; fd < fdt->max_fds; fd++) { 294 - char *path; 295 302 struct file *file; 296 303 struct socket *sock; 297 - unsigned long s; 298 - int rv, err = 0; 304 + int err; 299 305 300 306 file = fcheck_files(files, fd); 301 307 if (!file) 302 308 continue; 303 309 304 - path = d_path(&file->f_path, tmp, PAGE_SIZE); 305 - rv = sscanf(path, "socket:[%lu]", &s); 306 - if (rv <= 0) 307 - continue; 308 - 309 310 sock = sock_from_file(file, &err); 310 - if (!err) 311 + if (sock) 311 312 sock_update_netprioidx(sock->sk, p); 312 313 } 313 - rcu_read_unlock(); 314 + spin_unlock(&files->file_lock); 314 315 task_unlock(p); 315 316 } 316 - kfree(tmp); 317 317 } 318 318 319 319 static struct cftype ss_files[] = {
+4
net/core/scm.c
··· 265 265 for (i=0, cmfptr=(__force int __user *)CMSG_DATA(cm); i<fdmax; 266 266 i++, cmfptr++) 267 267 { 268 + struct socket *sock; 268 269 int new_fd; 269 270 err = security_file_receive(fp[i]); 270 271 if (err) ··· 282 281 } 283 282 /* Bump the usage count and install the file. */ 284 283 get_file(fp[i]); 284 + sock = sock_from_file(fp[i], &err); 285 + if (sock) 286 + sock_update_netprioidx(sock->sk, current); 285 287 fd_install(new_fd, fp[i]); 286 288 } 287 289
+2 -2
net/dccp/ccid.h
··· 246 246 u32 __user *optval, int __user *optlen) 247 247 { 248 248 int rc = -ENOPROTOOPT; 249 - if (ccid->ccid_ops->ccid_hc_rx_getsockopt != NULL) 249 + if (ccid != NULL && ccid->ccid_ops->ccid_hc_rx_getsockopt != NULL) 250 250 rc = ccid->ccid_ops->ccid_hc_rx_getsockopt(sk, optname, len, 251 251 optval, optlen); 252 252 return rc; ··· 257 257 u32 __user *optval, int __user *optlen) 258 258 { 259 259 int rc = -ENOPROTOOPT; 260 - if (ccid->ccid_ops->ccid_hc_tx_getsockopt != NULL) 260 + if (ccid != NULL && ccid->ccid_ops->ccid_hc_tx_getsockopt != NULL) 261 261 rc = ccid->ccid_ops->ccid_hc_tx_getsockopt(sk, optname, len, 262 262 optval, optlen); 263 263 return rc;
+1
net/dccp/ccids/ccid3.c
··· 535 535 case DCCP_SOCKOPT_CCID_TX_INFO: 536 536 if (len < sizeof(tfrc)) 537 537 return -EINVAL; 538 + memset(&tfrc, 0, sizeof(tfrc)); 538 539 tfrc.tfrctx_x = hc->tx_x; 539 540 tfrc.tfrctx_x_recv = hc->tx_x_recv; 540 541 tfrc.tfrctx_x_calc = hc->tx_x_calc;
+6 -1
net/ipv4/inet_connection_sock.c
··· 404 404 { 405 405 const struct inet_request_sock *ireq = inet_rsk(req); 406 406 struct inet_sock *newinet = inet_sk(newsk); 407 - struct ip_options_rcu *opt = ireq->opt; 407 + struct ip_options_rcu *opt; 408 408 struct net *net = sock_net(sk); 409 409 struct flowi4 *fl4; 410 410 struct rtable *rt; 411 411 412 412 fl4 = &newinet->cork.fl.u.ip4; 413 + 414 + rcu_read_lock(); 415 + opt = rcu_dereference(newinet->inet_opt); 413 416 flowi4_init_output(fl4, sk->sk_bound_dev_if, sk->sk_mark, 414 417 RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, 415 418 sk->sk_protocol, inet_sk_flowi_flags(sk), ··· 424 421 goto no_route; 425 422 if (opt && opt->opt.is_strictroute && rt->rt_gateway) 426 423 goto route_err; 424 + rcu_read_unlock(); 427 425 return &rt->dst; 428 426 429 427 route_err: 430 428 ip_rt_put(rt); 431 429 no_route: 430 + rcu_read_unlock(); 432 431 IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); 433 432 return NULL; 434 433 }
+1 -1
net/ipv4/ip_output.c
··· 1338 1338 iph->ihl = 5; 1339 1339 iph->tos = inet->tos; 1340 1340 iph->frag_off = df; 1341 - ip_select_ident(iph, &rt->dst, sk); 1342 1341 iph->ttl = ttl; 1343 1342 iph->protocol = sk->sk_protocol; 1344 1343 ip_copy_addrs(iph, fl4); 1344 + ip_select_ident(iph, &rt->dst, sk); 1345 1345 1346 1346 if (opt) { 1347 1347 iph->ihl += opt->optlen>>2;
+5 -4
net/ipv4/netfilter/nf_nat_sip.c
··· 148 148 if (ct_sip_parse_header_uri(ct, *dptr, NULL, *datalen, 149 149 hdr, NULL, &matchoff, &matchlen, 150 150 &addr, &port) > 0) { 151 - unsigned int matchend, poff, plen, buflen, n; 151 + unsigned int olen, matchend, poff, plen, buflen, n; 152 152 char buffer[sizeof("nnn.nnn.nnn.nnn:nnnnn")]; 153 153 154 154 /* We're only interested in headers related to this ··· 163 163 goto next; 164 164 } 165 165 166 + olen = *datalen; 166 167 if (!map_addr(skb, dataoff, dptr, datalen, matchoff, matchlen, 167 168 &addr, port)) 168 169 return NF_DROP; 169 170 170 - matchend = matchoff + matchlen; 171 + matchend = matchoff + matchlen + *datalen - olen; 171 172 172 173 /* The maddr= parameter (RFC 2361) specifies where to send 173 174 * the reply. */ 174 175 if (ct_sip_parse_address_param(ct, *dptr, matchend, *datalen, 175 176 "maddr=", &poff, &plen, 176 - &addr) > 0 && 177 + &addr, true) > 0 && 177 178 addr.ip == ct->tuplehash[dir].tuple.src.u3.ip && 178 179 addr.ip != ct->tuplehash[!dir].tuple.dst.u3.ip) { 179 180 buflen = sprintf(buffer, "%pI4", ··· 188 187 * from which the server received the request. */ 189 188 if (ct_sip_parse_address_param(ct, *dptr, matchend, *datalen, 190 189 "received=", &poff, &plen, 191 - &addr) > 0 && 190 + &addr, false) > 0 && 192 191 addr.ip == ct->tuplehash[dir].tuple.dst.u3.ip && 193 192 addr.ip != ct->tuplehash[!dir].tuple.src.u3.ip) { 194 193 buflen = sprintf(buffer, "%pI4",
-1
net/ipv4/route.c
··· 2028 2028 } 2029 2029 dev_out = net->loopback_dev; 2030 2030 fl4->flowi4_oif = dev_out->ifindex; 2031 - res.fi = NULL; 2032 2031 flags |= RTCF_LOCAL; 2033 2032 goto make_route; 2034 2033 }
+6 -3
net/ipv4/tcp_ipv4.c
··· 417 417 418 418 if (code == ICMP_FRAG_NEEDED) { /* PMTU discovery (RFC1191) */ 419 419 tp->mtu_info = info; 420 - if (!sock_owned_by_user(sk)) 420 + if (!sock_owned_by_user(sk)) { 421 421 tcp_v4_mtu_reduced(sk); 422 - else 423 - set_bit(TCP_MTU_REDUCED_DEFERRED, &tp->tsq_flags); 422 + } else { 423 + if (!test_and_set_bit(TCP_MTU_REDUCED_DEFERRED, &tp->tsq_flags)) 424 + sock_hold(sk); 425 + } 424 426 goto out; 425 427 } 426 428 ··· 1464 1462 goto exit_nonewsk; 1465 1463 1466 1464 newsk->sk_gso_type = SKB_GSO_TCPV4; 1465 + inet_sk_rx_dst_set(newsk, skb); 1467 1466 1468 1467 newtp = tcp_sk(newsk); 1469 1468 newinet = inet_sk(newsk);
-2
net/ipv4/tcp_minisocks.c
··· 387 387 struct tcp_sock *oldtp = tcp_sk(sk); 388 388 struct tcp_cookie_values *oldcvp = oldtp->cookie_values; 389 389 390 - newicsk->icsk_af_ops->sk_rx_dst_set(newsk, skb); 391 - 392 390 /* TCP Cookie Transactions require space for the cookie pair, 393 391 * as it differs for each connection. There is no need to 394 392 * copy any s_data_payload stored at the original socket.
+9 -5
net/ipv4/tcp_output.c
··· 910 910 if (flags & (1UL << TCP_TSQ_DEFERRED)) 911 911 tcp_tsq_handler(sk); 912 912 913 - if (flags & (1UL << TCP_WRITE_TIMER_DEFERRED)) 913 + if (flags & (1UL << TCP_WRITE_TIMER_DEFERRED)) { 914 914 tcp_write_timer_handler(sk); 915 - 916 - if (flags & (1UL << TCP_DELACK_TIMER_DEFERRED)) 915 + __sock_put(sk); 916 + } 917 + if (flags & (1UL << TCP_DELACK_TIMER_DEFERRED)) { 917 918 tcp_delack_timer_handler(sk); 918 - 919 - if (flags & (1UL << TCP_MTU_REDUCED_DEFERRED)) 919 + __sock_put(sk); 920 + } 921 + if (flags & (1UL << TCP_MTU_REDUCED_DEFERRED)) { 920 922 sk->sk_prot->mtu_reduced(sk); 923 + __sock_put(sk); 924 + } 921 925 } 922 926 EXPORT_SYMBOL(tcp_release_cb); 923 927
+4 -2
net/ipv4/tcp_timer.c
··· 252 252 inet_csk(sk)->icsk_ack.blocked = 1; 253 253 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_DELAYEDACKLOCKED); 254 254 /* deleguate our work to tcp_release_cb() */ 255 - set_bit(TCP_WRITE_TIMER_DEFERRED, &tcp_sk(sk)->tsq_flags); 255 + if (!test_and_set_bit(TCP_DELACK_TIMER_DEFERRED, &tcp_sk(sk)->tsq_flags)) 256 + sock_hold(sk); 256 257 } 257 258 bh_unlock_sock(sk); 258 259 sock_put(sk); ··· 482 481 tcp_write_timer_handler(sk); 483 482 } else { 484 483 /* deleguate our work to tcp_release_cb() */ 485 - set_bit(TCP_WRITE_TIMER_DEFERRED, &tcp_sk(sk)->tsq_flags); 484 + if (!test_and_set_bit(TCP_WRITE_TIMER_DEFERRED, &tcp_sk(sk)->tsq_flags)) 485 + sock_hold(sk); 486 486 } 487 487 bh_unlock_sock(sk); 488 488 sock_put(sk);
+1 -3
net/ipv6/addrconf.c
··· 494 494 struct net_device *dev; 495 495 struct inet6_dev *idev; 496 496 497 - rcu_read_lock(); 498 - for_each_netdev_rcu(net, dev) { 497 + for_each_netdev(net, dev) { 499 498 idev = __in6_dev_get(dev); 500 499 if (idev) { 501 500 int changed = (!idev->cnf.forwarding) ^ (!newf); ··· 503 504 dev_forward_change(idev); 504 505 } 505 506 } 506 - rcu_read_unlock(); 507 507 } 508 508 509 509 static int addrconf_fixup_forwarding(struct ctl_table *table, int *p, int newf)
+2 -2
net/ipv6/proc.c
··· 307 307 goto proc_dev_snmp6_fail; 308 308 return 0; 309 309 310 + proc_dev_snmp6_fail: 311 + proc_net_remove(net, "snmp6"); 310 312 proc_snmp6_fail: 311 313 proc_net_remove(net, "sockstat6"); 312 - proc_dev_snmp6_fail: 313 - proc_net_remove(net, "dev_snmp6"); 314 314 return -ENOMEM; 315 315 } 316 316
+13 -12
net/ipv6/tcp_ipv6.c
··· 94 94 } 95 95 #endif 96 96 97 + static void inet6_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb) 98 + { 99 + struct dst_entry *dst = skb_dst(skb); 100 + const struct rt6_info *rt = (const struct rt6_info *)dst; 101 + 102 + dst_hold(dst); 103 + sk->sk_rx_dst = dst; 104 + inet_sk(sk)->rx_dst_ifindex = skb->skb_iif; 105 + if (rt->rt6i_node) 106 + inet6_sk(sk)->rx_dst_cookie = rt->rt6i_node->fn_sernum; 107 + } 108 + 97 109 static void tcp_v6_hash(struct sock *sk) 98 110 { 99 111 if (sk->sk_state != TCP_CLOSE) { ··· 1282 1270 1283 1271 newsk->sk_gso_type = SKB_GSO_TCPV6; 1284 1272 __ip6_dst_store(newsk, dst, NULL, NULL); 1273 + inet6_sk_rx_dst_set(newsk, skb); 1285 1274 1286 1275 newtcp6sk = (struct tcp6_sock *)newsk; 1287 1276 inet_sk(newsk)->pinet6 = &newtcp6sk->inet6; ··· 1741 1728 .twsk_unique = tcp_twsk_unique, 1742 1729 .twsk_destructor= tcp_twsk_destructor, 1743 1730 }; 1744 - 1745 - static void inet6_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb) 1746 - { 1747 - struct dst_entry *dst = skb_dst(skb); 1748 - const struct rt6_info *rt = (const struct rt6_info *)dst; 1749 - 1750 - dst_hold(dst); 1751 - sk->sk_rx_dst = dst; 1752 - inet_sk(sk)->rx_dst_ifindex = skb->skb_iif; 1753 - if (rt->rt6i_node) 1754 - inet6_sk(sk)->rx_dst_cookie = rt->rt6i_node->fn_sernum; 1755 - } 1756 1731 1757 1732 static const struct inet_connection_sock_af_ops ipv6_specific = { 1758 1733 .queue_xmit = inet6_csk_xmit,
+8
net/ipv6/xfrm6_policy.c
··· 73 73 return 0; 74 74 } 75 75 76 + static void xfrm6_init_dst(struct net *net, struct xfrm_dst *xdst) 77 + { 78 + struct rt6_info *rt = (struct rt6_info *)xdst; 79 + 80 + rt6_init_peer(rt, net->ipv6.peers); 81 + } 82 + 76 83 static int xfrm6_init_path(struct xfrm_dst *path, struct dst_entry *dst, 77 84 int nfheader_len) 78 85 { ··· 293 286 .get_saddr = xfrm6_get_saddr, 294 287 .decode_session = _decode_session6, 295 288 .get_tos = xfrm6_get_tos, 289 + .init_dst = xfrm6_init_dst, 296 290 .init_path = xfrm6_init_path, 297 291 .fill_dst = xfrm6_fill_dst, 298 292 .blackhole_route = ip6_blackhole_route,
+1
net/l2tp/l2tp_ip6.c
··· 410 410 lsa->l2tp_family = AF_INET6; 411 411 lsa->l2tp_flowinfo = 0; 412 412 lsa->l2tp_scope_id = 0; 413 + lsa->l2tp_unused = 0; 413 414 if (peer) { 414 415 if (!lsk->peer_conn_id) 415 416 return -ENOTCONN;
+4 -4
net/llc/af_llc.c
··· 969 969 struct sockaddr_llc sllc; 970 970 struct sock *sk = sock->sk; 971 971 struct llc_sock *llc = llc_sk(sk); 972 - int rc = 0; 972 + int rc = -EBADF; 973 973 974 974 memset(&sllc, 0, sizeof(sllc)); 975 975 lock_sock(sk); 976 976 if (sock_flag(sk, SOCK_ZAPPED)) 977 977 goto out; 978 978 *uaddrlen = sizeof(sllc); 979 - memset(uaddr, 0, *uaddrlen); 980 979 if (peer) { 981 980 rc = -ENOTCONN; 982 981 if (sk->sk_state != TCP_ESTABLISHED) ··· 1205 1206 rc = llc_proc_init(); 1206 1207 if (rc != 0) { 1207 1208 printk(llc_proc_err_msg); 1208 - goto out_unregister_llc_proto; 1209 + goto out_station; 1209 1210 } 1210 1211 rc = llc_sysctl_init(); 1211 1212 if (rc) { ··· 1225 1226 llc_sysctl_exit(); 1226 1227 out_proc: 1227 1228 llc_proc_exit(); 1228 - out_unregister_llc_proto: 1229 + out_station: 1230 + llc_station_exit(); 1229 1231 proto_unregister(&llc_proto); 1230 1232 goto out; 1231 1233 }
+17 -4
net/llc/llc_input.c
··· 42 42 void llc_add_pack(int type, void (*handler)(struct llc_sap *sap, 43 43 struct sk_buff *skb)) 44 44 { 45 + smp_wmb(); /* ensure initialisation is complete before it's called */ 45 46 if (type == LLC_DEST_SAP || type == LLC_DEST_CONN) 46 47 llc_type_handlers[type - 1] = handler; 47 48 } ··· 51 50 { 52 51 if (type == LLC_DEST_SAP || type == LLC_DEST_CONN) 53 52 llc_type_handlers[type - 1] = NULL; 53 + synchronize_net(); 54 54 } 55 55 56 56 void llc_set_station_handler(void (*handler)(struct sk_buff *skb)) 57 57 { 58 + /* Ensure initialisation is complete before it's called */ 59 + if (handler) 60 + smp_wmb(); 61 + 58 62 llc_station_handler = handler; 63 + 64 + if (!handler) 65 + synchronize_net(); 59 66 } 60 67 61 68 /** ··· 159 150 int dest; 160 151 int (*rcv)(struct sk_buff *, struct net_device *, 161 152 struct packet_type *, struct net_device *); 153 + void (*sta_handler)(struct sk_buff *skb); 154 + void (*sap_handler)(struct llc_sap *sap, struct sk_buff *skb); 162 155 163 156 if (!net_eq(dev_net(dev), &init_net)) 164 157 goto drop; ··· 193 182 */ 194 183 rcv = rcu_dereference(sap->rcv_func); 195 184 dest = llc_pdu_type(skb); 196 - if (unlikely(!dest || !llc_type_handlers[dest - 1])) { 185 + sap_handler = dest ? ACCESS_ONCE(llc_type_handlers[dest - 1]) : NULL; 186 + if (unlikely(!sap_handler)) { 197 187 if (rcv) 198 188 rcv(skb, dev, pt, orig_dev); 199 189 else ··· 205 193 if (cskb) 206 194 rcv(cskb, dev, pt, orig_dev); 207 195 } 208 - llc_type_handlers[dest - 1](sap, skb); 196 + sap_handler(sap, skb); 209 197 } 210 198 llc_sap_put(sap); 211 199 out: ··· 214 202 kfree_skb(skb); 215 203 goto out; 216 204 handle_station: 217 - if (!llc_station_handler) 205 + sta_handler = ACCESS_ONCE(llc_station_handler); 206 + if (!sta_handler) 218 207 goto drop; 219 - llc_station_handler(skb); 208 + sta_handler(skb); 220 209 goto out; 221 210 } 222 211
+4 -19
net/llc/llc_station.c
··· 687 687 llc_station_state_process(skb); 688 688 } 689 689 690 - int __init llc_station_init(void) 690 + void __init llc_station_init(void) 691 691 { 692 - int rc = -ENOBUFS; 693 - struct sk_buff *skb; 694 - struct llc_station_state_ev *ev; 695 - 696 692 skb_queue_head_init(&llc_main_station.mac_pdu_q); 697 693 skb_queue_head_init(&llc_main_station.ev_q.list); 698 694 spin_lock_init(&llc_main_station.ev_q.lock); ··· 696 700 (unsigned long)&llc_main_station); 697 701 llc_main_station.ack_timer.expires = jiffies + 698 702 sysctl_llc_station_ack_timeout; 699 - skb = alloc_skb(0, GFP_ATOMIC); 700 - if (!skb) 701 - goto out; 702 - rc = 0; 703 - llc_set_station_handler(llc_station_rcv); 704 - ev = llc_station_ev(skb); 705 - memset(ev, 0, sizeof(*ev)); 706 703 llc_main_station.maximum_retry = 1; 707 - llc_main_station.state = LLC_STATION_STATE_DOWN; 708 - ev->type = LLC_STATION_EV_TYPE_SIMPLE; 709 - ev->prim_type = LLC_STATION_EV_ENABLE_WITHOUT_DUP_ADDR_CHECK; 710 - rc = llc_station_next_state(skb); 711 - out: 712 - return rc; 704 + llc_main_station.state = LLC_STATION_STATE_UP; 705 + llc_set_station_handler(llc_station_rcv); 713 706 } 714 707 715 - void __exit llc_station_exit(void) 708 + void llc_station_exit(void) 716 709 { 717 710 llc_set_station_handler(NULL); 718 711 }
+1
net/netfilter/ipvs/ip_vs_ctl.c
··· 2759 2759 { 2760 2760 struct ip_vs_timeout_user t; 2761 2761 2762 + memset(&t, 0, sizeof(t)); 2762 2763 __ip_vs_get_timeouts(net, &t); 2763 2764 if (copy_to_user(user, &t, sizeof(t)) != 0) 2764 2765 ret = -EFAULT;
+6 -23
net/netfilter/nf_conntrack_expect.c
··· 361 361 } 362 362 } 363 363 364 - static inline int refresh_timer(struct nf_conntrack_expect *i) 365 - { 366 - struct nf_conn_help *master_help = nfct_help(i->master); 367 - const struct nf_conntrack_expect_policy *p; 368 - 369 - if (!del_timer(&i->timeout)) 370 - return 0; 371 - 372 - p = &rcu_dereference_protected( 373 - master_help->helper, 374 - lockdep_is_held(&nf_conntrack_lock) 375 - )->expect_policy[i->class]; 376 - i->timeout.expires = jiffies + p->timeout * HZ; 377 - add_timer(&i->timeout); 378 - return 1; 379 - } 380 - 381 364 static inline int __nf_ct_expect_check(struct nf_conntrack_expect *expect) 382 365 { 383 366 const struct nf_conntrack_expect_policy *p; ··· 369 386 struct nf_conn_help *master_help = nfct_help(master); 370 387 struct nf_conntrack_helper *helper; 371 388 struct net *net = nf_ct_exp_net(expect); 372 - struct hlist_node *n; 389 + struct hlist_node *n, *next; 373 390 unsigned int h; 374 391 int ret = 1; 375 392 ··· 378 395 goto out; 379 396 } 380 397 h = nf_ct_expect_dst_hash(&expect->tuple); 381 - hlist_for_each_entry(i, n, &net->ct.expect_hash[h], hnode) { 398 + hlist_for_each_entry_safe(i, n, next, &net->ct.expect_hash[h], hnode) { 382 399 if (expect_matches(i, expect)) { 383 - /* Refresh timer: if it's dying, ignore.. */ 384 - if (refresh_timer(i)) { 385 - ret = 0; 386 - goto out; 400 + if (del_timer(&i->timeout)) { 401 + nf_ct_unlink_expect(i); 402 + nf_ct_expect_put(i); 403 + break; 387 404 } 388 405 } else if (expect_clash(i, expect)) { 389 406 ret = -EBUSY;
+6 -1
net/netfilter/nf_conntrack_netlink.c
··· 1896 1896 ctnetlink_nfqueue_parse(const struct nlattr *attr, struct nf_conn *ct) 1897 1897 { 1898 1898 struct nlattr *cda[CTA_MAX+1]; 1899 + int ret; 1899 1900 1900 1901 nla_parse_nested(cda, CTA_MAX, attr, ct_nla_policy); 1901 1902 1902 - return ctnetlink_nfqueue_parse_ct((const struct nlattr **)cda, ct); 1903 + spin_lock_bh(&nf_conntrack_lock); 1904 + ret = ctnetlink_nfqueue_parse_ct((const struct nlattr **)cda, ct); 1905 + spin_unlock_bh(&nf_conntrack_lock); 1906 + 1907 + return ret; 1903 1908 } 1904 1909 1905 1910 static struct nfq_ct_hook ctnetlink_nfqueue_hook = {
+72 -20
net/netfilter/nf_conntrack_sip.c
··· 183 183 return len + digits_len(ct, dptr, limit, shift); 184 184 } 185 185 186 - static int parse_addr(const struct nf_conn *ct, const char *cp, 187 - const char **endp, union nf_inet_addr *addr, 188 - const char *limit) 186 + static int sip_parse_addr(const struct nf_conn *ct, const char *cp, 187 + const char **endp, union nf_inet_addr *addr, 188 + const char *limit, bool delim) 189 189 { 190 190 const char *end; 191 - int ret = 0; 191 + int ret; 192 192 193 193 if (!ct) 194 194 return 0; ··· 197 197 switch (nf_ct_l3num(ct)) { 198 198 case AF_INET: 199 199 ret = in4_pton(cp, limit - cp, (u8 *)&addr->ip, -1, &end); 200 + if (ret == 0) 201 + return 0; 200 202 break; 201 203 case AF_INET6: 204 + if (cp < limit && *cp == '[') 205 + cp++; 206 + else if (delim) 207 + return 0; 208 + 202 209 ret = in6_pton(cp, limit - cp, (u8 *)&addr->ip6, -1, &end); 210 + if (ret == 0) 211 + return 0; 212 + 213 + if (end < limit && *end == ']') 214 + end++; 215 + else if (delim) 216 + return 0; 203 217 break; 204 218 default: 205 219 BUG(); 206 220 } 207 221 208 - if (ret == 0 || end == cp) 209 - return 0; 210 222 if (endp) 211 223 *endp = end; 212 224 return 1; ··· 231 219 union nf_inet_addr addr; 232 220 const char *aux = dptr; 233 221 234 - if (!parse_addr(ct, dptr, &dptr, &addr, limit)) { 222 + if (!sip_parse_addr(ct, dptr, &dptr, &addr, limit, true)) { 235 223 pr_debug("ip: %s parse failed.!\n", dptr); 236 224 return 0; 237 225 } ··· 308 296 return 0; 309 297 dptr += shift; 310 298 311 - if (!parse_addr(ct, dptr, &end, addr, limit)) 299 + if (!sip_parse_addr(ct, dptr, &end, addr, limit, true)) 312 300 return -1; 313 301 if (end < limit && *end == ':') { 314 302 end++; ··· 562 550 if (ret == 0) 563 551 return ret; 564 552 565 - if (!parse_addr(ct, dptr + *matchoff, &c, addr, limit)) 553 + if (!sip_parse_addr(ct, dptr + *matchoff, &c, addr, limit, true)) 566 554 return -1; 567 555 if (*c == ':') { 568 556 c++; ··· 611 599 unsigned int dataoff, unsigned int datalen, 612 600 const char *name, 613 601 unsigned int *matchoff, unsigned int *matchlen, 614 - union nf_inet_addr *addr) 602 + union nf_inet_addr *addr, bool delim) 615 603 { 616 604 const char *limit = dptr + datalen; 617 605 const char *start, *end; ··· 625 613 return 0; 626 614 627 615 start += strlen(name); 628 - if (!parse_addr(ct, start, &end, addr, limit)) 616 + if (!sip_parse_addr(ct, start, &end, addr, limit, delim)) 629 617 return 0; 630 618 *matchoff = start - dptr; 631 619 *matchlen = end - start; ··· 687 675 return 1; 688 676 } 689 677 678 + static int sdp_parse_addr(const struct nf_conn *ct, const char *cp, 679 + const char **endp, union nf_inet_addr *addr, 680 + const char *limit) 681 + { 682 + const char *end; 683 + int ret; 684 + 685 + memset(addr, 0, sizeof(*addr)); 686 + switch (nf_ct_l3num(ct)) { 687 + case AF_INET: 688 + ret = in4_pton(cp, limit - cp, (u8 *)&addr->ip, -1, &end); 689 + break; 690 + case AF_INET6: 691 + ret = in6_pton(cp, limit - cp, (u8 *)&addr->ip6, -1, &end); 692 + break; 693 + default: 694 + BUG(); 695 + } 696 + 697 + if (ret == 0) 698 + return 0; 699 + if (endp) 700 + *endp = end; 701 + return 1; 702 + } 703 + 704 + /* skip ip address. returns its length. */ 705 + static int sdp_addr_len(const struct nf_conn *ct, const char *dptr, 706 + const char *limit, int *shift) 707 + { 708 + union nf_inet_addr addr; 709 + const char *aux = dptr; 710 + 711 + if (!sdp_parse_addr(ct, dptr, &dptr, &addr, limit)) { 712 + pr_debug("ip: %s parse failed.!\n", dptr); 713 + return 0; 714 + } 715 + 716 + return dptr - aux; 717 + } 718 + 690 719 /* SDP header parsing: a SDP session description contains an ordered set of 691 720 * headers, starting with a section containing general session parameters, 692 721 * optionally followed by multiple media descriptions. ··· 739 686 */ 740 687 static const struct sip_header ct_sdp_hdrs[] = { 741 688 [SDP_HDR_VERSION] = SDP_HDR("v=", NULL, digits_len), 742 - [SDP_HDR_OWNER_IP4] = SDP_HDR("o=", "IN IP4 ", epaddr_len), 743 - [SDP_HDR_CONNECTION_IP4] = SDP_HDR("c=", "IN IP4 ", epaddr_len), 744 - [SDP_HDR_OWNER_IP6] = SDP_HDR("o=", "IN IP6 ", epaddr_len), 745 - [SDP_HDR_CONNECTION_IP6] = SDP_HDR("c=", "IN IP6 ", epaddr_len), 689 + [SDP_HDR_OWNER_IP4] = SDP_HDR("o=", "IN IP4 ", sdp_addr_len), 690 + [SDP_HDR_CONNECTION_IP4] = SDP_HDR("c=", "IN IP4 ", sdp_addr_len), 691 + [SDP_HDR_OWNER_IP6] = SDP_HDR("o=", "IN IP6 ", sdp_addr_len), 692 + [SDP_HDR_CONNECTION_IP6] = SDP_HDR("c=", "IN IP6 ", sdp_addr_len), 746 693 [SDP_HDR_MEDIA] = SDP_HDR("m=", NULL, media_len), 747 694 }; 748 695 ··· 828 775 if (ret <= 0) 829 776 return ret; 830 777 831 - if (!parse_addr(ct, dptr + *matchoff, NULL, addr, 832 - dptr + *matchoff + *matchlen)) 778 + if (!sdp_parse_addr(ct, dptr + *matchoff, NULL, addr, 779 + dptr + *matchoff + *matchlen)) 833 780 return -1; 834 781 return 1; 835 782 } ··· 1568 1515 } 1569 1516 1570 1517 static struct nf_conntrack_helper sip[MAX_PORTS][4] __read_mostly; 1571 - static char sip_names[MAX_PORTS][4][sizeof("sip-65535")] __read_mostly; 1572 1518 1573 1519 static const struct nf_conntrack_expect_policy sip_exp_policy[SIP_EXPECT_MAX + 1] = { 1574 1520 [SIP_EXPECT_SIGNALLING] = { ··· 1637 1585 sip[i][j].me = THIS_MODULE; 1638 1586 1639 1587 if (ports[i] == SIP_PORT) 1640 - sprintf(sip_names[i][j], "sip"); 1588 + sprintf(sip[i][j].name, "sip"); 1641 1589 else 1642 - sprintf(sip_names[i][j], "sip-%u", i); 1590 + sprintf(sip[i][j].name, "sip-%u", i); 1643 1591 1644 1592 pr_debug("port #%u: %u\n", i, ports[i]); 1645 1593
+1 -1
net/netlink/af_netlink.c
··· 1362 1362 if (NULL == siocb->scm) 1363 1363 siocb->scm = &scm; 1364 1364 1365 - err = scm_send(sock, msg, siocb->scm); 1365 + err = scm_send(sock, msg, siocb->scm, true); 1366 1366 if (err < 0) 1367 1367 return err; 1368 1368
+9
net/packet/af_packet.c
··· 1273 1273 spin_unlock(&f->lock); 1274 1274 } 1275 1275 1276 + bool match_fanout_group(struct packet_type *ptype, struct sock * sk) 1277 + { 1278 + if (ptype->af_packet_priv == (void*)((struct packet_sock *)sk)->fanout) 1279 + return true; 1280 + 1281 + return false; 1282 + } 1283 + 1276 1284 static int fanout_add(struct sock *sk, u16 id, u16 type_flags) 1277 1285 { 1278 1286 struct packet_sock *po = pkt_sk(sk); ··· 1333 1325 match->prot_hook.dev = po->prot_hook.dev; 1334 1326 match->prot_hook.func = packet_rcv_fanout; 1335 1327 match->prot_hook.af_packet_priv = match; 1328 + match->prot_hook.id_match = match_fanout_group; 1336 1329 dev_add_pack(&match->prot_hook); 1337 1330 list_add(&match->list, &fanout_list); 1338 1331 }
+5 -6
net/sched/act_mirred.c
··· 200 200 out: 201 201 if (err) { 202 202 m->tcf_qstats.overlimits++; 203 - /* should we be asking for packet to be dropped? 204 - * may make sense for redirect case only 205 - */ 206 - retval = TC_ACT_SHOT; 207 - } else { 203 + if (m->tcfm_eaction != TCA_EGRESS_MIRROR) 204 + retval = TC_ACT_SHOT; 205 + else 206 + retval = m->tcf_action; 207 + } else 208 208 retval = m->tcf_action; 209 - } 210 209 spin_unlock(&m->tcf_lock); 211 210 212 211 return retval;
+1
net/socket.c
··· 2657 2657 if (copy_from_user(&ifc32, uifc32, sizeof(struct compat_ifconf))) 2658 2658 return -EFAULT; 2659 2659 2660 + memset(&ifc, 0, sizeof(ifc)); 2660 2661 if (ifc32.ifcbuf == 0) { 2661 2662 ifc32.ifc_len = 0; 2662 2663 ifc.ifc_len = 0;
+2 -2
net/unix/af_unix.c
··· 1450 1450 if (NULL == siocb->scm) 1451 1451 siocb->scm = &tmp_scm; 1452 1452 wait_for_unix_gc(); 1453 - err = scm_send(sock, msg, siocb->scm); 1453 + err = scm_send(sock, msg, siocb->scm, false); 1454 1454 if (err < 0) 1455 1455 return err; 1456 1456 ··· 1619 1619 if (NULL == siocb->scm) 1620 1620 siocb->scm = &tmp_scm; 1621 1621 wait_for_unix_gc(); 1622 - err = scm_send(sock, msg, siocb->scm); 1622 + err = scm_send(sock, msg, siocb->scm, false); 1623 1623 if (err < 0) 1624 1624 return err; 1625 1625
+2
net/xfrm/xfrm_policy.c
··· 1357 1357 1358 1358 memset(dst + 1, 0, sizeof(*xdst) - sizeof(*dst)); 1359 1359 xdst->flo.ops = &xfrm_bundle_fc_ops; 1360 + if (afinfo->init_dst) 1361 + afinfo->init_dst(net, xdst); 1360 1362 } else 1361 1363 xdst = ERR_PTR(-ENOBUFS); 1362 1364