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 fixes from David Miller:

1) Fix crash in ipvs tot_stats estimator, from Julian Anastasov.

2) Fix OOPS in nf_nat on netns removal, from Florian Westphal.

3) Really really really fix locking issues in slip and slcan tty write
wakeups, from Tyler Hall.

4) Fix checksum offloading in fec driver, from Fugang Duan.

5) Off by one in BPF instruction limit test, from Kees Cook.

6) Need to clear all TSO capability flags when doing software TSO in
tg3 driver, from Prashant Sreedharan.

7) Fix memory leak in vlan_reorder_header() error path, from Li
RongQing.

8) Fix various bugs in xen-netfront and xen-netback multiqueue support,
from David Vrabel and Wei Liu.

9) Fix deadlock in cxgb4 driver, from Li RongQing.

10) Prevent double free of no-cache DST entries, from Eric Dumazet.

11) Bad csum_start handling in skb_segment() leads to crashes when
forwarding, from Tom Herbert.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (76 commits)
net: fix setting csum_start in skb_segment()
ipv4: fix dst race in sk_dst_get()
net: filter: Use kcalloc/kmalloc_array to allocate arrays
trivial: net: filter: Change kerneldoc parameter order
trivial: net: filter: Fix typo in comment
net: allwinner: emac: Add missing free_irq
cxgb4: use dev_port to identify ports
xen-netback: bookkeep number of active queues in our own module
tg3: Change nvram command timeout value to 50ms
cxgb4: Not need to hold the adap_rcu_lock lock when read adap_rcu_list
be2net: fix qnq mode detection on VFs
of: mdio: fixup of_phy_register_fixed_link parsing of new bindings
at86rf230: fix irq setup
net: phy: at803x: fix coccinelle warnings
net/mlx4_core: Fix the error flow when probing with invalid VF configuration
tulip: Poll link status more frequently for Comet chips
net: huawei_cdc_ncm: increase command buffer size
drivers: net: cpsw: fix dual EMAC stall when connected to same switch
xen-netfront: recreate queues correctly when reconnecting
xen-netfront: fix oops when disconnected from backend
...

+749 -374
+4 -1
Documentation/ptp/testptp.c
··· 17 17 * along with this program; if not, write to the Free Software 18 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 19 */ 20 + #define _GNU_SOURCE 20 21 #include <errno.h> 21 22 #include <fcntl.h> 22 23 #include <inttypes.h> ··· 47 46 #define CLOCK_INVALID -1 48 47 #endif 49 48 50 - /* When glibc offers the syscall, this will go away. */ 49 + /* clock_adjtime is not available in GLIBC < 2.14 */ 50 + #if !__GLIBC_PREREQ(2, 14) 51 51 #include <sys/syscall.h> 52 52 static int clock_adjtime(clockid_t id, struct timex *tx) 53 53 { 54 54 return syscall(__NR_clock_adjtime, id, tx); 55 55 } 56 + #endif 56 57 57 58 static clockid_t get_clockid(int fd) 58 59 {
+1 -10
MAINTAINERS
··· 3189 3189 S: Maintained 3190 3190 F: drivers/scsi/eata_pio.* 3191 3191 3192 - EBTABLES 3193 - L: netfilter-devel@vger.kernel.org 3194 - W: http://ebtables.sourceforge.net/ 3195 - S: Orphan 3196 - F: include/linux/netfilter_bridge/ebt_*.h 3197 - F: include/uapi/linux/netfilter_bridge/ebt_*.h 3198 - F: net/bridge/netfilter/ebt*.c 3199 - 3200 3192 EC100 MEDIA DRIVER 3201 3193 M: Antti Palosaari <crope@iki.fi> 3202 3194 L: linux-media@vger.kernel.org ··· 6097 6105 F: Documentation/networking/vxge.txt 6098 6106 F: drivers/net/ethernet/neterion/ 6099 6107 6100 - NETFILTER/IPTABLES 6108 + NETFILTER ({IP,IP6,ARP,EB,NF}TABLES) 6101 6109 M: Pablo Neira Ayuso <pablo@netfilter.org> 6102 6110 M: Patrick McHardy <kaber@trash.net> 6103 6111 M: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> 6104 6112 L: netfilter-devel@vger.kernel.org 6105 - L: netfilter@vger.kernel.org 6106 6113 L: coreteam@netfilter.org 6107 6114 W: http://www.netfilter.org/ 6108 6115 W: http://www.iptables.org/
+1 -10
drivers/isdn/hisax/Kconfig
··· 16 16 also to the configuration option of the driver for your particular 17 17 card, below. 18 18 19 - if ISDN_DRV_HISAX!=n 19 + if ISDN_DRV_HISAX 20 20 21 21 comment "D-channel protocol features" 22 22 ··· 348 348 This enables HiSax support for the Formula-n enter:now PCI 349 349 ISDN card. 350 350 351 - endif 352 - 353 - if ISDN_DRV_HISAX 354 - 355 351 config HISAX_DEBUG 356 352 bool "HiSax debugging" 357 353 help ··· 415 419 Fritz!Card PCI v2 and Fritz!Card PnP. 416 420 (the latter also needs you to select "ISA Plug and Play support" 417 421 from the menu "Plug and Play configuration") 418 - 419 - config HISAX_AVM_A1_PCMCIA 420 - bool 421 - depends on HISAX_AVM_A1_CS 422 - default y 423 422 424 423 endif 425 424
+9
drivers/net/bonding/bond_main.c
··· 1025 1025 NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \ 1026 1026 NETIF_F_HIGHDMA | NETIF_F_LRO) 1027 1027 1028 + #define BOND_ENC_FEATURES (NETIF_F_ALL_CSUM | NETIF_F_SG | NETIF_F_RXCSUM |\ 1029 + NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL) 1030 + 1028 1031 static void bond_compute_features(struct bonding *bond) 1029 1032 { 1030 1033 unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE; 1031 1034 netdev_features_t vlan_features = BOND_VLAN_FEATURES; 1035 + netdev_features_t enc_features = BOND_ENC_FEATURES; 1032 1036 struct net_device *bond_dev = bond->dev; 1033 1037 struct list_head *iter; 1034 1038 struct slave *slave; ··· 1048 1044 vlan_features = netdev_increment_features(vlan_features, 1049 1045 slave->dev->vlan_features, BOND_VLAN_FEATURES); 1050 1046 1047 + enc_features = netdev_increment_features(enc_features, 1048 + slave->dev->hw_enc_features, 1049 + BOND_ENC_FEATURES); 1051 1050 dst_release_flag &= slave->dev->priv_flags; 1052 1051 if (slave->dev->hard_header_len > max_hard_header_len) 1053 1052 max_hard_header_len = slave->dev->hard_header_len; ··· 1061 1054 1062 1055 done: 1063 1056 bond_dev->vlan_features = vlan_features; 1057 + bond_dev->hw_enc_features = enc_features; 1064 1058 bond_dev->hard_header_len = max_hard_header_len; 1065 1059 bond_dev->gso_max_segs = gso_max_segs; 1066 1060 netif_set_gso_max_size(bond_dev, gso_max_size); ··· 3983 3975 NETIF_F_HW_VLAN_CTAG_FILTER; 3984 3976 3985 3977 bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM); 3978 + bond_dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; 3986 3979 bond_dev->features |= bond_dev->hw_features; 3987 3980 } 3988 3981
+29 -12
drivers/net/can/slcan.c
··· 52 52 #include <linux/delay.h> 53 53 #include <linux/init.h> 54 54 #include <linux/kernel.h> 55 + #include <linux/workqueue.h> 55 56 #include <linux/can.h> 56 57 #include <linux/can/skb.h> 57 58 ··· 86 85 struct tty_struct *tty; /* ptr to TTY structure */ 87 86 struct net_device *dev; /* easy for intr handling */ 88 87 spinlock_t lock; 88 + struct work_struct tx_work; /* Flushes transmit buffer */ 89 89 90 90 /* These are pointers to the malloc()ed frame buffers. */ 91 91 unsigned char rbuff[SLC_MTU]; /* receiver buffer */ ··· 311 309 sl->dev->stats.tx_bytes += cf->can_dlc; 312 310 } 313 311 314 - /* 315 - * Called by the driver when there's room for more data. If we have 316 - * more packets to send, we send them here. 317 - */ 318 - static void slcan_write_wakeup(struct tty_struct *tty) 312 + /* Write out any remaining transmit buffer. Scheduled when tty is writable */ 313 + static void slcan_transmit(struct work_struct *work) 319 314 { 315 + struct slcan *sl = container_of(work, struct slcan, tx_work); 320 316 int actual; 321 - struct slcan *sl = (struct slcan *) tty->disc_data; 322 - 323 - /* First make sure we're connected. */ 324 - if (!sl || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) 325 - return; 326 317 327 318 spin_lock_bh(&sl->lock); 319 + /* First make sure we're connected. */ 320 + if (!sl->tty || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) { 321 + spin_unlock_bh(&sl->lock); 322 + return; 323 + } 324 + 328 325 if (sl->xleft <= 0) { 329 326 /* Now serial buffer is almost free & we can start 330 327 * transmission of another packet */ 331 328 sl->dev->stats.tx_packets++; 332 - clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); 329 + clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags); 333 330 spin_unlock_bh(&sl->lock); 334 331 netif_wake_queue(sl->dev); 335 332 return; 336 333 } 337 334 338 - actual = tty->ops->write(tty, sl->xhead, sl->xleft); 335 + actual = sl->tty->ops->write(sl->tty, sl->xhead, sl->xleft); 339 336 sl->xleft -= actual; 340 337 sl->xhead += actual; 341 338 spin_unlock_bh(&sl->lock); 339 + } 340 + 341 + /* 342 + * Called by the driver when there's room for more data. 343 + * Schedule the transmit. 344 + */ 345 + static void slcan_write_wakeup(struct tty_struct *tty) 346 + { 347 + struct slcan *sl = tty->disc_data; 348 + 349 + schedule_work(&sl->tx_work); 342 350 } 343 351 344 352 /* Send a can_frame to a TTY queue. */ ··· 540 528 sl->magic = SLCAN_MAGIC; 541 529 sl->dev = dev; 542 530 spin_lock_init(&sl->lock); 531 + INIT_WORK(&sl->tx_work, slcan_transmit); 543 532 slcan_devs[i] = dev; 544 533 545 534 return sl; ··· 639 626 if (!sl || sl->magic != SLCAN_MAGIC || sl->tty != tty) 640 627 return; 641 628 629 + spin_lock_bh(&sl->lock); 642 630 tty->disc_data = NULL; 643 631 sl->tty = NULL; 632 + spin_unlock_bh(&sl->lock); 633 + 634 + flush_work(&sl->tx_work); 644 635 645 636 /* Flush network side */ 646 637 unregister_netdev(sl->dev);
+1
drivers/net/ethernet/allwinner/sun4i-emac.c
··· 736 736 737 737 ret = emac_mdio_probe(dev); 738 738 if (ret < 0) { 739 + free_irq(dev->irq, dev); 739 740 netdev_err(dev, "cannot probe MDIO bus\n"); 740 741 return ret; 741 742 }
+4 -4
drivers/net/ethernet/broadcom/tg3.c
··· 3224 3224 return 0; 3225 3225 } 3226 3226 3227 - #define NVRAM_CMD_TIMEOUT 100 3227 + #define NVRAM_CMD_TIMEOUT 5000 3228 3228 3229 3229 static int tg3_nvram_exec_cmd(struct tg3 *tp, u32 nvram_cmd) 3230 3230 { ··· 3232 3232 3233 3233 tw32(NVRAM_CMD, nvram_cmd); 3234 3234 for (i = 0; i < NVRAM_CMD_TIMEOUT; i++) { 3235 - udelay(10); 3235 + usleep_range(10, 40); 3236 3236 if (tr32(NVRAM_CMD) & NVRAM_CMD_DONE) { 3237 3237 udelay(10); 3238 3238 break; ··· 7854 7854 netif_wake_queue(tp->dev); 7855 7855 } 7856 7856 7857 - segs = skb_gso_segment(skb, tp->dev->features & ~NETIF_F_TSO); 7858 - if (IS_ERR(segs)) 7857 + segs = skb_gso_segment(skb, tp->dev->features & ~(NETIF_F_TSO | NETIF_F_TSO6)); 7858 + if (IS_ERR(segs) || !segs) 7859 7859 goto tg3_tso_bug_end; 7860 7860 7861 7861 do {
+7 -9
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
··· 4057 4057 EXPORT_SYMBOL(cxgb4_unregister_uld); 4058 4058 4059 4059 /* Check if netdev on which event is occured belongs to us or not. Return 4060 - * suceess (1) if it belongs otherwise failure (0). 4060 + * success (true) if it belongs otherwise failure (false). 4061 + * Called with rcu_read_lock() held. 4061 4062 */ 4062 - static int cxgb4_netdev(struct net_device *netdev) 4063 + static bool cxgb4_netdev(const struct net_device *netdev) 4063 4064 { 4064 4065 struct adapter *adap; 4065 4066 int i; 4066 4067 4067 - spin_lock(&adap_rcu_lock); 4068 4068 list_for_each_entry_rcu(adap, &adap_rcu_list, rcu_node) 4069 4069 for (i = 0; i < MAX_NPORTS; i++) 4070 - if (adap->port[i] == netdev) { 4071 - spin_unlock(&adap_rcu_lock); 4072 - return 1; 4073 - } 4074 - spin_unlock(&adap_rcu_lock); 4075 - return 0; 4070 + if (adap->port[i] == netdev) 4071 + return true; 4072 + return false; 4076 4073 } 4077 4074 4078 4075 static int clip_add(struct net_device *event_dev, struct inet6_ifaddr *ifa, ··· 6393 6396 adapter->flags &= ~DEV_ENABLED; 6394 6397 } 6395 6398 pci_release_regions(pdev); 6399 + synchronize_rcu(); 6396 6400 kfree(adapter); 6397 6401 } else 6398 6402 pci_release_regions(pdev);
+1
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
··· 3962 3962 p->lport = j; 3963 3963 p->rss_size = rss_size; 3964 3964 memcpy(adap->port[i]->dev_addr, addr, ETH_ALEN); 3965 + adap->port[i]->dev_port = j; 3965 3966 3966 3967 ret = ntohl(c.u.info.lstatus_to_modtype); 3967 3968 p->mdio_addr = (ret & FW_PORT_CMD_MDIOCAP) ?
+1 -1
drivers/net/ethernet/dec/tulip/timer.c
··· 158 158 { 159 159 struct net_device *dev = (struct net_device *)data; 160 160 struct tulip_private *tp = netdev_priv(dev); 161 - int next_tick = 60*HZ; 161 + int next_tick = 2*HZ; 162 162 163 163 if (tulip_debug > 1) 164 164 netdev_dbg(dev, "Comet link status %04x partner capability %04x\n",
+1 -3
drivers/net/ethernet/emulex/benet/be.h
··· 557 557 #define be_pvid_tagging_enabled(adapter) (adapter->pvid) 558 558 559 559 /* Is BE in QNQ multi-channel mode */ 560 - #define be_is_qnq_mode(adapter) (adapter->mc_type == FLEX10 || \ 561 - adapter->mc_type == vNIC1 || \ 562 - adapter->mc_type == UFP) 560 + #define be_is_qnq_mode(adapter) (adapter->function_mode & QNQ_MODE) 563 561 564 562 #define lancer_chip(adapter) (adapter->pdev->device == OC_DEVICE_ID3 || \ 565 563 adapter->pdev->device == OC_DEVICE_ID4)
+1 -1
drivers/net/ethernet/emulex/benet/be_cmds.h
··· 1091 1091 * based on the skew/IPL. 1092 1092 */ 1093 1093 #define RDMA_ENABLED 0x4 1094 - #define FLEX10_MODE 0x400 1094 + #define QNQ_MODE 0x400 1095 1095 #define VNIC_MODE 0x20000 1096 1096 #define UMC_ENABLED 0x1000000 1097 1097 struct be_cmd_req_query_fw_cfg {
+2 -2
drivers/net/ethernet/emulex/benet/be_main.c
··· 3254 3254 3255 3255 static u8 be_convert_mc_type(u32 function_mode) 3256 3256 { 3257 - if (function_mode & VNIC_MODE && function_mode & FLEX10_MODE) 3257 + if (function_mode & VNIC_MODE && function_mode & QNQ_MODE) 3258 3258 return vNIC1; 3259 - else if (function_mode & FLEX10_MODE) 3259 + else if (function_mode & QNQ_MODE) 3260 3260 return FLEX10; 3261 3261 else if (function_mode & VNIC_MODE) 3262 3262 return vNIC2;
+7 -1
drivers/net/ethernet/freescale/fec_main.c
··· 320 320 return bufaddr; 321 321 } 322 322 323 + static inline bool is_ipv4_pkt(struct sk_buff *skb) 324 + { 325 + return skb->protocol == htons(ETH_P_IP) && ip_hdr(skb)->version == 4; 326 + } 327 + 323 328 static int 324 329 fec_enet_clear_csum(struct sk_buff *skb, struct net_device *ndev) 325 330 { ··· 335 330 if (unlikely(skb_cow_head(skb, 0))) 336 331 return -1; 337 332 338 - ip_hdr(skb)->check = 0; 333 + if (is_ipv4_pkt(skb)) 334 + ip_hdr(skb)->check = 0; 339 335 *(__sum16 *)(skb->head + skb->csum_start + skb->csum_offset) = 0; 340 336 341 337 return 0;
+7
drivers/net/ethernet/marvell/skge.c
··· 4199 4199 DMI_MATCH(DMI_BOARD_NAME, "P5NSLI") 4200 4200 }, 4201 4201 }, 4202 + { 4203 + .ident = "FUJITSU SIEMENS A8NE-FM", 4204 + .matches = { 4205 + DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTek Computer INC."), 4206 + DMI_MATCH(DMI_BOARD_NAME, "A8NE-FM") 4207 + }, 4208 + }, 4202 4209 {} 4203 4210 }; 4204 4211
+2 -1
drivers/net/ethernet/mellanox/mlx4/main.c
··· 2439 2439 (num_vfs_argc > 1 || probe_vfs_argc > 1)) { 2440 2440 mlx4_err(dev, 2441 2441 "Invalid syntax of num_vfs/probe_vfs with IB port - single port VFs syntax is only supported when all ports are configured as ethernet\n"); 2442 - goto err_close; 2442 + err = -EINVAL; 2443 + goto err_master_mfunc; 2443 2444 } 2444 2445 for (i = 0; i < sizeof(nvfs)/sizeof(nvfs[0]); i++) { 2445 2446 unsigned j;
+6 -1
drivers/net/ethernet/ti/cpsw.c
··· 1212 1212 for_each_slave(priv, cpsw_slave_open, priv); 1213 1213 1214 1214 /* Add default VLAN */ 1215 - cpsw_add_default_vlan(priv); 1215 + if (!priv->data.dual_emac) 1216 + cpsw_add_default_vlan(priv); 1217 + else 1218 + cpsw_ale_add_vlan(priv->ale, priv->data.default_vlan, 1219 + ALE_ALL_PORTS << priv->host_port, 1220 + ALE_ALL_PORTS << priv->host_port, 0, 0); 1216 1221 1217 1222 if (!cpsw_common_res_usage_state(priv)) { 1218 1223 /* setup tx dma to fixed prio and zero offset */
-1
drivers/net/ethernet/tile/tilegx.c
··· 2191 2191 static void tile_net_dev_init(const char *name, const uint8_t *mac) 2192 2192 { 2193 2193 int ret; 2194 - int i; 2195 2194 struct net_device *dev; 2196 2195 struct tile_net_priv *priv; 2197 2196
+1 -1
drivers/net/hyperv/netvsc.c
··· 189 189 "unable to teardown send buffer's gpadl\n"); 190 190 return ret; 191 191 } 192 - net_device->recv_buf_gpadl_handle = 0; 192 + net_device->send_buf_gpadl_handle = 0; 193 193 } 194 194 if (net_device->send_buf) { 195 195 /* Free up the receive buffer */
+4 -1
drivers/net/ieee802154/at86rf230.c
··· 1137 1137 dev->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK; 1138 1138 1139 1139 irq_type = irq_get_trigger_type(spi->irq); 1140 + if (!irq_type) 1141 + irq_type = IRQF_TRIGGER_RISING; 1140 1142 if (irq_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) { 1141 1143 irq_worker = at86rf230_irqwork; 1142 1144 irq_handler = at86rf230_isr; ··· 1170 1168 if (rc) 1171 1169 goto err_hw_init; 1172 1170 1173 - rc = devm_request_irq(&spi->dev, spi->irq, irq_handler, IRQF_SHARED, 1171 + rc = devm_request_irq(&spi->dev, spi->irq, irq_handler, 1172 + IRQF_SHARED | irq_type, 1174 1173 dev_name(&spi->dev), lp); 1175 1174 if (rc) 1176 1175 goto err_hw_init;
+151 -44
drivers/net/phy/at803x.c
··· 16 16 #include <linux/string.h> 17 17 #include <linux/netdevice.h> 18 18 #include <linux/etherdevice.h> 19 + #include <linux/of_gpio.h> 20 + #include <linux/gpio/consumer.h> 19 21 20 22 #define AT803X_INTR_ENABLE 0x12 21 23 #define AT803X_INTR_STATUS 0x13 24 + #define AT803X_SMART_SPEED 0x14 25 + #define AT803X_LED_CONTROL 0x18 22 26 #define AT803X_WOL_ENABLE 0x01 23 27 #define AT803X_DEVICE_ADDR 0x03 24 28 #define AT803X_LOC_MAC_ADDR_0_15_OFFSET 0x804C ··· 39 35 #define AT803X_DEBUG_SYSTEM_MODE_CTRL 0x05 40 36 #define AT803X_DEBUG_RGMII_TX_CLK_DLY BIT(8) 41 37 38 + #define ATH8030_PHY_ID 0x004dd076 39 + #define ATH8031_PHY_ID 0x004dd074 40 + #define ATH8035_PHY_ID 0x004dd072 41 + 42 42 MODULE_DESCRIPTION("Atheros 803x PHY driver"); 43 43 MODULE_AUTHOR("Matus Ujhelyi"); 44 44 MODULE_LICENSE("GPL"); 45 + 46 + struct at803x_priv { 47 + bool phy_reset:1; 48 + struct gpio_desc *gpiod_reset; 49 + }; 50 + 51 + struct at803x_context { 52 + u16 bmcr; 53 + u16 advertise; 54 + u16 control1000; 55 + u16 int_enable; 56 + u16 smart_speed; 57 + u16 led_control; 58 + }; 59 + 60 + /* save relevant PHY registers to private copy */ 61 + static void at803x_context_save(struct phy_device *phydev, 62 + struct at803x_context *context) 63 + { 64 + context->bmcr = phy_read(phydev, MII_BMCR); 65 + context->advertise = phy_read(phydev, MII_ADVERTISE); 66 + context->control1000 = phy_read(phydev, MII_CTRL1000); 67 + context->int_enable = phy_read(phydev, AT803X_INTR_ENABLE); 68 + context->smart_speed = phy_read(phydev, AT803X_SMART_SPEED); 69 + context->led_control = phy_read(phydev, AT803X_LED_CONTROL); 70 + } 71 + 72 + /* restore relevant PHY registers from private copy */ 73 + static void at803x_context_restore(struct phy_device *phydev, 74 + const struct at803x_context *context) 75 + { 76 + phy_write(phydev, MII_BMCR, context->bmcr); 77 + phy_write(phydev, MII_ADVERTISE, context->advertise); 78 + phy_write(phydev, MII_CTRL1000, context->control1000); 79 + phy_write(phydev, AT803X_INTR_ENABLE, context->int_enable); 80 + phy_write(phydev, AT803X_SMART_SPEED, context->smart_speed); 81 + phy_write(phydev, AT803X_LED_CONTROL, context->led_control); 82 + } 45 83 46 84 static int at803x_set_wol(struct phy_device *phydev, 47 85 struct ethtool_wolinfo *wol) ··· 188 142 return 0; 189 143 } 190 144 145 + static int at803x_probe(struct phy_device *phydev) 146 + { 147 + struct device *dev = &phydev->dev; 148 + struct at803x_priv *priv; 149 + 150 + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 151 + if (!priv) 152 + return -ENOMEM; 153 + 154 + priv->gpiod_reset = devm_gpiod_get(dev, "reset"); 155 + if (IS_ERR(priv->gpiod_reset)) 156 + priv->gpiod_reset = NULL; 157 + else 158 + gpiod_direction_output(priv->gpiod_reset, 1); 159 + 160 + phydev->priv = priv; 161 + 162 + return 0; 163 + } 164 + 191 165 static int at803x_config_init(struct phy_device *phydev) 192 166 { 193 167 int ret; ··· 255 189 return err; 256 190 } 257 191 192 + static void at803x_link_change_notify(struct phy_device *phydev) 193 + { 194 + struct at803x_priv *priv = phydev->priv; 195 + 196 + /* 197 + * Conduct a hardware reset for AT8030 every time a link loss is 198 + * signalled. This is necessary to circumvent a hardware bug that 199 + * occurs when the cable is unplugged while TX packets are pending 200 + * in the FIFO. In such cases, the FIFO enters an error mode it 201 + * cannot recover from by software. 202 + */ 203 + if (phydev->drv->phy_id == ATH8030_PHY_ID) { 204 + if (phydev->state == PHY_NOLINK) { 205 + if (priv->gpiod_reset && !priv->phy_reset) { 206 + struct at803x_context context; 207 + 208 + at803x_context_save(phydev, &context); 209 + 210 + gpiod_set_value(priv->gpiod_reset, 0); 211 + msleep(1); 212 + gpiod_set_value(priv->gpiod_reset, 1); 213 + msleep(1); 214 + 215 + at803x_context_restore(phydev, &context); 216 + 217 + dev_dbg(&phydev->dev, "%s(): phy was reset\n", 218 + __func__); 219 + priv->phy_reset = true; 220 + } 221 + } else { 222 + priv->phy_reset = false; 223 + } 224 + } 225 + } 226 + 258 227 static struct phy_driver at803x_driver[] = { 259 228 { 260 229 /* ATHEROS 8035 */ 261 - .phy_id = 0x004dd072, 262 - .name = "Atheros 8035 ethernet", 263 - .phy_id_mask = 0xffffffef, 264 - .config_init = at803x_config_init, 265 - .set_wol = at803x_set_wol, 266 - .get_wol = at803x_get_wol, 267 - .suspend = at803x_suspend, 268 - .resume = at803x_resume, 269 - .features = PHY_GBIT_FEATURES, 270 - .flags = PHY_HAS_INTERRUPT, 271 - .config_aneg = genphy_config_aneg, 272 - .read_status = genphy_read_status, 273 - .driver = { 230 + .phy_id = ATH8035_PHY_ID, 231 + .name = "Atheros 8035 ethernet", 232 + .phy_id_mask = 0xffffffef, 233 + .probe = at803x_probe, 234 + .config_init = at803x_config_init, 235 + .link_change_notify = at803x_link_change_notify, 236 + .set_wol = at803x_set_wol, 237 + .get_wol = at803x_get_wol, 238 + .suspend = at803x_suspend, 239 + .resume = at803x_resume, 240 + .features = PHY_GBIT_FEATURES, 241 + .flags = PHY_HAS_INTERRUPT, 242 + .config_aneg = genphy_config_aneg, 243 + .read_status = genphy_read_status, 244 + .driver = { 274 245 .owner = THIS_MODULE, 275 246 }, 276 247 }, { 277 248 /* ATHEROS 8030 */ 278 - .phy_id = 0x004dd076, 279 - .name = "Atheros 8030 ethernet", 280 - .phy_id_mask = 0xffffffef, 281 - .config_init = at803x_config_init, 282 - .set_wol = at803x_set_wol, 283 - .get_wol = at803x_get_wol, 284 - .suspend = at803x_suspend, 285 - .resume = at803x_resume, 286 - .features = PHY_GBIT_FEATURES, 287 - .flags = PHY_HAS_INTERRUPT, 288 - .config_aneg = genphy_config_aneg, 289 - .read_status = genphy_read_status, 290 - .driver = { 249 + .phy_id = ATH8030_PHY_ID, 250 + .name = "Atheros 8030 ethernet", 251 + .phy_id_mask = 0xffffffef, 252 + .probe = at803x_probe, 253 + .config_init = at803x_config_init, 254 + .link_change_notify = at803x_link_change_notify, 255 + .set_wol = at803x_set_wol, 256 + .get_wol = at803x_get_wol, 257 + .suspend = at803x_suspend, 258 + .resume = at803x_resume, 259 + .features = PHY_GBIT_FEATURES, 260 + .flags = PHY_HAS_INTERRUPT, 261 + .config_aneg = genphy_config_aneg, 262 + .read_status = genphy_read_status, 263 + .driver = { 291 264 .owner = THIS_MODULE, 292 265 }, 293 266 }, { 294 267 /* ATHEROS 8031 */ 295 - .phy_id = 0x004dd074, 296 - .name = "Atheros 8031 ethernet", 297 - .phy_id_mask = 0xffffffef, 298 - .config_init = at803x_config_init, 299 - .set_wol = at803x_set_wol, 300 - .get_wol = at803x_get_wol, 301 - .suspend = at803x_suspend, 302 - .resume = at803x_resume, 303 - .features = PHY_GBIT_FEATURES, 304 - .flags = PHY_HAS_INTERRUPT, 305 - .config_aneg = genphy_config_aneg, 306 - .read_status = genphy_read_status, 307 - .ack_interrupt = &at803x_ack_interrupt, 308 - .config_intr = &at803x_config_intr, 309 - .driver = { 268 + .phy_id = ATH8031_PHY_ID, 269 + .name = "Atheros 8031 ethernet", 270 + .phy_id_mask = 0xffffffef, 271 + .probe = at803x_probe, 272 + .config_init = at803x_config_init, 273 + .link_change_notify = at803x_link_change_notify, 274 + .set_wol = at803x_set_wol, 275 + .get_wol = at803x_get_wol, 276 + .suspend = at803x_suspend, 277 + .resume = at803x_resume, 278 + .features = PHY_GBIT_FEATURES, 279 + .flags = PHY_HAS_INTERRUPT, 280 + .config_aneg = genphy_config_aneg, 281 + .read_status = genphy_read_status, 282 + .ack_interrupt = &at803x_ack_interrupt, 283 + .config_intr = &at803x_config_intr, 284 + .driver = { 310 285 .owner = THIS_MODULE, 311 286 }, 312 287 } }; ··· 367 260 module_exit(atheros_exit); 368 261 369 262 static struct mdio_device_id __maybe_unused atheros_tbl[] = { 370 - { 0x004dd076, 0xffffffef }, 371 - { 0x004dd074, 0xffffffef }, 372 - { 0x004dd072, 0xffffffef }, 263 + { ATH8030_PHY_ID, 0xffffffef }, 264 + { ATH8031_PHY_ID, 0xffffffef }, 265 + { ATH8035_PHY_ID, 0xffffffef }, 373 266 { } 374 267 }; 375 268
+3
drivers/net/phy/phy.c
··· 720 720 721 721 mutex_lock(&phydev->lock); 722 722 723 + if (phydev->drv->link_change_notify) 724 + phydev->drv->link_change_notify(phydev); 725 + 723 726 switch (phydev->state) { 724 727 case PHY_DOWN: 725 728 case PHY_STARTING:
+28 -12
drivers/net/slip/slip.c
··· 83 83 #include <linux/delay.h> 84 84 #include <linux/init.h> 85 85 #include <linux/slab.h> 86 + #include <linux/workqueue.h> 86 87 #include "slip.h" 87 88 #ifdef CONFIG_INET 88 89 #include <linux/ip.h> ··· 417 416 #endif 418 417 } 419 418 420 - /* 421 - * Called by the driver when there's room for more data. If we have 422 - * more packets to send, we send them here. 423 - */ 424 - static void slip_write_wakeup(struct tty_struct *tty) 419 + /* Write out any remaining transmit buffer. Scheduled when tty is writable */ 420 + static void slip_transmit(struct work_struct *work) 425 421 { 422 + struct slip *sl = container_of(work, struct slip, tx_work); 426 423 int actual; 427 - struct slip *sl = tty->disc_data; 428 - 429 - /* First make sure we're connected. */ 430 - if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) 431 - return; 432 424 433 425 spin_lock_bh(&sl->lock); 426 + /* First make sure we're connected. */ 427 + if (!sl->tty || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) { 428 + spin_unlock_bh(&sl->lock); 429 + return; 430 + } 431 + 434 432 if (sl->xleft <= 0) { 435 433 /* Now serial buffer is almost free & we can start 436 434 * transmission of another packet */ 437 435 sl->dev->stats.tx_packets++; 438 - clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); 436 + clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags); 439 437 spin_unlock_bh(&sl->lock); 440 438 sl_unlock(sl); 441 439 return; 442 440 } 443 441 444 - actual = tty->ops->write(tty, sl->xhead, sl->xleft); 442 + actual = sl->tty->ops->write(sl->tty, sl->xhead, sl->xleft); 445 443 sl->xleft -= actual; 446 444 sl->xhead += actual; 447 445 spin_unlock_bh(&sl->lock); 446 + } 447 + 448 + /* 449 + * Called by the driver when there's room for more data. 450 + * Schedule the transmit. 451 + */ 452 + static void slip_write_wakeup(struct tty_struct *tty) 453 + { 454 + struct slip *sl = tty->disc_data; 455 + 456 + schedule_work(&sl->tx_work); 448 457 } 449 458 450 459 static void sl_tx_timeout(struct net_device *dev) ··· 760 749 sl->magic = SLIP_MAGIC; 761 750 sl->dev = dev; 762 751 spin_lock_init(&sl->lock); 752 + INIT_WORK(&sl->tx_work, slip_transmit); 763 753 sl->mode = SL_MODE_DEFAULT; 764 754 #ifdef CONFIG_SLIP_SMART 765 755 /* initialize timer_list struct */ ··· 884 872 if (!sl || sl->magic != SLIP_MAGIC || sl->tty != tty) 885 873 return; 886 874 875 + spin_lock_bh(&sl->lock); 887 876 tty->disc_data = NULL; 888 877 sl->tty = NULL; 878 + spin_unlock_bh(&sl->lock); 879 + 880 + flush_work(&sl->tx_work); 889 881 890 882 /* VSV = very important to remove timers */ 891 883 #ifdef CONFIG_SLIP_SMART
+1
drivers/net/slip/slip.h
··· 53 53 struct tty_struct *tty; /* ptr to TTY structure */ 54 54 struct net_device *dev; /* easy for intr handling */ 55 55 spinlock_t lock; 56 + struct work_struct tx_work; /* Flushes transmit buffer */ 56 57 57 58 #ifdef SL_INCLUDE_CSLIP 58 59 struct slcompress *slcomp; /* for header compression */
+4 -3
drivers/net/usb/huawei_cdc_ncm.c
··· 84 84 ctx = drvstate->ctx; 85 85 86 86 if (usbnet_dev->status) 87 - /* CDC-WMC r1.1 requires wMaxCommand to be "at least 256 88 - * decimal (0x100)" 87 + /* The wMaxCommand buffer must be big enough to hold 88 + * any message from the modem. Experience has shown 89 + * that some replies are more than 256 bytes long 89 90 */ 90 91 subdriver = usb_cdc_wdm_register(ctx->control, 91 92 &usbnet_dev->status->desc, 92 - 256, /* wMaxCommand */ 93 + 1024, /* wMaxCommand */ 93 94 huawei_cdc_ncm_wdm_manage_power); 94 95 if (IS_ERR(subdriver)) { 95 96 ret = PTR_ERR(subdriver);
+5 -2
drivers/net/vmxnet3/vmxnet3_drv.c
··· 2589 2589 for (i = 0; i < adapter->num_tx_queues; i++) 2590 2590 spin_lock_init(&adapter->tx_queue[i].tx_lock); 2591 2591 2592 - err = vmxnet3_create_queues(adapter, VMXNET3_DEF_TX_RING_SIZE, 2593 - VMXNET3_DEF_RX_RING_SIZE, 2592 + err = vmxnet3_create_queues(adapter, adapter->tx_ring_size, 2593 + adapter->rx_ring_size, 2594 2594 VMXNET3_DEF_RX_RING_SIZE); 2595 2595 if (err) 2596 2596 goto queue_err; ··· 2967 2967 adapter = netdev_priv(netdev); 2968 2968 adapter->netdev = netdev; 2969 2969 adapter->pdev = pdev; 2970 + 2971 + adapter->tx_ring_size = VMXNET3_DEF_TX_RING_SIZE; 2972 + adapter->rx_ring_size = VMXNET3_DEF_RX_RING_SIZE; 2970 2973 2971 2974 spin_lock_init(&adapter->cmd_lock); 2972 2975 adapter->adapter_pa = dma_map_single(&adapter->pdev->dev, adapter,
+8 -4
drivers/net/vmxnet3/vmxnet3_ethtool.c
··· 449 449 param->rx_mini_max_pending = 0; 450 450 param->rx_jumbo_max_pending = 0; 451 451 452 - param->rx_pending = adapter->rx_queue[0].rx_ring[0].size; 453 - param->tx_pending = adapter->tx_queue[0].tx_ring.size; 452 + param->rx_pending = adapter->rx_ring_size; 453 + param->tx_pending = adapter->tx_ring_size; 454 454 param->rx_mini_pending = 0; 455 455 param->rx_jumbo_pending = 0; 456 456 } ··· 529 529 * size */ 530 530 netdev_err(netdev, "failed to apply new sizes, " 531 531 "try the default ones\n"); 532 + new_rx_ring_size = VMXNET3_DEF_RX_RING_SIZE; 533 + new_tx_ring_size = VMXNET3_DEF_TX_RING_SIZE; 532 534 err = vmxnet3_create_queues(adapter, 533 - VMXNET3_DEF_TX_RING_SIZE, 534 - VMXNET3_DEF_RX_RING_SIZE, 535 + new_tx_ring_size, 536 + new_rx_ring_size, 535 537 VMXNET3_DEF_RX_RING_SIZE); 536 538 if (err) { 537 539 netdev_err(netdev, "failed to create queues " ··· 547 545 netdev_err(netdev, "failed to re-activate, error %d." 548 546 " Closing it\n", err); 549 547 } 548 + adapter->tx_ring_size = new_tx_ring_size; 549 + adapter->rx_ring_size = new_rx_ring_size; 550 550 551 551 out: 552 552 clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state);
+5
drivers/net/vmxnet3/vmxnet3_int.h
··· 349 349 u32 link_speed; /* in mbps */ 350 350 351 351 u64 tx_timeout_count; 352 + 353 + /* Ring sizes */ 354 + u32 tx_ring_size; 355 + u32 rx_ring_size; 356 + 352 357 struct work_struct work; 353 358 354 359 unsigned long state; /* VMXNET3_STATE_BIT_xxx */
+1 -1
drivers/net/wireless/b43/Kconfig
··· 36 36 choice 37 37 prompt "Supported bus types" 38 38 depends on B43 39 - default B43_BCMA_AND_SSB 39 + default B43_BUSES_BCMA_AND_SSB 40 40 41 41 config B43_BUSES_BCMA_AND_SSB 42 42 bool "BCMA and SSB"
+1
drivers/net/wireless/b43/main.c
··· 5221 5221 /* We don't support 5 GHz on some PHYs yet */ 5222 5222 switch (dev->phy.type) { 5223 5223 case B43_PHYTYPE_A: 5224 + case B43_PHYTYPE_G: 5224 5225 case B43_PHYTYPE_N: 5225 5226 case B43_PHYTYPE_LP: 5226 5227 case B43_PHYTYPE_HT:
+7 -3
drivers/net/wireless/b43/xmit.c
··· 811 811 break; 812 812 case B43_PHYTYPE_G: 813 813 status.band = IEEE80211_BAND_2GHZ; 814 - /* chanid is the radio channel cookie value as used 815 - * to tune the radio. */ 816 - status.freq = chanid + 2400; 814 + /* Somewhere between 478.104 and 508.1084 firmware for G-PHY 815 + * has been modified to be compatible with N-PHY and others. 816 + */ 817 + if (dev->fw.rev >= 508) 818 + status.freq = ieee80211_channel_to_frequency(chanid, status.band); 819 + else 820 + status.freq = chanid + 2400; 817 821 break; 818 822 case B43_PHYTYPE_N: 819 823 case B43_PHYTYPE_LP:
+2 -2
drivers/net/wireless/mwifiex/pcie.c
··· 50 50 return -1; 51 51 } 52 52 mapping.len = size; 53 - memcpy(skb->cb, &mapping, sizeof(mapping)); 53 + mwifiex_store_mapping(skb, &mapping); 54 54 return 0; 55 55 } 56 56 ··· 60 60 struct pcie_service_card *card = adapter->card; 61 61 struct mwifiex_dma_mapping mapping; 62 62 63 - MWIFIEX_SKB_PACB(skb, &mapping); 63 + mwifiex_get_mapping(skb, &mapping); 64 64 pci_unmap_single(card->dev, mapping.addr, mapping.len, flags); 65 65 } 66 66
+37 -14
drivers/net/wireless/mwifiex/util.h
··· 20 20 #ifndef _MWIFIEX_UTIL_H_ 21 21 #define _MWIFIEX_UTIL_H_ 22 22 23 - static inline struct mwifiex_rxinfo *MWIFIEX_SKB_RXCB(struct sk_buff *skb) 24 - { 25 - return (struct mwifiex_rxinfo *)(skb->cb + sizeof(dma_addr_t)); 26 - } 27 - 28 - static inline struct mwifiex_txinfo *MWIFIEX_SKB_TXCB(struct sk_buff *skb) 29 - { 30 - return (struct mwifiex_txinfo *)(skb->cb + sizeof(dma_addr_t)); 31 - } 32 - 33 23 struct mwifiex_dma_mapping { 34 24 dma_addr_t addr; 35 25 size_t len; 36 26 }; 37 27 38 - static inline void MWIFIEX_SKB_PACB(struct sk_buff *skb, 39 - struct mwifiex_dma_mapping *mapping) 28 + struct mwifiex_cb { 29 + struct mwifiex_dma_mapping dma_mapping; 30 + union { 31 + struct mwifiex_rxinfo rx_info; 32 + struct mwifiex_txinfo tx_info; 33 + }; 34 + }; 35 + 36 + static inline struct mwifiex_rxinfo *MWIFIEX_SKB_RXCB(struct sk_buff *skb) 40 37 { 41 - memcpy(mapping, skb->cb, sizeof(*mapping)); 38 + struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; 39 + 40 + BUILD_BUG_ON(sizeof(struct mwifiex_cb) > sizeof(skb->cb)); 41 + return &cb->rx_info; 42 + } 43 + 44 + static inline struct mwifiex_txinfo *MWIFIEX_SKB_TXCB(struct sk_buff *skb) 45 + { 46 + struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; 47 + 48 + return &cb->tx_info; 49 + } 50 + 51 + static inline void mwifiex_store_mapping(struct sk_buff *skb, 52 + struct mwifiex_dma_mapping *mapping) 53 + { 54 + struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; 55 + 56 + memcpy(&cb->dma_mapping, mapping, sizeof(*mapping)); 57 + } 58 + 59 + static inline void mwifiex_get_mapping(struct sk_buff *skb, 60 + struct mwifiex_dma_mapping *mapping) 61 + { 62 + struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; 63 + 64 + memcpy(mapping, &cb->dma_mapping, sizeof(*mapping)); 42 65 } 43 66 44 67 static inline dma_addr_t MWIFIEX_SKB_DMA_ADDR(struct sk_buff *skb) 45 68 { 46 69 struct mwifiex_dma_mapping mapping; 47 70 48 - MWIFIEX_SKB_PACB(skb, &mapping); 71 + mwifiex_get_mapping(skb, &mapping); 49 72 50 73 return mapping.addr; 51 74 }
+6 -1
drivers/net/wireless/rt2x00/rt2500pci.c
··· 1681 1681 /* 1682 1682 * Detect if this device has an hardware controlled radio. 1683 1683 */ 1684 - if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) 1684 + if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) { 1685 1685 __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); 1686 + /* 1687 + * On this device RFKILL initialized during probe does not work. 1688 + */ 1689 + __set_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags); 1690 + } 1686 1691 1687 1692 /* 1688 1693 * Check if the BBP tuning should be enabled.
+36 -3
drivers/net/wireless/rt2x00/rt2800usb.c
··· 229 229 /* 230 230 * Firmware functions 231 231 */ 232 + static int rt2800usb_autorun_detect(struct rt2x00_dev *rt2x00dev) 233 + { 234 + __le32 reg; 235 + u32 fw_mode; 236 + 237 + /* cannot use rt2x00usb_register_read here as it uses different 238 + * mode (MULTI_READ vs. DEVICE_MODE) and does not pass the 239 + * magic value USB_MODE_AUTORUN (0x11) to the device, thus the 240 + * returned value would be invalid. 241 + */ 242 + rt2x00usb_vendor_request(rt2x00dev, USB_DEVICE_MODE, 243 + USB_VENDOR_REQUEST_IN, 0, USB_MODE_AUTORUN, 244 + &reg, sizeof(reg), REGISTER_TIMEOUT_FIRMWARE); 245 + fw_mode = le32_to_cpu(reg); 246 + 247 + if ((fw_mode & 0x00000003) == 2) 248 + return 1; 249 + 250 + return 0; 251 + } 252 + 232 253 static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) 233 254 { 234 255 return FIRMWARE_RT2870; ··· 278 257 /* 279 258 * Write firmware to device. 280 259 */ 281 - rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, 282 - data + offset, length); 260 + if (rt2800usb_autorun_detect(rt2x00dev)) { 261 + rt2x00_info(rt2x00dev, 262 + "Firmware loading not required - NIC in AutoRun mode\n"); 263 + } else { 264 + rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, 265 + data + offset, length); 266 + } 283 267 284 268 rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); 285 269 rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); ··· 761 735 /* 762 736 * Device probe functions. 763 737 */ 738 + static int rt2800usb_efuse_detect(struct rt2x00_dev *rt2x00dev) 739 + { 740 + if (rt2800usb_autorun_detect(rt2x00dev)) 741 + return 1; 742 + return rt2800_efuse_detect(rt2x00dev); 743 + } 744 + 764 745 static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev) 765 746 { 766 747 int retval; 767 748 768 - if (rt2800_efuse_detect(rt2x00dev)) 749 + if (rt2800usb_efuse_detect(rt2x00dev)) 769 750 retval = rt2800_read_eeprom_efuse(rt2x00dev); 770 751 else 771 752 retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom,
+1
drivers/net/wireless/rt2x00/rt2x00.h
··· 693 693 REQUIRE_SW_SEQNO, 694 694 REQUIRE_HT_TX_DESC, 695 695 REQUIRE_PS_AUTOWAKE, 696 + REQUIRE_DELAYED_RFKILL, 696 697 697 698 /* 698 699 * Capabilities
+21 -3
drivers/net/wireless/rt2x00/rt2x00dev.c
··· 1126 1126 return; 1127 1127 1128 1128 /* 1129 - * Unregister extra components. 1129 + * Stop rfkill polling. 1130 1130 */ 1131 - rt2x00rfkill_unregister(rt2x00dev); 1131 + if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) 1132 + rt2x00rfkill_unregister(rt2x00dev); 1132 1133 1133 1134 /* 1134 1135 * Allow the HW to uninitialize. ··· 1166 1165 } 1167 1166 1168 1167 set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); 1168 + 1169 + /* 1170 + * Start rfkill polling. 1171 + */ 1172 + if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) 1173 + rt2x00rfkill_register(rt2x00dev); 1169 1174 1170 1175 return 0; 1171 1176 } ··· 1382 1375 rt2x00link_register(rt2x00dev); 1383 1376 rt2x00leds_register(rt2x00dev); 1384 1377 rt2x00debug_register(rt2x00dev); 1385 - rt2x00rfkill_register(rt2x00dev); 1378 + 1379 + /* 1380 + * Start rfkill polling. 1381 + */ 1382 + if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) 1383 + rt2x00rfkill_register(rt2x00dev); 1386 1384 1387 1385 return 0; 1388 1386 ··· 1401 1389 void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) 1402 1390 { 1403 1391 clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); 1392 + 1393 + /* 1394 + * Stop rfkill polling. 1395 + */ 1396 + if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) 1397 + rt2x00rfkill_unregister(rt2x00dev); 1404 1398 1405 1399 /* 1406 1400 * Disable radio.
+2
drivers/net/wireless/rt2x00/rt2x00mac.c
··· 487 487 crypto.cipher = rt2x00crypto_key_to_cipher(key); 488 488 if (crypto.cipher == CIPHER_NONE) 489 489 return -EOPNOTSUPP; 490 + if (crypto.cipher == CIPHER_TKIP && rt2x00_is_usb(rt2x00dev)) 491 + return -EOPNOTSUPP; 490 492 491 493 crypto.cmd = cmd; 492 494
+1
drivers/net/wireless/rt2x00/rt2x00usb.h
··· 93 93 USB_MODE_SLEEP = 7, /* RT73USB */ 94 94 USB_MODE_FIRMWARE = 8, /* RT73USB */ 95 95 USB_MODE_WAKEUP = 9, /* RT73USB */ 96 + USB_MODE_AUTORUN = 17, /* RT2800USB */ 96 97 }; 97 98 98 99 /**
+1
drivers/net/xen-netback/common.h
··· 222 222 223 223 /* Queues */ 224 224 struct xenvif_queue *queues; 225 + unsigned int num_queues; /* active queues, resource allocated */ 225 226 226 227 /* Miscellaneous private stuff. */ 227 228 struct net_device *dev;
+11 -38
drivers/net/xen-netback/interface.c
··· 137 137 } 138 138 } 139 139 140 - static u16 xenvif_select_queue(struct net_device *dev, struct sk_buff *skb, 141 - void *accel_priv, select_queue_fallback_t fallback) 142 - { 143 - unsigned int num_queues = dev->real_num_tx_queues; 144 - u32 hash; 145 - u16 queue_index; 146 - 147 - /* First, check if there is only one queue to optimise the 148 - * single-queue or old frontend scenario. 149 - */ 150 - if (num_queues == 1) { 151 - queue_index = 0; 152 - } else { 153 - /* Use skb_get_hash to obtain an L4 hash if available */ 154 - hash = skb_get_hash(skb); 155 - queue_index = hash % num_queues; 156 - } 157 - 158 - return queue_index; 159 - } 160 - 161 140 static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) 162 141 { 163 142 struct xenvif *vif = netdev_priv(dev); 164 143 struct xenvif_queue *queue = NULL; 165 - unsigned int num_queues = dev->real_num_tx_queues; 144 + unsigned int num_queues = vif->num_queues; 166 145 u16 index; 167 146 int min_slots_needed; 168 147 ··· 204 225 { 205 226 struct xenvif *vif = netdev_priv(dev); 206 227 struct xenvif_queue *queue = NULL; 207 - unsigned int num_queues = dev->real_num_tx_queues; 228 + unsigned int num_queues = vif->num_queues; 208 229 unsigned long rx_bytes = 0; 209 230 unsigned long rx_packets = 0; 210 231 unsigned long tx_bytes = 0; ··· 235 256 static void xenvif_up(struct xenvif *vif) 236 257 { 237 258 struct xenvif_queue *queue = NULL; 238 - unsigned int num_queues = vif->dev->real_num_tx_queues; 259 + unsigned int num_queues = vif->num_queues; 239 260 unsigned int queue_index; 240 261 241 262 for (queue_index = 0; queue_index < num_queues; ++queue_index) { ··· 251 272 static void xenvif_down(struct xenvif *vif) 252 273 { 253 274 struct xenvif_queue *queue = NULL; 254 - unsigned int num_queues = vif->dev->real_num_tx_queues; 275 + unsigned int num_queues = vif->num_queues; 255 276 unsigned int queue_index; 256 277 257 278 for (queue_index = 0; queue_index < num_queues; ++queue_index) { ··· 358 379 struct ethtool_stats *stats, u64 * data) 359 380 { 360 381 struct xenvif *vif = netdev_priv(dev); 361 - unsigned int num_queues = dev->real_num_tx_queues; 382 + unsigned int num_queues = vif->num_queues; 362 383 int i; 363 384 unsigned int queue_index; 364 385 struct xenvif_stats *vif_stats; ··· 403 424 .ndo_fix_features = xenvif_fix_features, 404 425 .ndo_set_mac_address = eth_mac_addr, 405 426 .ndo_validate_addr = eth_validate_addr, 406 - .ndo_select_queue = xenvif_select_queue, 407 427 }; 408 428 409 429 struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, ··· 416 438 snprintf(name, IFNAMSIZ - 1, "vif%u.%u", domid, handle); 417 439 /* Allocate a netdev with the max. supported number of queues. 418 440 * When the guest selects the desired number, it will be updated 419 - * via netif_set_real_num_tx_queues(). 441 + * via netif_set_real_num_*_queues(). 420 442 */ 421 443 dev = alloc_netdev_mq(sizeof(struct xenvif), name, ether_setup, 422 444 xenvif_max_queues); ··· 436 458 vif->dev = dev; 437 459 vif->disabled = false; 438 460 439 - /* Start out with no queues. The call below does not require 440 - * rtnl_lock() as it happens before register_netdev(). 441 - */ 461 + /* Start out with no queues. */ 442 462 vif->queues = NULL; 443 - netif_set_real_num_tx_queues(dev, 0); 463 + vif->num_queues = 0; 444 464 445 465 dev->netdev_ops = &xenvif_netdev_ops; 446 466 dev->hw_features = NETIF_F_SG | ··· 653 677 void xenvif_disconnect(struct xenvif *vif) 654 678 { 655 679 struct xenvif_queue *queue = NULL; 656 - unsigned int num_queues = vif->dev->real_num_tx_queues; 680 + unsigned int num_queues = vif->num_queues; 657 681 unsigned int queue_index; 658 682 659 683 if (netif_carrier_ok(vif->dev)) ··· 700 724 void xenvif_free(struct xenvif *vif) 701 725 { 702 726 struct xenvif_queue *queue = NULL; 703 - unsigned int num_queues = vif->dev->real_num_tx_queues; 727 + unsigned int num_queues = vif->num_queues; 704 728 unsigned int queue_index; 705 729 /* Here we want to avoid timeout messages if an skb can be legitimately 706 730 * stuck somewhere else. Realistically this could be an another vif's ··· 724 748 xenvif_deinit_queue(queue); 725 749 } 726 750 727 - /* Free the array of queues. The call below does not require 728 - * rtnl_lock() because it happens after unregister_netdev(). 729 - */ 730 - netif_set_real_num_tx_queues(vif->dev, 0); 731 751 vfree(vif->queues); 732 752 vif->queues = NULL; 753 + vif->num_queues = 0; 733 754 734 755 free_netdev(vif->dev); 735 756
+14 -14
drivers/net/xen-netback/xenbus.c
··· 527 527 /* Use the number of queues requested by the frontend */ 528 528 be->vif->queues = vzalloc(requested_num_queues * 529 529 sizeof(struct xenvif_queue)); 530 - rtnl_lock(); 531 - netif_set_real_num_tx_queues(be->vif->dev, requested_num_queues); 532 - rtnl_unlock(); 530 + be->vif->num_queues = requested_num_queues; 533 531 534 532 for (queue_index = 0; queue_index < requested_num_queues; ++queue_index) { 535 533 queue = &be->vif->queues[queue_index]; ··· 544 546 * earlier queues can be destroyed using the regular 545 547 * disconnect logic. 546 548 */ 547 - rtnl_lock(); 548 - netif_set_real_num_tx_queues(be->vif->dev, queue_index); 549 - rtnl_unlock(); 549 + be->vif->num_queues = queue_index; 550 550 goto err; 551 551 } 552 552 ··· 557 561 * and also clean up any previously initialised queues. 558 562 */ 559 563 xenvif_deinit_queue(queue); 560 - rtnl_lock(); 561 - netif_set_real_num_tx_queues(be->vif->dev, queue_index); 562 - rtnl_unlock(); 564 + be->vif->num_queues = queue_index; 563 565 goto err; 564 566 } 565 567 } 568 + 569 + /* Initialisation completed, tell core driver the number of 570 + * active queues. 571 + */ 572 + rtnl_lock(); 573 + netif_set_real_num_tx_queues(be->vif->dev, requested_num_queues); 574 + netif_set_real_num_rx_queues(be->vif->dev, requested_num_queues); 575 + rtnl_unlock(); 566 576 567 577 xenvif_carrier_on(be->vif); 568 578 ··· 584 582 return; 585 583 586 584 err: 587 - if (be->vif->dev->real_num_tx_queues > 0) 585 + if (be->vif->num_queues > 0) 588 586 xenvif_disconnect(be->vif); /* Clean up existing queues */ 589 587 vfree(be->vif->queues); 590 588 be->vif->queues = NULL; 591 - rtnl_lock(); 592 - netif_set_real_num_tx_queues(be->vif->dev, 0); 593 - rtnl_unlock(); 589 + be->vif->num_queues = 0; 594 590 return; 595 591 } 596 592 ··· 596 596 static int connect_rings(struct backend_info *be, struct xenvif_queue *queue) 597 597 { 598 598 struct xenbus_device *dev = be->dev; 599 - unsigned int num_queues = queue->vif->dev->real_num_tx_queues; 599 + unsigned int num_queues = queue->vif->num_queues; 600 600 unsigned long tx_ring_ref, rx_ring_ref; 601 601 unsigned int tx_evtchn, rx_evtchn; 602 602 int err;
+75 -34
drivers/net/xen-netfront.c
··· 1287 1287 1288 1288 if (likely(netif_carrier_ok(dev) && 1289 1289 RING_HAS_UNCONSUMED_RESPONSES(&queue->rx))) 1290 - napi_schedule(&queue->napi); 1290 + napi_schedule(&queue->napi); 1291 1291 1292 1292 return IRQ_HANDLED; 1293 1293 } ··· 1437 1437 static void xennet_disconnect_backend(struct netfront_info *info) 1438 1438 { 1439 1439 unsigned int i = 0; 1440 - struct netfront_queue *queue = NULL; 1441 1440 unsigned int num_queues = info->netdev->real_num_tx_queues; 1442 1441 1443 1442 for (i = 0; i < num_queues; ++i) { 1443 + struct netfront_queue *queue = &info->queues[i]; 1444 + 1444 1445 /* Stop old i/f to prevent errors whilst we rebuild the state. */ 1445 1446 spin_lock_bh(&queue->rx_lock); 1446 1447 spin_lock_irq(&queue->tx_lock); ··· 1699 1698 goto exit_free_tx; 1700 1699 } 1701 1700 1702 - netif_napi_add(queue->info->netdev, &queue->napi, xennet_poll, 64); 1703 - 1704 1701 return 0; 1705 1702 1706 1703 exit_free_tx: ··· 1789 1790 return err; 1790 1791 } 1791 1792 1793 + static void xennet_destroy_queues(struct netfront_info *info) 1794 + { 1795 + unsigned int i; 1796 + 1797 + rtnl_lock(); 1798 + 1799 + for (i = 0; i < info->netdev->real_num_tx_queues; i++) { 1800 + struct netfront_queue *queue = &info->queues[i]; 1801 + 1802 + if (netif_running(info->netdev)) 1803 + napi_disable(&queue->napi); 1804 + netif_napi_del(&queue->napi); 1805 + } 1806 + 1807 + rtnl_unlock(); 1808 + 1809 + kfree(info->queues); 1810 + info->queues = NULL; 1811 + } 1812 + 1813 + static int xennet_create_queues(struct netfront_info *info, 1814 + unsigned int num_queues) 1815 + { 1816 + unsigned int i; 1817 + int ret; 1818 + 1819 + info->queues = kcalloc(num_queues, sizeof(struct netfront_queue), 1820 + GFP_KERNEL); 1821 + if (!info->queues) 1822 + return -ENOMEM; 1823 + 1824 + rtnl_lock(); 1825 + 1826 + for (i = 0; i < num_queues; i++) { 1827 + struct netfront_queue *queue = &info->queues[i]; 1828 + 1829 + queue->id = i; 1830 + queue->info = info; 1831 + 1832 + ret = xennet_init_queue(queue); 1833 + if (ret < 0) { 1834 + dev_warn(&info->netdev->dev, "only created %d queues\n", 1835 + num_queues); 1836 + num_queues = i; 1837 + break; 1838 + } 1839 + 1840 + netif_napi_add(queue->info->netdev, &queue->napi, 1841 + xennet_poll, 64); 1842 + if (netif_running(info->netdev)) 1843 + napi_enable(&queue->napi); 1844 + } 1845 + 1846 + netif_set_real_num_tx_queues(info->netdev, num_queues); 1847 + 1848 + rtnl_unlock(); 1849 + 1850 + if (num_queues == 0) { 1851 + dev_err(&info->netdev->dev, "no queues\n"); 1852 + return -EINVAL; 1853 + } 1854 + return 0; 1855 + } 1856 + 1792 1857 /* Common code used when first setting up, and when resuming. */ 1793 1858 static int talk_to_netback(struct xenbus_device *dev, 1794 1859 struct netfront_info *info) ··· 1889 1826 goto out; 1890 1827 } 1891 1828 1892 - /* Allocate array of queues */ 1893 - info->queues = kcalloc(num_queues, sizeof(struct netfront_queue), GFP_KERNEL); 1894 - if (!info->queues) { 1895 - err = -ENOMEM; 1896 - goto out; 1897 - } 1898 - rtnl_lock(); 1899 - netif_set_real_num_tx_queues(info->netdev, num_queues); 1900 - rtnl_unlock(); 1829 + if (info->queues) 1830 + xennet_destroy_queues(info); 1831 + 1832 + err = xennet_create_queues(info, num_queues); 1833 + if (err < 0) 1834 + goto destroy_ring; 1901 1835 1902 1836 /* Create shared ring, alloc event channel -- for each queue */ 1903 1837 for (i = 0; i < num_queues; ++i) { 1904 1838 queue = &info->queues[i]; 1905 - queue->id = i; 1906 - queue->info = info; 1907 - err = xennet_init_queue(queue); 1908 - if (err) { 1909 - /* xennet_init_queue() cleans up after itself on failure, 1910 - * but we still have to clean up any previously initialised 1911 - * queues. If i > 0, set num_queues to i, then goto 1912 - * destroy_ring, which calls xennet_disconnect_backend() 1913 - * to tidy up. 1914 - */ 1915 - if (i > 0) { 1916 - rtnl_lock(); 1917 - netif_set_real_num_tx_queues(info->netdev, i); 1918 - rtnl_unlock(); 1919 - goto destroy_ring; 1920 - } else { 1921 - goto out; 1922 - } 1923 - } 1924 1839 err = setup_netfront(dev, queue, feature_split_evtchn); 1925 1840 if (err) { 1926 - /* As for xennet_init_queue(), setup_netfront() will tidy 1927 - * up the current queue on error, but we need to clean up 1841 + /* setup_netfront() will tidy up the current 1842 + * queue on error, but we need to clean up 1928 1843 * those already allocated. 1929 1844 */ 1930 1845 if (i > 0) {
+5 -3
drivers/of/of_mdio.c
··· 323 323 fixed_link_node = of_get_child_by_name(np, "fixed-link"); 324 324 if (fixed_link_node) { 325 325 status.link = 1; 326 - status.duplex = of_property_read_bool(np, "full-duplex"); 326 + status.duplex = of_property_read_bool(fixed_link_node, 327 + "full-duplex"); 327 328 if (of_property_read_u32(fixed_link_node, "speed", &status.speed)) 328 329 return -EINVAL; 329 - status.pause = of_property_read_bool(np, "pause"); 330 - status.asym_pause = of_property_read_bool(np, "asym-pause"); 330 + status.pause = of_property_read_bool(fixed_link_node, "pause"); 331 + status.asym_pause = of_property_read_bool(fixed_link_node, 332 + "asym-pause"); 331 333 of_node_put(fixed_link_node); 332 334 return fixed_phy_register(PHY_POLL, &status, np); 333 335 }
+1 -1
drivers/ptp/Kconfig
··· 74 74 75 75 config PTP_1588_CLOCK_PCH 76 76 tristate "Intel PCH EG20T as PTP clock" 77 - depends on X86 || COMPILE_TEST 77 + depends on X86_32 || COMPILE_TEST 78 78 depends on HAS_IOMEM && NET 79 79 select PTP_1588_CLOCK 80 80 help
+9
include/linux/phy.h
··· 536 536 /* See set_wol, but for checking whether Wake on LAN is enabled. */ 537 537 void (*get_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol); 538 538 539 + /* 540 + * Called to inform a PHY device driver when the core is about to 541 + * change the link state. This callback is supposed to be used as 542 + * fixup hook for drivers that need to take action when the link 543 + * state changes. Drivers are by no means allowed to mess with the 544 + * PHY device structure in their implementations. 545 + */ 546 + void (*link_change_notify)(struct phy_device *dev); 547 + 539 548 struct device_driver driver; 540 549 }; 541 550 #define to_phy_driver(d) container_of(d, struct phy_driver, driver)
+3 -3
include/net/netfilter/nf_tables.h
··· 503 503 * @net: net namespace that this chain belongs to 504 504 * @table: table that this chain belongs to 505 505 * @handle: chain handle 506 - * @flags: bitmask of enum nft_chain_flags 507 506 * @use: number of jump references to this chain 508 507 * @level: length of longest path to this chain 508 + * @flags: bitmask of enum nft_chain_flags 509 509 * @name: name of the chain 510 510 */ 511 511 struct nft_chain { ··· 514 514 struct net *net; 515 515 struct nft_table *table; 516 516 u64 handle; 517 - u8 flags; 518 - u16 use; 517 + u32 use; 519 518 u16 level; 519 + u8 flags; 520 520 char name[NFT_CHAIN_MAXNAMELEN]; 521 521 }; 522 522
+2 -2
include/net/sock.h
··· 1730 1730 1731 1731 rcu_read_lock(); 1732 1732 dst = rcu_dereference(sk->sk_dst_cache); 1733 - if (dst) 1734 - dst_hold(dst); 1733 + if (dst && !atomic_inc_not_zero(&dst->__refcnt)) 1734 + dst = NULL; 1735 1735 rcu_read_unlock(); 1736 1736 return dst; 1737 1737 }
+4 -1
net/8021q/vlan_core.c
··· 114 114 115 115 static struct sk_buff *vlan_reorder_header(struct sk_buff *skb) 116 116 { 117 - if (skb_cow(skb, skb_headroom(skb)) < 0) 117 + if (skb_cow(skb, skb_headroom(skb)) < 0) { 118 + kfree_skb(skb); 118 119 return NULL; 120 + } 121 + 119 122 memmove(skb->data - ETH_HLEN, skb->data - VLAN_ETH_HLEN, 2 * ETH_ALEN); 120 123 skb->mac_header += VLAN_HLEN; 121 124 return skb;
+1 -6
net/bluetooth/hci_conn.c
··· 610 610 if (hci_update_random_address(req, false, &own_addr_type)) 611 611 return; 612 612 613 - /* Save the address type used for this connnection attempt so we able 614 - * to retrieve this information if we need it. 615 - */ 616 - conn->src_type = own_addr_type; 617 - 618 613 cp.scan_interval = cpu_to_le16(hdev->le_scan_interval); 619 614 cp.scan_window = cpu_to_le16(hdev->le_scan_window); 620 615 bacpy(&cp.peer_addr, &conn->dst); ··· 889 894 /* If we're already encrypted set the REAUTH_PEND flag, 890 895 * otherwise set the ENCRYPT_PEND. 891 896 */ 892 - if (conn->key_type != 0xff) 897 + if (conn->link_mode & HCI_LM_ENCRYPT) 893 898 set_bit(HCI_CONN_REAUTH_PEND, &conn->flags); 894 899 else 895 900 set_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags);
+14 -3
net/bluetooth/hci_event.c
··· 48 48 smp_mb__after_atomic(); /* wake_up_bit advises about this barrier */ 49 49 wake_up_bit(&hdev->flags, HCI_INQUIRY); 50 50 51 + hci_dev_lock(hdev); 52 + hci_discovery_set_state(hdev, DISCOVERY_STOPPED); 53 + hci_dev_unlock(hdev); 54 + 51 55 hci_conn_check_pending(hdev); 52 56 } 53 57 ··· 3541 3537 cp.authentication = conn->auth_type; 3542 3538 3543 3539 /* Request MITM protection if our IO caps allow it 3544 - * except for the no-bonding case 3540 + * except for the no-bonding case. 3541 + * conn->auth_type is not updated here since 3542 + * that might cause the user confirmation to be 3543 + * rejected in case the remote doesn't have the 3544 + * IO capabilities for MITM. 3545 3545 */ 3546 3546 if (conn->io_capability != HCI_IO_NO_INPUT_OUTPUT && 3547 3547 cp.authentication != HCI_AT_NO_BONDING) ··· 3636 3628 3637 3629 /* If we're not the initiators request authorization to 3638 3630 * proceed from user space (mgmt_user_confirm with 3639 - * confirm_hint set to 1). */ 3640 - if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags)) { 3631 + * confirm_hint set to 1). The exception is if neither 3632 + * side had MITM in which case we do auto-accept. 3633 + */ 3634 + if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags) && 3635 + (loc_mitm || rem_mitm)) { 3641 3636 BT_DBG("Confirming auto-accept as acceptor"); 3642 3637 confirm_hint = 1; 3643 3638 goto confirm;
+7 -1
net/bluetooth/l2cap_core.c
··· 1663 1663 kfree_skb(conn->rx_skb); 1664 1664 1665 1665 skb_queue_purge(&conn->pending_rx); 1666 - flush_work(&conn->pending_rx_work); 1666 + 1667 + /* We can not call flush_work(&conn->pending_rx_work) here since we 1668 + * might block if we are running on a worker from the same workqueue 1669 + * pending_rx_work is waiting on. 1670 + */ 1671 + if (work_pending(&conn->pending_rx_work)) 1672 + cancel_work_sync(&conn->pending_rx_work); 1667 1673 1668 1674 l2cap_unregister_all_users(conn); 1669 1675
-5
net/bluetooth/l2cap_sock.c
··· 787 787 788 788 /*change security for LE channels */ 789 789 if (chan->scid == L2CAP_CID_ATT) { 790 - if (!conn->hcon->out) { 791 - err = -EINVAL; 792 - break; 793 - } 794 - 795 790 if (smp_conn_security(conn->hcon, sec.level)) 796 791 break; 797 792 sk->sk_state = BT_CONFIG;
+56 -48
net/bluetooth/mgmt.c
··· 1047 1047 } 1048 1048 } 1049 1049 1050 + static void hci_stop_discovery(struct hci_request *req) 1051 + { 1052 + struct hci_dev *hdev = req->hdev; 1053 + struct hci_cp_remote_name_req_cancel cp; 1054 + struct inquiry_entry *e; 1055 + 1056 + switch (hdev->discovery.state) { 1057 + case DISCOVERY_FINDING: 1058 + if (test_bit(HCI_INQUIRY, &hdev->flags)) { 1059 + hci_req_add(req, HCI_OP_INQUIRY_CANCEL, 0, NULL); 1060 + } else { 1061 + cancel_delayed_work(&hdev->le_scan_disable); 1062 + hci_req_add_le_scan_disable(req); 1063 + } 1064 + 1065 + break; 1066 + 1067 + case DISCOVERY_RESOLVING: 1068 + e = hci_inquiry_cache_lookup_resolve(hdev, BDADDR_ANY, 1069 + NAME_PENDING); 1070 + if (!e) 1071 + return; 1072 + 1073 + bacpy(&cp.bdaddr, &e->data.bdaddr); 1074 + hci_req_add(req, HCI_OP_REMOTE_NAME_REQ_CANCEL, sizeof(cp), 1075 + &cp); 1076 + 1077 + break; 1078 + 1079 + default: 1080 + /* Passive scanning */ 1081 + if (test_bit(HCI_LE_SCAN, &hdev->dev_flags)) 1082 + hci_req_add_le_scan_disable(req); 1083 + break; 1084 + } 1085 + } 1086 + 1050 1087 static int clean_up_hci_state(struct hci_dev *hdev) 1051 1088 { 1052 1089 struct hci_request req; ··· 1100 1063 if (test_bit(HCI_ADVERTISING, &hdev->dev_flags)) 1101 1064 disable_advertising(&req); 1102 1065 1103 - if (test_bit(HCI_LE_SCAN, &hdev->dev_flags)) { 1104 - hci_req_add_le_scan_disable(&req); 1105 - } 1066 + hci_stop_discovery(&req); 1106 1067 1107 1068 list_for_each_entry(conn, &hdev->conn_hash.list, list) { 1108 1069 struct hci_cp_disconnect dc; ··· 3031 2996 } 3032 2997 3033 2998 if (addr->type == BDADDR_LE_PUBLIC || addr->type == BDADDR_LE_RANDOM) { 3034 - /* Continue with pairing via SMP */ 2999 + /* Continue with pairing via SMP. The hdev lock must be 3000 + * released as SMP may try to recquire it for crypto 3001 + * purposes. 3002 + */ 3003 + hci_dev_unlock(hdev); 3035 3004 err = smp_user_confirm_reply(conn, mgmt_op, passkey); 3005 + hci_dev_lock(hdev); 3036 3006 3037 3007 if (!err) 3038 3008 err = cmd_complete(sk, hdev->id, mgmt_op, ··· 3614 3574 { 3615 3575 struct mgmt_cp_stop_discovery *mgmt_cp = data; 3616 3576 struct pending_cmd *cmd; 3617 - struct hci_cp_remote_name_req_cancel cp; 3618 - struct inquiry_entry *e; 3619 3577 struct hci_request req; 3620 3578 int err; 3621 3579 ··· 3643 3605 3644 3606 hci_req_init(&req, hdev); 3645 3607 3646 - switch (hdev->discovery.state) { 3647 - case DISCOVERY_FINDING: 3648 - if (test_bit(HCI_INQUIRY, &hdev->flags)) { 3649 - hci_req_add(&req, HCI_OP_INQUIRY_CANCEL, 0, NULL); 3650 - } else { 3651 - cancel_delayed_work(&hdev->le_scan_disable); 3608 + hci_stop_discovery(&req); 3652 3609 3653 - hci_req_add_le_scan_disable(&req); 3654 - } 3655 - 3656 - break; 3657 - 3658 - case DISCOVERY_RESOLVING: 3659 - e = hci_inquiry_cache_lookup_resolve(hdev, BDADDR_ANY, 3660 - NAME_PENDING); 3661 - if (!e) { 3662 - mgmt_pending_remove(cmd); 3663 - err = cmd_complete(sk, hdev->id, 3664 - MGMT_OP_STOP_DISCOVERY, 0, 3665 - &mgmt_cp->type, 3666 - sizeof(mgmt_cp->type)); 3667 - hci_discovery_set_state(hdev, DISCOVERY_STOPPED); 3668 - goto unlock; 3669 - } 3670 - 3671 - bacpy(&cp.bdaddr, &e->data.bdaddr); 3672 - hci_req_add(&req, HCI_OP_REMOTE_NAME_REQ_CANCEL, sizeof(cp), 3673 - &cp); 3674 - 3675 - break; 3676 - 3677 - default: 3678 - BT_DBG("unknown discovery state %u", hdev->discovery.state); 3679 - 3680 - mgmt_pending_remove(cmd); 3681 - err = cmd_complete(sk, hdev->id, MGMT_OP_STOP_DISCOVERY, 3682 - MGMT_STATUS_FAILED, &mgmt_cp->type, 3683 - sizeof(mgmt_cp->type)); 3610 + err = hci_req_run(&req, stop_discovery_complete); 3611 + if (!err) { 3612 + hci_discovery_set_state(hdev, DISCOVERY_STOPPING); 3684 3613 goto unlock; 3685 3614 } 3686 3615 3687 - err = hci_req_run(&req, stop_discovery_complete); 3688 - if (err < 0) 3689 - mgmt_pending_remove(cmd); 3690 - else 3691 - hci_discovery_set_state(hdev, DISCOVERY_STOPPING); 3616 + mgmt_pending_remove(cmd); 3617 + 3618 + /* If no HCI commands were sent we're done */ 3619 + if (err == -ENODATA) { 3620 + err = cmd_complete(sk, hdev->id, MGMT_OP_STOP_DISCOVERY, 0, 3621 + &mgmt_cp->type, sizeof(mgmt_cp->type)); 3622 + hci_discovery_set_state(hdev, DISCOVERY_STOPPED); 3623 + } 3692 3624 3693 3625 unlock: 3694 3626 hci_dev_unlock(hdev);
+7 -2
net/bluetooth/smp.c
··· 544 544 hci_le_start_enc(hcon, ediv, rand, stk); 545 545 hcon->enc_key_size = smp->enc_key_size; 546 546 } else { 547 - u8 stk[16]; 547 + u8 stk[16], auth; 548 548 __le64 rand = 0; 549 549 __le16 ediv = 0; 550 550 ··· 556 556 memset(stk + smp->enc_key_size, 0, 557 557 SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size); 558 558 559 + if (hcon->pending_sec_level == BT_SECURITY_HIGH) 560 + auth = 1; 561 + else 562 + auth = 0; 563 + 559 564 hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, 560 - HCI_SMP_STK_SLAVE, 0, stk, smp->enc_key_size, 565 + HCI_SMP_STK_SLAVE, auth, stk, smp->enc_key_size, 561 566 ediv, rand); 562 567 } 563 568
+11 -5
net/core/dst.c
··· 269 269 } 270 270 EXPORT_SYMBOL(dst_destroy); 271 271 272 + static void dst_destroy_rcu(struct rcu_head *head) 273 + { 274 + struct dst_entry *dst = container_of(head, struct dst_entry, rcu_head); 275 + 276 + dst = dst_destroy(dst); 277 + if (dst) 278 + __dst_free(dst); 279 + } 280 + 272 281 void dst_release(struct dst_entry *dst) 273 282 { 274 283 if (dst) { ··· 285 276 286 277 newrefcnt = atomic_dec_return(&dst->__refcnt); 287 278 WARN_ON(newrefcnt < 0); 288 - if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt) { 289 - dst = dst_destroy(dst); 290 - if (dst) 291 - __dst_free(dst); 292 - } 279 + if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt) 280 + call_rcu(&dst->rcu_head, dst_destroy_rcu); 293 281 } 294 282 } 295 283 EXPORT_SYMBOL(dst_release);
+5 -5
net/core/filter.c
··· 840 840 BUILD_BUG_ON(BPF_MEMWORDS * sizeof(u32) > MAX_BPF_STACK); 841 841 BUILD_BUG_ON(BPF_REG_FP + 1 != MAX_BPF_REG); 842 842 843 - if (len <= 0 || len >= BPF_MAXINSNS) 843 + if (len <= 0 || len > BPF_MAXINSNS) 844 844 return -EINVAL; 845 845 846 846 if (new_prog) { 847 - addrs = kzalloc(len * sizeof(*addrs), GFP_KERNEL); 847 + addrs = kcalloc(len, sizeof(*addrs), GFP_KERNEL); 848 848 if (!addrs) 849 849 return -ENOMEM; 850 850 } ··· 1101 1101 1102 1102 BUILD_BUG_ON(BPF_MEMWORDS > 16); 1103 1103 1104 - masks = kmalloc(flen * sizeof(*masks), GFP_KERNEL); 1104 + masks = kmalloc_array(flen, sizeof(*masks), GFP_KERNEL); 1105 1105 if (!masks) 1106 1106 return -ENOMEM; 1107 1107 ··· 1382 1382 fp_new = sock_kmalloc(sk, len, GFP_KERNEL); 1383 1383 if (fp_new) { 1384 1384 *fp_new = *fp; 1385 - /* As we're kepping orig_prog in fp_new along, 1385 + /* As we're keeping orig_prog in fp_new along, 1386 1386 * we need to make sure we're not evicting it 1387 1387 * from the old fp. 1388 1388 */ ··· 1524 1524 1525 1525 /** 1526 1526 * sk_unattached_filter_create - create an unattached filter 1527 - * @fprog: the filter program 1528 1527 * @pfp: the unattached filter that is created 1528 + * @fprog: the filter program 1529 1529 * 1530 1530 * Create a filter independent of any socket. We first run some 1531 1531 * sanity checks on it to make sure it does not explode on us later.
+1 -1
net/core/skbuff.c
··· 2993 2993 skb_put(nskb, len), 2994 2994 len, 0); 2995 2995 SKB_GSO_CB(nskb)->csum_start = 2996 - skb_headroom(nskb) + offset; 2996 + skb_headroom(nskb) + doffset; 2997 2997 continue; 2998 2998 } 2999 2999
+5 -9
net/ipv4/ip_tunnel.c
··· 73 73 { 74 74 struct dst_entry *old_dst; 75 75 76 - if (dst) { 77 - if (dst->flags & DST_NOCACHE) 78 - dst = NULL; 79 - else 80 - dst_clone(dst); 81 - } 76 + dst_clone(dst); 82 77 old_dst = xchg((__force struct dst_entry **)&idst->dst, dst); 83 78 dst_release(old_dst); 84 79 } ··· 103 108 104 109 rcu_read_lock(); 105 110 dst = rcu_dereference(this_cpu_ptr(t->dst_cache)->dst); 111 + if (dst && !atomic_inc_not_zero(&dst->__refcnt)) 112 + dst = NULL; 106 113 if (dst) { 107 114 if (dst->obsolete && dst->ops->check(dst, cookie) == NULL) { 108 - rcu_read_unlock(); 109 115 tunnel_dst_reset(t); 110 - return NULL; 116 + dst_release(dst); 117 + dst = NULL; 111 118 } 112 - dst_hold(dst); 113 119 } 114 120 rcu_read_unlock(); 115 121 return (struct rtable *)dst;
+1 -1
net/ipv4/tcp_fastopen.c
··· 131 131 struct dst_entry *dst, 132 132 struct request_sock *req) 133 133 { 134 - struct tcp_sock *tp = tcp_sk(sk); 134 + struct tcp_sock *tp; 135 135 struct request_sock_queue *queue = &inet_csk(sk)->icsk_accept_queue; 136 136 struct sock *child; 137 137
+1 -1
net/ipv4/tcp_input.c
··· 1162 1162 unsigned int new_len = (pkt_len / mss) * mss; 1163 1163 if (!in_sack && new_len < pkt_len) { 1164 1164 new_len += mss; 1165 - if (new_len > skb->len) 1165 + if (new_len >= skb->len) 1166 1166 return 0; 1167 1167 } 1168 1168 pkt_len = new_len;
+1 -1
net/netfilter/ipvs/ip_vs_ctl.c
··· 3778 3778 cancel_delayed_work_sync(&ipvs->defense_work); 3779 3779 cancel_work_sync(&ipvs->defense_work.work); 3780 3780 unregister_net_sysctl_table(ipvs->sysctl_hdr); 3781 + ip_vs_stop_estimator(net, &ipvs->tot_stats); 3781 3782 } 3782 3783 3783 3784 #else ··· 3841 3840 struct netns_ipvs *ipvs = net_ipvs(net); 3842 3841 3843 3842 ip_vs_trash_cleanup(net); 3844 - ip_vs_stop_estimator(net, &ipvs->tot_stats); 3845 3843 ip_vs_control_net_cleanup_sysctl(net); 3846 3844 remove_proc_entry("ip_vs_stats_percpu", net->proc_net); 3847 3845 remove_proc_entry("ip_vs_stats", net->proc_net);
+13 -7
net/netfilter/nf_conntrack_netlink.c
··· 597 597 #ifdef CONFIG_NF_CONNTRACK_MARK 598 598 + nla_total_size(sizeof(u_int32_t)) /* CTA_MARK */ 599 599 #endif 600 + #ifdef CONFIG_NF_CONNTRACK_ZONES 601 + + nla_total_size(sizeof(u_int16_t)) /* CTA_ZONE */ 602 + #endif 600 603 + ctnetlink_proto_size(ct) 601 604 + ctnetlink_label_size(ct) 602 605 ; ··· 1153 1150 static int 1154 1151 ctnetlink_dump_list(struct sk_buff *skb, struct netlink_callback *cb, bool dying) 1155 1152 { 1156 - struct nf_conn *ct, *last = NULL; 1153 + struct nf_conn *ct, *last; 1157 1154 struct nf_conntrack_tuple_hash *h; 1158 1155 struct hlist_nulls_node *n; 1159 1156 struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh); ··· 1166 1163 if (cb->args[2]) 1167 1164 return 0; 1168 1165 1169 - if (cb->args[0] == nr_cpu_ids) 1170 - return 0; 1166 + last = (struct nf_conn *)cb->args[1]; 1171 1167 1172 1168 for (cpu = cb->args[0]; cpu < nr_cpu_ids; cpu++) { 1173 1169 struct ct_pcpu *pcpu; ··· 1176 1174 1177 1175 pcpu = per_cpu_ptr(net->ct.pcpu_lists, cpu); 1178 1176 spin_lock_bh(&pcpu->lock); 1179 - last = (struct nf_conn *)cb->args[1]; 1180 1177 list = dying ? &pcpu->dying : &pcpu->unconfirmed; 1181 1178 restart: 1182 1179 hlist_nulls_for_each_entry(h, n, list, hnnode) { ··· 1194 1193 ct); 1195 1194 rcu_read_unlock(); 1196 1195 if (res < 0) { 1197 - nf_conntrack_get(&ct->ct_general); 1196 + if (!atomic_inc_not_zero(&ct->ct_general.use)) 1197 + continue; 1198 + cb->args[0] = cpu; 1198 1199 cb->args[1] = (unsigned long)ct; 1199 1200 spin_unlock_bh(&pcpu->lock); 1200 1201 goto out; ··· 1205 1202 if (cb->args[1]) { 1206 1203 cb->args[1] = 0; 1207 1204 goto restart; 1208 - } else 1209 - cb->args[2] = 1; 1205 + } 1210 1206 spin_unlock_bh(&pcpu->lock); 1211 1207 } 1208 + cb->args[2] = 1; 1212 1209 out: 1213 1210 if (last) 1214 1211 nf_ct_put(last); ··· 2042 2039 #endif 2043 2040 #ifdef CONFIG_NF_CONNTRACK_MARK 2044 2041 + nla_total_size(sizeof(u_int32_t)) /* CTA_MARK */ 2042 + #endif 2043 + #ifdef CONFIG_NF_CONNTRACK_ZONES 2044 + + nla_total_size(sizeof(u_int16_t)) /* CTA_ZONE */ 2045 2045 #endif 2046 2046 + ctnetlink_proto_size(ct) 2047 2047 ;
+34 -1
net/netfilter/nf_nat_core.c
··· 525 525 return i->status & IPS_NAT_MASK ? 1 : 0; 526 526 } 527 527 528 + static int nf_nat_proto_clean(struct nf_conn *ct, void *data) 529 + { 530 + struct nf_conn_nat *nat = nfct_nat(ct); 531 + 532 + if (nf_nat_proto_remove(ct, data)) 533 + return 1; 534 + 535 + if (!nat || !nat->ct) 536 + return 0; 537 + 538 + /* This netns is being destroyed, and conntrack has nat null binding. 539 + * Remove it from bysource hash, as the table will be freed soon. 540 + * 541 + * Else, when the conntrack is destoyed, nf_nat_cleanup_conntrack() 542 + * will delete entry from already-freed table. 543 + */ 544 + if (!del_timer(&ct->timeout)) 545 + return 1; 546 + 547 + spin_lock_bh(&nf_nat_lock); 548 + hlist_del_rcu(&nat->bysource); 549 + ct->status &= ~IPS_NAT_DONE_MASK; 550 + nat->ct = NULL; 551 + spin_unlock_bh(&nf_nat_lock); 552 + 553 + add_timer(&ct->timeout); 554 + 555 + /* don't delete conntrack. Although that would make things a lot 556 + * simpler, we'd end up flushing all conntracks on nat rmmod. 557 + */ 558 + return 0; 559 + } 560 + 528 561 static void nf_nat_l4proto_clean(u8 l3proto, u8 l4proto) 529 562 { 530 563 struct nf_nat_proto_clean clean = { ··· 828 795 { 829 796 struct nf_nat_proto_clean clean = {}; 830 797 831 - nf_ct_iterate_cleanup(net, &nf_nat_proto_remove, &clean, 0, 0); 798 + nf_ct_iterate_cleanup(net, nf_nat_proto_clean, &clean, 0, 0); 832 799 synchronize_rcu(); 833 800 nf_ct_free_hashtable(net->ct.nat_bysource, net->ct.nat_htable_size); 834 801 }
+8 -3
net/netfilter/nf_tables_api.c
··· 1730 1730 if (!create || nlh->nlmsg_flags & NLM_F_REPLACE) 1731 1731 return -EINVAL; 1732 1732 handle = nf_tables_alloc_handle(table); 1733 + 1734 + if (chain->use == UINT_MAX) 1735 + return -EOVERFLOW; 1733 1736 } 1734 1737 1735 1738 if (nla[NFTA_RULE_POSITION]) { ··· 1792 1789 1793 1790 if (nlh->nlmsg_flags & NLM_F_REPLACE) { 1794 1791 if (nft_rule_is_active_next(net, old_rule)) { 1795 - trans = nft_trans_rule_add(&ctx, NFT_MSG_NEWRULE, 1792 + trans = nft_trans_rule_add(&ctx, NFT_MSG_DELRULE, 1796 1793 old_rule); 1797 1794 if (trans == NULL) { 1798 1795 err = -ENOMEM; 1799 1796 goto err2; 1800 1797 } 1801 1798 nft_rule_disactivate_next(net, old_rule); 1802 - list_add_tail(&rule->list, &old_rule->list); 1799 + chain->use--; 1800 + list_add_tail_rcu(&rule->list, &old_rule->list); 1803 1801 } else { 1804 1802 err = -ENOENT; 1805 1803 goto err2; ··· 1830 1826 list_del_rcu(&nft_trans_rule(trans)->list); 1831 1827 nft_rule_clear(net, nft_trans_rule(trans)); 1832 1828 nft_trans_destroy(trans); 1829 + chain->use++; 1833 1830 } 1834 1831 err2: 1835 1832 nf_tables_rule_destroy(&ctx, rule); ··· 2850 2845 goto nla_put_failure; 2851 2846 2852 2847 nfmsg = nlmsg_data(nlh); 2853 - nfmsg->nfgen_family = NFPROTO_UNSPEC; 2848 + nfmsg->nfgen_family = ctx.afi->family; 2854 2849 nfmsg->version = NFNETLINK_V0; 2855 2850 nfmsg->res_id = 0; 2856 2851
+18
net/netfilter/nft_compat.c
··· 195 195 nft_target_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) 196 196 { 197 197 struct xt_target *target = expr->ops->data; 198 + void *info = nft_expr_priv(expr); 199 + struct xt_tgdtor_param par; 200 + 201 + par.net = ctx->net; 202 + par.target = target; 203 + par.targinfo = info; 204 + par.family = ctx->afi->family; 205 + if (par.target->destroy != NULL) 206 + par.target->destroy(&par); 198 207 199 208 module_put(target->me); 200 209 } ··· 391 382 nft_match_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) 392 383 { 393 384 struct xt_match *match = expr->ops->data; 385 + void *info = nft_expr_priv(expr); 386 + struct xt_mtdtor_param par; 387 + 388 + par.net = ctx->net; 389 + par.match = match; 390 + par.matchinfo = info; 391 + par.family = ctx->afi->family; 392 + if (par.match->destroy != NULL) 393 + par.match->destroy(&par); 394 394 395 395 module_put(match->me); 396 396 }
+8 -6
net/netfilter/nft_nat.c
··· 175 175 if (nla_put_be32(skb, 176 176 NFTA_NAT_REG_ADDR_MAX, htonl(priv->sreg_addr_max))) 177 177 goto nla_put_failure; 178 - if (nla_put_be32(skb, 179 - NFTA_NAT_REG_PROTO_MIN, htonl(priv->sreg_proto_min))) 180 - goto nla_put_failure; 181 - if (nla_put_be32(skb, 182 - NFTA_NAT_REG_PROTO_MAX, htonl(priv->sreg_proto_max))) 183 - goto nla_put_failure; 178 + if (priv->sreg_proto_min) { 179 + if (nla_put_be32(skb, NFTA_NAT_REG_PROTO_MIN, 180 + htonl(priv->sreg_proto_min))) 181 + goto nla_put_failure; 182 + if (nla_put_be32(skb, NFTA_NAT_REG_PROTO_MAX, 183 + htonl(priv->sreg_proto_max))) 184 + goto nla_put_failure; 185 + } 184 186 return 0; 185 187 186 188 nla_put_failure:
+24 -22
net/sctp/sysctl.c
··· 321 321 loff_t *ppos) 322 322 { 323 323 struct net *net = current->nsproxy->net_ns; 324 - char tmp[8]; 325 324 struct ctl_table tbl; 326 - int ret; 327 - int changed = 0; 325 + bool changed = false; 328 326 char *none = "none"; 327 + char tmp[8]; 328 + int ret; 329 329 330 330 memset(&tbl, 0, sizeof(struct ctl_table)); 331 331 332 332 if (write) { 333 333 tbl.data = tmp; 334 - tbl.maxlen = 8; 334 + tbl.maxlen = sizeof(tmp); 335 335 } else { 336 336 tbl.data = net->sctp.sctp_hmac_alg ? : none; 337 337 tbl.maxlen = strlen(tbl.data); 338 338 } 339 - ret = proc_dostring(&tbl, write, buffer, lenp, ppos); 340 339 341 - if (write) { 340 + ret = proc_dostring(&tbl, write, buffer, lenp, ppos); 341 + if (write && ret == 0) { 342 342 #ifdef CONFIG_CRYPTO_MD5 343 343 if (!strncmp(tmp, "md5", 3)) { 344 344 net->sctp.sctp_hmac_alg = "md5"; 345 - changed = 1; 345 + changed = true; 346 346 } 347 347 #endif 348 348 #ifdef CONFIG_CRYPTO_SHA1 349 349 if (!strncmp(tmp, "sha1", 4)) { 350 350 net->sctp.sctp_hmac_alg = "sha1"; 351 - changed = 1; 351 + changed = true; 352 352 } 353 353 #endif 354 354 if (!strncmp(tmp, "none", 4)) { 355 355 net->sctp.sctp_hmac_alg = NULL; 356 - changed = 1; 356 + changed = true; 357 357 } 358 - 359 358 if (!changed) 360 359 ret = -EINVAL; 361 360 } ··· 367 368 loff_t *ppos) 368 369 { 369 370 struct net *net = current->nsproxy->net_ns; 370 - int new_value; 371 - struct ctl_table tbl; 372 371 unsigned int min = *(unsigned int *) ctl->extra1; 373 372 unsigned int max = *(unsigned int *) ctl->extra2; 374 - int ret; 373 + struct ctl_table tbl; 374 + int ret, new_value; 375 375 376 376 memset(&tbl, 0, sizeof(struct ctl_table)); 377 377 tbl.maxlen = sizeof(unsigned int); ··· 379 381 tbl.data = &new_value; 380 382 else 381 383 tbl.data = &net->sctp.rto_min; 384 + 382 385 ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); 383 - if (write) { 384 - if (ret || new_value > max || new_value < min) 386 + if (write && ret == 0) { 387 + if (new_value > max || new_value < min) 385 388 return -EINVAL; 389 + 386 390 net->sctp.rto_min = new_value; 387 391 } 392 + 388 393 return ret; 389 394 } 390 395 ··· 396 395 loff_t *ppos) 397 396 { 398 397 struct net *net = current->nsproxy->net_ns; 399 - int new_value; 400 - struct ctl_table tbl; 401 398 unsigned int min = *(unsigned int *) ctl->extra1; 402 399 unsigned int max = *(unsigned int *) ctl->extra2; 403 - int ret; 400 + struct ctl_table tbl; 401 + int ret, new_value; 404 402 405 403 memset(&tbl, 0, sizeof(struct ctl_table)); 406 404 tbl.maxlen = sizeof(unsigned int); ··· 408 408 tbl.data = &new_value; 409 409 else 410 410 tbl.data = &net->sctp.rto_max; 411 + 411 412 ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); 412 - if (write) { 413 - if (ret || new_value > max || new_value < min) 413 + if (write && ret == 0) { 414 + if (new_value > max || new_value < min) 414 415 return -EINVAL; 416 + 415 417 net->sctp.rto_max = new_value; 416 418 } 419 + 417 420 return ret; 418 421 } 419 422 ··· 447 444 tbl.data = &net->sctp.auth_enable; 448 445 449 446 ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); 450 - 451 - if (write) { 447 + if (write && ret == 0) { 452 448 struct sock *sk = net->sctp.ctl_sock; 453 449 454 450 net->sctp.auth_enable = new_value;