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-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (34 commits)
net: Add support for SMSC LAN9530, LAN9730 and LAN89530
mlx4_en: Restoring RX buffer pointer in case of failure
mlx4: Sensing link type at device initialization
ipv4: Fix "Set rt->rt_iif more sanely on output routes."
MAINTAINERS: add entry for Xen network backend
be2net: Fix suspend/resume operation
be2net: Rename some struct members for clarity
pppoe: drop PPPOX_ZOMBIEs in pppoe_flush_dev
dsa/mv88e6131: add support for mv88e6085 switch
ipv6: Enable RFS sk_rxhash tracking for ipv6 sockets (v2)
be2net: Fix a potential crash during shutdown.
bna: Fix for handling firmware heartbeat failure
can: mcp251x: Allow pass IRQ flags through platform data.
smsc911x: fix mac_lock acquision before calling smsc911x_mac_read
iwlwifi: accept EEPROM version 0x423 for iwl6000
rt2x00: fix cancelling uninitialized work
rtlwifi: Fix some warnings/bugs
p54usb: IDs for two new devices
wl12xx: fix potential buffer overflow in testmode nvs push
zd1211rw: reset rx idle timer from tasklet
...

+301 -164
+7
MAINTAINERS
··· 6916 6916 S: Maintained 6917 6917 F: drivers/platform/x86 6918 6918 6919 + XEN NETWORK BACKEND DRIVER 6920 + M: Ian Campbell <ian.campbell@citrix.com> 6921 + L: xen-devel@lists.xensource.com (moderated for non-subscribers) 6922 + L: netdev@vger.kernel.org 6923 + S: Supported 6924 + F: drivers/net/xen-netback/* 6925 + 6919 6926 XEN PCI SUBSYSTEM 6920 6927 M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> 6921 6928 L: xen-devel@lists.xensource.com (moderated for non-subscribers)
+2 -2
drivers/net/benet/be.h
··· 154 154 u16 min_eqd; /* in usecs */ 155 155 u16 max_eqd; /* in usecs */ 156 156 u16 cur_eqd; /* in usecs */ 157 - u8 msix_vec_idx; 157 + u8 eq_idx; 158 158 159 159 struct napi_struct napi; 160 160 }; ··· 291 291 u32 num_rx_qs; 292 292 u32 big_page_size; /* Compounded page size shared by rx wrbs */ 293 293 294 - u8 msix_vec_next_idx; 294 + u8 eq_next_idx; 295 295 struct be_drv_stats drv_stats; 296 296 297 297 struct vlan_group *vlan_grp;
+11 -8
drivers/net/benet/be_main.c
··· 1497 1497 if (be_cmd_eq_create(adapter, eq, adapter->tx_eq.cur_eqd)) 1498 1498 goto tx_eq_free; 1499 1499 1500 - adapter->tx_eq.msix_vec_idx = adapter->msix_vec_next_idx++; 1500 + adapter->tx_eq.eq_idx = adapter->eq_next_idx++; 1501 1501 1502 1502 1503 1503 /* Alloc TX eth compl queue */ ··· 1590 1590 if (rc) 1591 1591 goto err; 1592 1592 1593 - rxo->rx_eq.msix_vec_idx = adapter->msix_vec_next_idx++; 1593 + rxo->rx_eq.eq_idx = adapter->eq_next_idx++; 1594 1594 1595 1595 /* CQ */ 1596 1596 cq = &rxo->cq; ··· 1666 1666 if (!isr) 1667 1667 return IRQ_NONE; 1668 1668 1669 - if ((1 << adapter->tx_eq.msix_vec_idx & isr)) 1669 + if ((1 << adapter->tx_eq.eq_idx & isr)) 1670 1670 event_handle(adapter, &adapter->tx_eq); 1671 1671 1672 1672 for_all_rx_queues(adapter, rxo, i) { 1673 - if ((1 << rxo->rx_eq.msix_vec_idx & isr)) 1673 + if ((1 << rxo->rx_eq.eq_idx & isr)) 1674 1674 event_handle(adapter, &rxo->rx_eq); 1675 1675 } 1676 1676 } ··· 1951 1951 static inline int be_msix_vec_get(struct be_adapter *adapter, 1952 1952 struct be_eq_obj *eq_obj) 1953 1953 { 1954 - return adapter->msix_entries[eq_obj->msix_vec_idx].vector; 1954 + return adapter->msix_entries[eq_obj->eq_idx].vector; 1955 1955 } 1956 1956 1957 1957 static int be_request_irq(struct be_adapter *adapter, ··· 2345 2345 be_mcc_queues_destroy(adapter); 2346 2346 be_rx_queues_destroy(adapter); 2347 2347 be_tx_queues_destroy(adapter); 2348 + adapter->eq_next_idx = 0; 2348 2349 2349 2350 if (be_physfn(adapter) && adapter->sriov_enabled) 2350 2351 for (vf = 0; vf < num_vfs; vf++) ··· 3142 3141 static void be_shutdown(struct pci_dev *pdev) 3143 3142 { 3144 3143 struct be_adapter *adapter = pci_get_drvdata(pdev); 3145 - struct net_device *netdev = adapter->netdev; 3146 3144 3147 - if (netif_running(netdev)) 3145 + if (!adapter) 3146 + return; 3147 + 3148 + if (netif_running(adapter->netdev)) 3148 3149 cancel_delayed_work_sync(&adapter->work); 3149 3150 3150 - netif_device_detach(netdev); 3151 + netif_device_detach(adapter->netdev); 3151 3152 3152 3153 be_cmd_reset_function(adapter); 3153 3154
+3 -7
drivers/net/bna/bfa_ioc.c
··· 2219 2219 static void 2220 2220 bfa_ioc_recover(struct bfa_ioc *ioc) 2221 2221 { 2222 - u16 bdf; 2223 - 2224 - bdf = (ioc->pcidev.pci_slot << 8 | ioc->pcidev.pci_func << 3 | 2225 - ioc->pcidev.device_id); 2226 - 2227 - pr_crit("Firmware heartbeat failure at %d", bdf); 2228 - BUG_ON(1); 2222 + pr_crit("Heart Beat of IOC has failed\n"); 2223 + bfa_ioc_stats(ioc, ioc_hbfails); 2224 + bfa_fsm_send_event(ioc, IOC_E_HBFAIL); 2229 2225 } 2230 2226 2231 2227 static void
+2 -1
drivers/net/can/mcp251x.c
··· 931 931 priv->tx_len = 0; 932 932 933 933 ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist, 934 - IRQF_TRIGGER_FALLING, DEVICE_NAME, priv); 934 + pdata->irq_flags ? pdata->irq_flags : IRQF_TRIGGER_FALLING, 935 + DEVICE_NAME, priv); 935 936 if (ret) { 936 937 dev_err(&spi->dev, "failed to acquire irq %d\n", spi->irq); 937 938 if (pdata->transceiver_enable)
+4
drivers/net/mlx4/en_rx.c
··· 345 345 err = mlx4_en_init_allocator(priv, ring); 346 346 if (err) { 347 347 en_err(priv, "Failed initializing ring allocator\n"); 348 + if (ring->stride <= TXBB_SIZE) 349 + ring->buf -= TXBB_SIZE; 348 350 ring_ind--; 349 351 goto err_allocator; 350 352 } ··· 371 369 ring_ind = priv->rx_ring_num - 1; 372 370 err_allocator: 373 371 while (ring_ind >= 0) { 372 + if (priv->rx_ring[ring_ind].stride <= TXBB_SIZE) 373 + priv->rx_ring[ring_ind].buf -= TXBB_SIZE; 374 374 mlx4_en_destroy_allocator(priv, &priv->rx_ring[ring_ind]); 375 375 ring_ind--; 376 376 }
+5
drivers/net/mlx4/main.c
··· 944 944 } 945 945 946 946 for (port = 1; port <= dev->caps.num_ports; port++) { 947 + enum mlx4_port_type port_type = 0; 948 + mlx4_SENSE_PORT(dev, port, &port_type); 949 + if (port_type) 950 + dev->caps.port_type[port] = port_type; 947 951 ib_port_default_caps = 0; 948 952 err = mlx4_get_port_ib_caps(dev, port, &ib_port_default_caps); 949 953 if (err) ··· 962 958 goto err_mcg_table_free; 963 959 } 964 960 } 961 + mlx4_set_port_mask(dev); 965 962 966 963 return 0; 967 964
+2
drivers/net/mlx4/mlx4.h
··· 431 431 432 432 void mlx4_handle_catas_err(struct mlx4_dev *dev); 433 433 434 + int mlx4_SENSE_PORT(struct mlx4_dev *dev, int port, 435 + enum mlx4_port_type *type); 434 436 void mlx4_do_sense_ports(struct mlx4_dev *dev, 435 437 enum mlx4_port_type *stype, 436 438 enum mlx4_port_type *defaults);
+2 -2
drivers/net/mlx4/sense.c
··· 38 38 39 39 #include "mlx4.h" 40 40 41 - static int mlx4_SENSE_PORT(struct mlx4_dev *dev, int port, 42 - enum mlx4_port_type *type) 41 + int mlx4_SENSE_PORT(struct mlx4_dev *dev, int port, 42 + enum mlx4_port_type *type) 43 43 { 44 44 u64 out_param; 45 45 int err = 0;
+1 -1
drivers/net/pppoe.c
··· 317 317 lock_sock(sk); 318 318 319 319 if (po->pppoe_dev == dev && 320 - sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { 320 + sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) { 321 321 pppox_unbind_sock(sk); 322 322 sk->sk_state = PPPOX_ZOMBIE; 323 323 sk->sk_state_change(sk);
+5 -3
drivers/net/smsc911x.c
··· 1818 1818 SMSC_TRACE(PROBE, "PHY will be autodetected."); 1819 1819 1820 1820 spin_lock_init(&pdata->dev_lock); 1821 + spin_lock_init(&pdata->mac_lock); 1821 1822 1822 1823 if (pdata->ioaddr == 0) { 1823 1824 SMSC_WARNING(PROBE, "pdata->ioaddr: 0x00000000"); ··· 1896 1895 /* workaround for platforms without an eeprom, where the mac address 1897 1896 * is stored elsewhere and set by the bootloader. This saves the 1898 1897 * mac address before resetting the device */ 1899 - if (pdata->config.flags & SMSC911X_SAVE_MAC_ADDRESS) 1898 + if (pdata->config.flags & SMSC911X_SAVE_MAC_ADDRESS) { 1899 + spin_lock_irq(&pdata->mac_lock); 1900 1900 smsc911x_read_mac_address(dev); 1901 + spin_unlock_irq(&pdata->mac_lock); 1902 + } 1901 1903 1902 1904 /* Reset the LAN911x */ 1903 1905 if (smsc911x_soft_reset(pdata)) ··· 2062 2058 } else { 2063 2059 SMSC_TRACE(PROBE, "Network interface: \"%s\"", dev->name); 2064 2060 } 2065 - 2066 - spin_lock_init(&pdata->mac_lock); 2067 2061 2068 2062 retval = smsc911x_mii_init(pdev, dev); 2069 2063 if (retval) {
+15
drivers/net/usb/smsc95xx.c
··· 1313 1313 USB_DEVICE(0x0424, 0x9909), 1314 1314 .driver_info = (unsigned long) &smsc95xx_info, 1315 1315 }, 1316 + { 1317 + /* SMSC LAN9530 USB Ethernet Device */ 1318 + USB_DEVICE(0x0424, 0x9530), 1319 + .driver_info = (unsigned long) &smsc95xx_info, 1320 + }, 1321 + { 1322 + /* SMSC LAN9730 USB Ethernet Device */ 1323 + USB_DEVICE(0x0424, 0x9730), 1324 + .driver_info = (unsigned long) &smsc95xx_info, 1325 + }, 1326 + { 1327 + /* SMSC LAN89530 USB Ethernet Device */ 1328 + USB_DEVICE(0x0424, 0x9E08), 1329 + .driver_info = (unsigned long) &smsc95xx_info, 1330 + }, 1316 1331 { }, /* END */ 1317 1332 }; 1318 1333 MODULE_DEVICE_TABLE(usb, products);
+1
drivers/net/wireless/ath/ath9k/hw.c
··· 2546 2546 { AR_SREV_VERSION_9287, "9287" }, 2547 2547 { AR_SREV_VERSION_9271, "9271" }, 2548 2548 { AR_SREV_VERSION_9300, "9300" }, 2549 + { AR_SREV_VERSION_9485, "9485" }, 2549 2550 }; 2550 2551 2551 2552 /* For devices with external radios */
+1 -1
drivers/net/wireless/b43/dma.c
··· 1536 1536 dmaaddr = meta->dmaaddr; 1537 1537 goto drop_recycle_buffer; 1538 1538 } 1539 - if (unlikely(len > ring->rx_buffersize)) { 1539 + if (unlikely(len + ring->frameoffset > ring->rx_buffersize)) { 1540 1540 /* The data did not fit into one descriptor buffer 1541 1541 * and is split over multiple buffers. 1542 1542 * This should never happen, as we try to allocate buffers
+1 -1
drivers/net/wireless/b43/dma.h
··· 163 163 /* DMA engine tuning knobs */ 164 164 #define B43_TXRING_SLOTS 256 165 165 #define B43_RXRING_SLOTS 64 166 - #define B43_DMA0_RX_BUFFERSIZE IEEE80211_MAX_FRAME_LEN 166 + #define B43_DMA0_RX_BUFFERSIZE (B43_DMA0_RX_FRAMEOFFSET + IEEE80211_MAX_FRAME_LEN) 167 167 168 168 /* Pointer poison */ 169 169 #define B43_DMA_PTR_POISON ((void *)ERR_PTR(-ENOMEM))
+1 -1
drivers/net/wireless/iwlwifi/iwl-eeprom.h
··· 241 241 242 242 /* 6x00 Specific */ 243 243 #define EEPROM_6000_TX_POWER_VERSION (4) 244 - #define EEPROM_6000_EEPROM_VERSION (0x434) 244 + #define EEPROM_6000_EEPROM_VERSION (0x423) 245 245 246 246 /* 6x50 Specific */ 247 247 #define EEPROM_6050_TX_POWER_VERSION (4)
+2
drivers/net/wireless/p54/p54usb.c
··· 56 56 {USB_DEVICE(0x0846, 0x4210)}, /* Netgear WG121 the second ? */ 57 57 {USB_DEVICE(0x0846, 0x4220)}, /* Netgear WG111 */ 58 58 {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ 59 + {USB_DEVICE(0x0bf8, 0x1007)}, /* Fujitsu E-5400 USB */ 59 60 {USB_DEVICE(0x0cde, 0x0006)}, /* Medion 40900, Roper Europe */ 60 61 {USB_DEVICE(0x0db0, 0x6826)}, /* MSI UB54G (MS-6826) */ 61 62 {USB_DEVICE(0x107b, 0x55f2)}, /* Gateway WGU-210 (Gemtek) */ ··· 69 68 {USB_DEVICE(0x1915, 0x2235)}, /* Linksys WUSB54G Portable OEM */ 70 69 {USB_DEVICE(0x2001, 0x3701)}, /* DLink DWL-G120 Spinnaker */ 71 70 {USB_DEVICE(0x2001, 0x3703)}, /* DLink DWL-G122 */ 71 + {USB_DEVICE(0x2001, 0x3762)}, /* Conceptronic C54U */ 72 72 {USB_DEVICE(0x5041, 0x2234)}, /* Linksys WUSB54G */ 73 73 {USB_DEVICE(0x5041, 0x2235)}, /* Linksys WUSB54G Portable */ 74 74
+4 -2
drivers/net/wireless/rt2x00/rt2x00dev.c
··· 1062 1062 * Stop all work. 1063 1063 */ 1064 1064 cancel_work_sync(&rt2x00dev->intf_work); 1065 - cancel_work_sync(&rt2x00dev->rxdone_work); 1066 - cancel_work_sync(&rt2x00dev->txdone_work); 1065 + if (rt2x00_is_usb(rt2x00dev)) { 1066 + cancel_work_sync(&rt2x00dev->rxdone_work); 1067 + cancel_work_sync(&rt2x00dev->txdone_work); 1068 + } 1067 1069 destroy_workqueue(rt2x00dev->workqueue); 1068 1070 1069 1071 /*
+1 -1
drivers/net/wireless/rtlwifi/efuse.c
··· 685 685 686 686 u8 efuse_data, word_cnts = 0; 687 687 u16 efuse_addr = 0; 688 - u8 hworden; 688 + u8 hworden = 0; 689 689 u8 tmpdata[8]; 690 690 691 691 if (data == NULL)
+1 -1
drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
··· 303 303 u16 box_reg, box_extreg; 304 304 u8 u1b_tmp; 305 305 bool isfw_read = false; 306 - u8 buf_index; 306 + u8 buf_index = 0; 307 307 bool bwrite_sucess = false; 308 308 u8 wait_h2c_limmit = 100; 309 309 u8 wait_writeh2c_limmit = 100;
+1 -1
drivers/net/wireless/rtlwifi/usb.c
··· 246 246 247 247 static void _rtl_usb_io_handler_release(struct ieee80211_hw *hw) 248 248 { 249 - struct rtl_priv *rtlpriv = rtl_priv(hw); 249 + struct rtl_priv __maybe_unused *rtlpriv = rtl_priv(hw); 250 250 251 251 mutex_destroy(&rtlpriv->io.bb_mutex); 252 252 }
+1 -1
drivers/net/wireless/wl12xx/sdio.c
··· 340 340 module_exit(wl1271_exit); 341 341 342 342 MODULE_LICENSE("GPL"); 343 - MODULE_AUTHOR("Luciano Coelho <luciano.coelho@nokia.com>"); 343 + MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>"); 344 344 MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>"); 345 345 MODULE_FIRMWARE(WL1271_FW_NAME); 346 346 MODULE_FIRMWARE(WL1271_AP_FW_NAME);
+1 -1
drivers/net/wireless/wl12xx/spi.c
··· 487 487 module_exit(wl1271_exit); 488 488 489 489 MODULE_LICENSE("GPL"); 490 - MODULE_AUTHOR("Luciano Coelho <luciano.coelho@nokia.com>"); 490 + MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>"); 491 491 MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>"); 492 492 MODULE_FIRMWARE(WL1271_FW_NAME); 493 493 MODULE_FIRMWARE(WL1271_AP_FW_NAME);
+4 -1
drivers/net/wireless/wl12xx/testmode.c
··· 204 204 205 205 kfree(wl->nvs); 206 206 207 - wl->nvs = kzalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL); 207 + if (len != sizeof(struct wl1271_nvs_file)) 208 + return -EINVAL; 209 + 210 + wl->nvs = kzalloc(len, GFP_KERNEL); 208 211 if (!wl->nvs) { 209 212 wl1271_error("could not allocate memory for the nvs file"); 210 213 ret = -ENOMEM;
+18 -2
drivers/net/wireless/zd1211rw/zd_usb.c
··· 643 643 usb = urb->context; 644 644 rx = &usb->rx; 645 645 646 - zd_usb_reset_rx_idle_timer(usb); 646 + tasklet_schedule(&rx->reset_timer_tasklet); 647 647 648 648 if (length%rx->usb_packet_size > rx->usb_packet_size-4) { 649 649 /* If there is an old first fragment, we don't care. */ ··· 812 812 __zd_usb_disable_rx(usb); 813 813 mutex_unlock(&rx->setup_mutex); 814 814 815 + tasklet_kill(&rx->reset_timer_tasklet); 815 816 cancel_delayed_work_sync(&rx->idle_work); 816 817 } 817 818 ··· 1107 1106 zd_usb_reset_rx(usb); 1108 1107 } 1109 1108 1109 + static void zd_usb_reset_rx_idle_timer_tasklet(unsigned long param) 1110 + { 1111 + struct zd_usb *usb = (struct zd_usb *)param; 1112 + 1113 + zd_usb_reset_rx_idle_timer(usb); 1114 + } 1115 + 1110 1116 void zd_usb_reset_rx_idle_timer(struct zd_usb *usb) 1111 1117 { 1112 1118 struct zd_usb_rx *rx = &usb->rx; ··· 1135 1127 static inline void init_usb_rx(struct zd_usb *usb) 1136 1128 { 1137 1129 struct zd_usb_rx *rx = &usb->rx; 1130 + 1138 1131 spin_lock_init(&rx->lock); 1139 1132 mutex_init(&rx->setup_mutex); 1140 1133 if (interface_to_usbdev(usb->intf)->speed == USB_SPEED_HIGH) { ··· 1145 1136 } 1146 1137 ZD_ASSERT(rx->fragment_length == 0); 1147 1138 INIT_DELAYED_WORK(&rx->idle_work, zd_rx_idle_timer_handler); 1139 + rx->reset_timer_tasklet.func = zd_usb_reset_rx_idle_timer_tasklet; 1140 + rx->reset_timer_tasklet.data = (unsigned long)usb; 1148 1141 } 1149 1142 1150 1143 static inline void init_usb_tx(struct zd_usb *usb) 1151 1144 { 1152 1145 struct zd_usb_tx *tx = &usb->tx; 1146 + 1153 1147 spin_lock_init(&tx->lock); 1154 1148 atomic_set(&tx->enabled, 0); 1155 1149 tx->stopped = 0; ··· 1683 1671 1684 1672 if (urb->status && !usb->cmd_error) 1685 1673 usb->cmd_error = urb->status; 1674 + 1675 + if (!usb->cmd_error && 1676 + urb->actual_length != urb->transfer_buffer_length) 1677 + usb->cmd_error = -EIO; 1686 1678 } 1687 1679 1688 1680 static int zd_submit_waiting_urb(struct zd_usb *usb, bool last) ··· 1821 1805 usb_fill_int_urb(urb, udev, usb_sndintpipe(udev, EP_REGS_OUT), 1822 1806 req, req_len, iowrite16v_urb_complete, usb, 1823 1807 ep->desc.bInterval); 1824 - urb->transfer_flags |= URB_FREE_BUFFER | URB_SHORT_NOT_OK; 1808 + urb->transfer_flags |= URB_FREE_BUFFER; 1825 1809 1826 1810 /* Submit previous URB */ 1827 1811 r = zd_submit_waiting_urb(usb, false);
+1
drivers/net/wireless/zd1211rw/zd_usb.h
··· 183 183 spinlock_t lock; 184 184 struct mutex setup_mutex; 185 185 struct delayed_work idle_work; 186 + struct tasklet_struct reset_timer_tasklet; 186 187 u8 fragment[2 * USB_MAX_RX_SIZE]; 187 188 unsigned int fragment_length; 188 189 unsigned int usb_packet_size;
+2
include/linux/can/platform/mcp251x.h
··· 12 12 /** 13 13 * struct mcp251x_platform_data - MCP251X SPI CAN controller platform data 14 14 * @oscillator_frequency: - oscillator frequency in Hz 15 + * @irq_flags: - IRQF configuration flags 15 16 * @board_specific_setup: - called before probing the chip (power,reset) 16 17 * @transceiver_enable: - called to power on/off the transceiver 17 18 * @power_enable: - called to power on/off the mcp *and* the ··· 25 24 26 25 struct mcp251x_platform_data { 27 26 unsigned long oscillator_frequency; 27 + unsigned long irq_flags; 28 28 int (*board_specific_setup)(struct spi_device *spi); 29 29 int (*transceiver_enable)(int enable); 30 30 int (*power_enable) (int enable);
+2 -1
include/linux/netfilter.h
··· 270 270 unsigned int dataoff, 271 271 unsigned int len, 272 272 u_int8_t protocol); 273 - int (*route)(struct dst_entry **dst, struct flowi *fl); 273 + int (*route)(struct net *net, struct dst_entry **dst, 274 + struct flowi *fl, bool strict); 274 275 void (*saveroute)(const struct sk_buff *skb, 275 276 struct nf_queue_entry *entry); 276 277 int (*reroute)(struct sk_buff *skb,
+1 -1
include/linux/netfilter/ipset/ip_set.h
··· 293 293 /* Lock protecting the set data */ 294 294 rwlock_t lock; 295 295 /* References to the set */ 296 - atomic_t ref; 296 + u32 ref; 297 297 /* The core set type */ 298 298 struct ip_set_type *type; 299 299 /* The type variant doing the real job */
+1 -2
include/linux/netfilter/ipset/ip_set_ahash.h
··· 515 515 if (h->netmask != HOST_MASK) 516 516 NLA_PUT_U8(skb, IPSET_ATTR_NETMASK, h->netmask); 517 517 #endif 518 - NLA_PUT_NET32(skb, IPSET_ATTR_REFERENCES, 519 - htonl(atomic_read(&set->ref) - 1)); 518 + NLA_PUT_NET32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref - 1)); 520 519 NLA_PUT_NET32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)); 521 520 if (with_timeout(h->timeout)) 522 521 NLA_PUT_NET32(skb, IPSET_ATTR_TIMEOUT, htonl(h->timeout));
+1 -1
include/net/ip_vs.h
··· 52 52 */ 53 53 if (likely(skb->dev && skb->dev->nd_net)) 54 54 return dev_net(skb->dev); 55 - if (skb_dst(skb)->dev) 55 + if (skb_dst(skb) && skb_dst(skb)->dev) 56 56 return dev_net(skb_dst(skb)->dev); 57 57 WARN(skb->sk, "Maybe skb_sknet should be used in %s() at line:%d\n", 58 58 __func__, __LINE__);
+13 -2
include/net/mac80211.h
··· 1753 1753 * that TX/RX_STOP can pass NULL for this parameter. 1754 1754 * The @buf_size parameter is only valid when the action is set to 1755 1755 * %IEEE80211_AMPDU_TX_OPERATIONAL and indicates the peer's reorder 1756 - * buffer size (number of subframes) for this session -- aggregates 1757 - * containing more subframes than this may not be transmitted to the peer. 1756 + * buffer size (number of subframes) for this session -- the driver 1757 + * may neither send aggregates containing more subframes than this 1758 + * nor send aggregates in a way that lost frames would exceed the 1759 + * buffer size. If just limiting the aggregate size, this would be 1760 + * possible with a buf_size of 8: 1761 + * - TX: 1.....7 1762 + * - RX: 2....7 (lost frame #1) 1763 + * - TX: 8..1... 1764 + * which is invalid since #1 was now re-transmitted well past the 1765 + * buffer size of 8. Correct ways to retransmit #1 would be: 1766 + * - TX: 1 or 18 or 81 1767 + * Even "189" would be wrong since 1 could be lost again. 1768 + * 1758 1769 * Returns a negative error code on failure. 1759 1770 * The callback can sleep. 1760 1771 *
+3 -2
include/net/route.h
··· 64 64 65 65 __be32 rt_dst; /* Path destination */ 66 66 __be32 rt_src; /* Path source */ 67 + int rt_route_iif; 67 68 int rt_iif; 68 69 int rt_oif; 69 70 __u32 rt_mark; ··· 81 80 82 81 static inline bool rt_is_input_route(struct rtable *rt) 83 82 { 84 - return rt->rt_iif != 0; 83 + return rt->rt_route_iif != 0; 85 84 } 86 85 87 86 static inline bool rt_is_output_route(struct rtable *rt) 88 87 { 89 - return rt->rt_iif == 0; 88 + return rt->rt_route_iif == 0; 90 89 } 91 90 92 91 struct ip_rt_acct {
+19 -4
net/dsa/mv88e6131.c
··· 14 14 #include "dsa_priv.h" 15 15 #include "mv88e6xxx.h" 16 16 17 + /* 18 + * Switch product IDs 19 + */ 20 + #define ID_6085 0x04a0 21 + #define ID_6095 0x0950 22 + #define ID_6131 0x1060 23 + 17 24 static char *mv88e6131_probe(struct mii_bus *bus, int sw_addr) 18 25 { 19 26 int ret; ··· 28 21 ret = __mv88e6xxx_reg_read(bus, sw_addr, REG_PORT(0), 0x03); 29 22 if (ret >= 0) { 30 23 ret &= 0xfff0; 31 - if (ret == 0x0950) 24 + if (ret == ID_6085) 25 + return "Marvell 88E6085"; 26 + if (ret == ID_6095) 32 27 return "Marvell 88E6095/88E6095F"; 33 - if (ret == 0x1060) 28 + if (ret == ID_6131) 34 29 return "Marvell 88E6131"; 35 30 } 36 31 ··· 173 164 174 165 static int mv88e6131_setup_port(struct dsa_switch *ds, int p) 175 166 { 167 + struct mv88e6xxx_priv_state *ps = (void *)(ds + 1); 176 168 int addr = REG_PORT(p); 177 169 u16 val; 178 170 ··· 181 171 * MAC Forcing register: don't force link, speed, duplex 182 172 * or flow control state to any particular values on physical 183 173 * ports, but force the CPU port and all DSA ports to 1000 Mb/s 184 - * full duplex. 174 + * (100 Mb/s on 6085) full duplex. 185 175 */ 186 176 if (dsa_is_cpu_port(ds, p) || ds->dsa_port_mask & (1 << p)) 187 - REG_WRITE(addr, 0x01, 0x003e); 177 + if (ps->id == ID_6085) 178 + REG_WRITE(addr, 0x01, 0x003d); /* 100 Mb/s */ 179 + else 180 + REG_WRITE(addr, 0x01, 0x003e); /* 1000 Mb/s */ 188 181 else 189 182 REG_WRITE(addr, 0x01, 0x0003); 190 183 ··· 298 285 mutex_init(&ps->smi_mutex); 299 286 mv88e6xxx_ppu_state_init(ds); 300 287 mutex_init(&ps->stats_mutex); 288 + 289 + ps->id = REG_READ(REG_PORT(0), 0x03) & 0xfff0; 301 290 302 291 ret = mv88e6131_switch_reset(ds); 303 292 if (ret < 0)
+2
net/dsa/mv88e6xxx.h
··· 39 39 * Hold this mutex over snapshot + dump sequences. 40 40 */ 41 41 struct mutex stats_mutex; 42 + 43 + int id; /* switch product id */ 42 44 }; 43 45 44 46 struct mv88e6xxx_hw_stat {
+3 -2
net/ipv4/netfilter.c
··· 221 221 return csum; 222 222 } 223 223 224 - static int nf_ip_route(struct dst_entry **dst, struct flowi *fl) 224 + static int nf_ip_route(struct net *net, struct dst_entry **dst, 225 + struct flowi *fl, bool strict __always_unused) 225 226 { 226 - struct rtable *rt = ip_route_output_key(&init_net, &fl->u.ip4); 227 + struct rtable *rt = ip_route_output_key(net, &fl->u.ip4); 227 228 if (IS_ERR(rt)) 228 229 return PTR_ERR(rt); 229 230 *dst = &rt->dst;
+6 -2
net/ipv4/route.c
··· 1891 1891 #ifdef CONFIG_IP_ROUTE_CLASSID 1892 1892 rth->dst.tclassid = itag; 1893 1893 #endif 1894 + rth->rt_route_iif = dev->ifindex; 1894 1895 rth->rt_iif = dev->ifindex; 1895 1896 rth->dst.dev = init_net.loopback_dev; 1896 1897 dev_hold(rth->dst.dev); ··· 2027 2026 rth->rt_key_src = saddr; 2028 2027 rth->rt_src = saddr; 2029 2028 rth->rt_gateway = daddr; 2029 + rth->rt_route_iif = in_dev->dev->ifindex; 2030 2030 rth->rt_iif = in_dev->dev->ifindex; 2031 2031 rth->dst.dev = (out_dev)->dev; 2032 2032 dev_hold(rth->dst.dev); ··· 2204 2202 #ifdef CONFIG_IP_ROUTE_CLASSID 2205 2203 rth->dst.tclassid = itag; 2206 2204 #endif 2205 + rth->rt_route_iif = dev->ifindex; 2207 2206 rth->rt_iif = dev->ifindex; 2208 2207 rth->dst.dev = net->loopback_dev; 2209 2208 dev_hold(rth->dst.dev); ··· 2404 2401 rth->rt_mark = oldflp4->flowi4_mark; 2405 2402 rth->rt_dst = fl4->daddr; 2406 2403 rth->rt_src = fl4->saddr; 2407 - rth->rt_iif = 0; 2404 + rth->rt_route_iif = 0; 2405 + rth->rt_iif = oldflp4->flowi4_oif ? : dev_out->ifindex; 2408 2406 /* get references to the devices that are to be hold by the routing 2409 2407 cache entry */ 2410 2408 rth->dst.dev = dev_out; ··· 2720 2716 rt->rt_key_dst = ort->rt_key_dst; 2721 2717 rt->rt_key_src = ort->rt_key_src; 2722 2718 rt->rt_tos = ort->rt_tos; 2719 + rt->rt_route_iif = ort->rt_route_iif; 2723 2720 rt->rt_iif = ort->rt_iif; 2724 2721 rt->rt_oif = ort->rt_oif; 2725 2722 rt->rt_mark = ort->rt_mark; ··· 2730 2725 rt->rt_type = ort->rt_type; 2731 2726 rt->rt_dst = ort->rt_dst; 2732 2727 rt->rt_src = ort->rt_src; 2733 - rt->rt_iif = ort->rt_iif; 2734 2728 rt->rt_gateway = ort->rt_gateway; 2735 2729 rt->rt_spec_dst = ort->rt_spec_dst; 2736 2730 rt->peer = ort->peer;
+1
net/ipv4/xfrm4_policy.c
··· 74 74 rt->rt_key_dst = fl4->daddr; 75 75 rt->rt_key_src = fl4->saddr; 76 76 rt->rt_tos = fl4->flowi4_tos; 77 + rt->rt_route_iif = fl4->flowi4_iif; 77 78 rt->rt_iif = fl4->flowi4_iif; 78 79 rt->rt_oif = fl4->flowi4_oif; 79 80 rt->rt_mark = fl4->flowi4_mark;
+11 -2
net/ipv6/netfilter.c
··· 90 90 return 0; 91 91 } 92 92 93 - static int nf_ip6_route(struct dst_entry **dst, struct flowi *fl) 93 + static int nf_ip6_route(struct net *net, struct dst_entry **dst, 94 + struct flowi *fl, bool strict) 94 95 { 95 - *dst = ip6_route_output(&init_net, NULL, &fl->u.ip6); 96 + static const struct ipv6_pinfo fake_pinfo; 97 + static const struct inet_sock fake_sk = { 98 + /* makes ip6_route_output set RT6_LOOKUP_F_IFACE: */ 99 + .sk.sk_bound_dev_if = 1, 100 + .pinet6 = (struct ipv6_pinfo *) &fake_pinfo, 101 + }; 102 + const void *sk = strict ? &fake_sk : NULL; 103 + 104 + *dst = ip6_route_output(net, sk, &fl->u.ip6); 96 105 return (*dst)->error; 97 106 } 98 107
+3 -1
net/ipv6/tcp_ipv6.c
··· 1622 1622 opt_skb = skb_clone(skb, GFP_ATOMIC); 1623 1623 1624 1624 if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ 1625 + sock_rps_save_rxhash(sk, skb->rxhash); 1625 1626 if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) 1626 1627 goto reset; 1627 1628 if (opt_skb) ··· 1650 1649 __kfree_skb(opt_skb); 1651 1650 return 0; 1652 1651 } 1653 - } 1652 + } else 1653 + sock_rps_save_rxhash(sk, skb->rxhash); 1654 1654 1655 1655 if (tcp_rcv_state_process(sk, skb, tcp_hdr(skb), skb->len)) 1656 1656 goto reset;
+3
net/ipv6/udp.c
··· 505 505 int rc; 506 506 int is_udplite = IS_UDPLITE(sk); 507 507 508 + if (!ipv6_addr_any(&inet6_sk(sk)->daddr)) 509 + sock_rps_save_rxhash(sk, skb->rxhash); 510 + 508 511 if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) 509 512 goto drop; 510 513
+1 -1
net/mac80211/rx.c
··· 2541 2541 * same TID from the same station 2542 2542 */ 2543 2543 rx->skb = skb; 2544 - rx->flags = 0; 2545 2544 2546 2545 CALL_RXH(ieee80211_rx_h_decrypt) 2547 2546 CALL_RXH(ieee80211_rx_h_check_more_data) ··· 2611 2612 .sdata = sta->sdata, 2612 2613 .local = sta->local, 2613 2614 .queue = tid, 2615 + .flags = 0, 2614 2616 }; 2615 2617 struct tid_ampdu_rx *tid_agg_rx; 2616 2618
-1
net/netfilter/Kconfig
··· 652 652 config NETFILTER_XT_MATCH_ADDRTYPE 653 653 tristate '"addrtype" address type match support' 654 654 depends on NETFILTER_ADVANCED 655 - depends on (IPV6 || IPV6=n) 656 655 ---help--- 657 656 This option allows you to match what routing thinks of an address, 658 657 eg. UNICAST, LOCAL, BROADCAST, ...
+1 -2
net/netfilter/ipset/ip_set_bitmap_ip.c
··· 338 338 NLA_PUT_IPADDR4(skb, IPSET_ATTR_IP_TO, htonl(map->last_ip)); 339 339 if (map->netmask != 32) 340 340 NLA_PUT_U8(skb, IPSET_ATTR_NETMASK, map->netmask); 341 - NLA_PUT_NET32(skb, IPSET_ATTR_REFERENCES, 342 - htonl(atomic_read(&set->ref) - 1)); 341 + NLA_PUT_NET32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref - 1)); 343 342 NLA_PUT_NET32(skb, IPSET_ATTR_MEMSIZE, 344 343 htonl(sizeof(*map) + map->memsize)); 345 344 if (with_timeout(map->timeout))
+1 -2
net/netfilter/ipset/ip_set_bitmap_ipmac.c
··· 434 434 goto nla_put_failure; 435 435 NLA_PUT_IPADDR4(skb, IPSET_ATTR_IP, htonl(map->first_ip)); 436 436 NLA_PUT_IPADDR4(skb, IPSET_ATTR_IP_TO, htonl(map->last_ip)); 437 - NLA_PUT_NET32(skb, IPSET_ATTR_REFERENCES, 438 - htonl(atomic_read(&set->ref) - 1)); 437 + NLA_PUT_NET32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref - 1)); 439 438 NLA_PUT_NET32(skb, IPSET_ATTR_MEMSIZE, 440 439 htonl(sizeof(*map) 441 440 + (map->last_ip - map->first_ip + 1) * map->dsize));
+1 -2
net/netfilter/ipset/ip_set_bitmap_port.c
··· 320 320 goto nla_put_failure; 321 321 NLA_PUT_NET16(skb, IPSET_ATTR_PORT, htons(map->first_port)); 322 322 NLA_PUT_NET16(skb, IPSET_ATTR_PORT_TO, htons(map->last_port)); 323 - NLA_PUT_NET32(skb, IPSET_ATTR_REFERENCES, 324 - htonl(atomic_read(&set->ref) - 1)); 323 + NLA_PUT_NET32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref - 1)); 325 324 NLA_PUT_NET32(skb, IPSET_ATTR_MEMSIZE, 326 325 htonl(sizeof(*map) + map->memsize)); 327 326 if (with_timeout(map->timeout))
+66 -43
net/netfilter/ipset/ip_set_core.c
··· 26 26 27 27 static LIST_HEAD(ip_set_type_list); /* all registered set types */ 28 28 static DEFINE_MUTEX(ip_set_type_mutex); /* protects ip_set_type_list */ 29 + static DEFINE_RWLOCK(ip_set_ref_lock); /* protects the set refs */ 29 30 30 31 static struct ip_set **ip_set_list; /* all individual sets */ 31 32 static ip_set_id_t ip_set_max = CONFIG_IP_SET_MAX; /* max number of sets */ ··· 302 301 static inline void 303 302 __ip_set_get(ip_set_id_t index) 304 303 { 305 - atomic_inc(&ip_set_list[index]->ref); 304 + write_lock_bh(&ip_set_ref_lock); 305 + ip_set_list[index]->ref++; 306 + write_unlock_bh(&ip_set_ref_lock); 306 307 } 307 308 308 309 static inline void 309 310 __ip_set_put(ip_set_id_t index) 310 311 { 311 - atomic_dec(&ip_set_list[index]->ref); 312 + write_lock_bh(&ip_set_ref_lock); 313 + BUG_ON(ip_set_list[index]->ref == 0); 314 + ip_set_list[index]->ref--; 315 + write_unlock_bh(&ip_set_ref_lock); 312 316 } 313 317 314 318 /* ··· 330 324 struct ip_set *set = ip_set_list[index]; 331 325 int ret = 0; 332 326 333 - BUG_ON(set == NULL || atomic_read(&set->ref) == 0); 327 + BUG_ON(set == NULL); 334 328 pr_debug("set %s, index %u\n", set->name, index); 335 329 336 330 if (dim < set->type->dimension || ··· 362 356 struct ip_set *set = ip_set_list[index]; 363 357 int ret; 364 358 365 - BUG_ON(set == NULL || atomic_read(&set->ref) == 0); 359 + BUG_ON(set == NULL); 366 360 pr_debug("set %s, index %u\n", set->name, index); 367 361 368 362 if (dim < set->type->dimension || ··· 384 378 struct ip_set *set = ip_set_list[index]; 385 379 int ret = 0; 386 380 387 - BUG_ON(set == NULL || atomic_read(&set->ref) == 0); 381 + BUG_ON(set == NULL); 388 382 pr_debug("set %s, index %u\n", set->name, index); 389 383 390 384 if (dim < set->type->dimension || ··· 403 397 * Find set by name, reference it once. The reference makes sure the 404 398 * thing pointed to, does not go away under our feet. 405 399 * 406 - * The nfnl mutex must already be activated. 407 400 */ 408 401 ip_set_id_t 409 402 ip_set_get_byname(const char *name, struct ip_set **set) ··· 428 423 * reference count by 1. The caller shall not assume the index 429 424 * to be valid, after calling this function. 430 425 * 431 - * The nfnl mutex must already be activated. 432 426 */ 433 427 void 434 428 ip_set_put_byindex(ip_set_id_t index) 435 429 { 436 - if (ip_set_list[index] != NULL) { 437 - BUG_ON(atomic_read(&ip_set_list[index]->ref) == 0); 430 + if (ip_set_list[index] != NULL) 438 431 __ip_set_put(index); 439 - } 440 432 } 441 433 EXPORT_SYMBOL_GPL(ip_set_put_byindex); 442 434 ··· 443 441 * can't be destroyed. The set cannot be renamed due to 444 442 * the referencing either. 445 443 * 446 - * The nfnl mutex must already be activated. 447 444 */ 448 445 const char * 449 446 ip_set_name_byindex(ip_set_id_t index) ··· 450 449 const struct ip_set *set = ip_set_list[index]; 451 450 452 451 BUG_ON(set == NULL); 453 - BUG_ON(atomic_read(&set->ref) == 0); 452 + BUG_ON(set->ref == 0); 454 453 455 454 /* Referenced, so it's safe */ 456 455 return set->name; ··· 516 515 ip_set_nfnl_put(ip_set_id_t index) 517 516 { 518 517 nfnl_lock(); 519 - if (ip_set_list[index] != NULL) { 520 - BUG_ON(atomic_read(&ip_set_list[index]->ref) == 0); 521 - __ip_set_put(index); 522 - } 518 + ip_set_put_byindex(index); 523 519 nfnl_unlock(); 524 520 } 525 521 EXPORT_SYMBOL_GPL(ip_set_nfnl_put); ··· 524 526 /* 525 527 * Communication protocol with userspace over netlink. 526 528 * 527 - * We already locked by nfnl_lock. 529 + * The commands are serialized by the nfnl mutex. 528 530 */ 529 531 530 532 static inline bool ··· 655 657 return -ENOMEM; 656 658 rwlock_init(&set->lock); 657 659 strlcpy(set->name, name, IPSET_MAXNAMELEN); 658 - atomic_set(&set->ref, 0); 659 660 set->family = family; 660 661 661 662 /* ··· 687 690 688 691 /* 689 692 * Here, we have a valid, constructed set and we are protected 690 - * by nfnl_lock. Find the first free index in ip_set_list and 691 - * check clashing. 693 + * by the nfnl mutex. Find the first free index in ip_set_list 694 + * and check clashing. 692 695 */ 693 696 if ((ret = find_free_id(set->name, &index, &clash)) != 0) { 694 697 /* If this is the same set and requested, ignore error */ ··· 748 751 const struct nlattr * const attr[]) 749 752 { 750 753 ip_set_id_t i; 754 + int ret = 0; 751 755 752 756 if (unlikely(protocol_failed(attr))) 753 757 return -IPSET_ERR_PROTOCOL; 754 758 755 - /* References are protected by the nfnl mutex */ 759 + /* Commands are serialized and references are 760 + * protected by the ip_set_ref_lock. 761 + * External systems (i.e. xt_set) must call 762 + * ip_set_put|get_nfnl_* functions, that way we 763 + * can safely check references here. 764 + * 765 + * list:set timer can only decrement the reference 766 + * counter, so if it's already zero, we can proceed 767 + * without holding the lock. 768 + */ 769 + read_lock_bh(&ip_set_ref_lock); 756 770 if (!attr[IPSET_ATTR_SETNAME]) { 757 771 for (i = 0; i < ip_set_max; i++) { 758 - if (ip_set_list[i] != NULL && 759 - (atomic_read(&ip_set_list[i]->ref))) 760 - return -IPSET_ERR_BUSY; 772 + if (ip_set_list[i] != NULL && ip_set_list[i]->ref) { 773 + ret = IPSET_ERR_BUSY; 774 + goto out; 775 + } 761 776 } 777 + read_unlock_bh(&ip_set_ref_lock); 762 778 for (i = 0; i < ip_set_max; i++) { 763 779 if (ip_set_list[i] != NULL) 764 780 ip_set_destroy_set(i); 765 781 } 766 782 } else { 767 783 i = find_set_id(nla_data(attr[IPSET_ATTR_SETNAME])); 768 - if (i == IPSET_INVALID_ID) 769 - return -ENOENT; 770 - else if (atomic_read(&ip_set_list[i]->ref)) 771 - return -IPSET_ERR_BUSY; 784 + if (i == IPSET_INVALID_ID) { 785 + ret = -ENOENT; 786 + goto out; 787 + } else if (ip_set_list[i]->ref) { 788 + ret = -IPSET_ERR_BUSY; 789 + goto out; 790 + } 791 + read_unlock_bh(&ip_set_ref_lock); 772 792 773 793 ip_set_destroy_set(i); 774 794 } 775 795 return 0; 796 + out: 797 + read_unlock_bh(&ip_set_ref_lock); 798 + return ret; 776 799 } 777 800 778 801 /* Flush sets */ ··· 851 834 struct ip_set *set; 852 835 const char *name2; 853 836 ip_set_id_t i; 837 + int ret = 0; 854 838 855 839 if (unlikely(protocol_failed(attr) || 856 840 attr[IPSET_ATTR_SETNAME] == NULL || ··· 861 843 set = find_set(nla_data(attr[IPSET_ATTR_SETNAME])); 862 844 if (set == NULL) 863 845 return -ENOENT; 864 - if (atomic_read(&set->ref) != 0) 865 - return -IPSET_ERR_REFERENCED; 846 + 847 + read_lock_bh(&ip_set_ref_lock); 848 + if (set->ref != 0) { 849 + ret = -IPSET_ERR_REFERENCED; 850 + goto out; 851 + } 866 852 867 853 name2 = nla_data(attr[IPSET_ATTR_SETNAME2]); 868 854 for (i = 0; i < ip_set_max; i++) { 869 855 if (ip_set_list[i] != NULL && 870 - STREQ(ip_set_list[i]->name, name2)) 871 - return -IPSET_ERR_EXIST_SETNAME2; 856 + STREQ(ip_set_list[i]->name, name2)) { 857 + ret = -IPSET_ERR_EXIST_SETNAME2; 858 + goto out; 859 + } 872 860 } 873 861 strncpy(set->name, name2, IPSET_MAXNAMELEN); 874 862 875 - return 0; 863 + out: 864 + read_unlock_bh(&ip_set_ref_lock); 865 + return ret; 876 866 } 877 867 878 868 /* Swap two sets so that name/index points to the other. 879 869 * References and set names are also swapped. 880 870 * 881 - * We are protected by the nfnl mutex and references are 882 - * manipulated only by holding the mutex. The kernel interfaces 871 + * The commands are serialized by the nfnl mutex and references are 872 + * protected by the ip_set_ref_lock. The kernel interfaces 883 873 * do not hold the mutex but the pointer settings are atomic 884 874 * so the ip_set_list always contains valid pointers to the sets. 885 875 */ ··· 900 874 struct ip_set *from, *to; 901 875 ip_set_id_t from_id, to_id; 902 876 char from_name[IPSET_MAXNAMELEN]; 903 - u32 from_ref; 904 877 905 878 if (unlikely(protocol_failed(attr) || 906 879 attr[IPSET_ATTR_SETNAME] == NULL || ··· 924 899 from->type->family == to->type->family)) 925 900 return -IPSET_ERR_TYPE_MISMATCH; 926 901 927 - /* No magic here: ref munging protected by the nfnl_lock */ 928 902 strncpy(from_name, from->name, IPSET_MAXNAMELEN); 929 - from_ref = atomic_read(&from->ref); 930 - 931 903 strncpy(from->name, to->name, IPSET_MAXNAMELEN); 932 - atomic_set(&from->ref, atomic_read(&to->ref)); 933 904 strncpy(to->name, from_name, IPSET_MAXNAMELEN); 934 - atomic_set(&to->ref, from_ref); 935 905 906 + write_lock_bh(&ip_set_ref_lock); 907 + swap(from->ref, to->ref); 936 908 ip_set_list[from_id] = to; 937 909 ip_set_list[to_id] = from; 910 + write_unlock_bh(&ip_set_ref_lock); 938 911 939 912 return 0; 940 913 } ··· 949 926 { 950 927 if (cb->args[2]) { 951 928 pr_debug("release set %s\n", ip_set_list[cb->args[1]]->name); 952 - __ip_set_put((ip_set_id_t) cb->args[1]); 929 + ip_set_put_byindex((ip_set_id_t) cb->args[1]); 953 930 } 954 931 return 0; 955 932 } ··· 1091 1068 /* If there was an error or set is done, release set */ 1092 1069 if (ret || !cb->args[2]) { 1093 1070 pr_debug("release set %s\n", ip_set_list[index]->name); 1094 - __ip_set_put(index); 1071 + ip_set_put_byindex(index); 1095 1072 } 1096 1073 1097 1074 /* If we dump all sets, continue with dumping last ones */
+23 -30
net/netfilter/ipset/ip_set_list_set.c
··· 43 43 static inline struct set_elem * 44 44 list_set_elem(const struct list_set *map, u32 id) 45 45 { 46 - return (struct set_elem *)((char *)map->members + id * map->dsize); 46 + return (struct set_elem *)((void *)map->members + id * map->dsize); 47 + } 48 + 49 + static inline struct set_telem * 50 + list_set_telem(const struct list_set *map, u32 id) 51 + { 52 + return (struct set_telem *)((void *)map->members + id * map->dsize); 47 53 } 48 54 49 55 static inline bool 50 56 list_set_timeout(const struct list_set *map, u32 id) 51 57 { 52 - const struct set_telem *elem = 53 - (const struct set_telem *) list_set_elem(map, id); 58 + const struct set_telem *elem = list_set_telem(map, id); 54 59 55 60 return ip_set_timeout_test(elem->timeout); 56 61 } ··· 63 58 static inline bool 64 59 list_set_expired(const struct list_set *map, u32 id) 65 60 { 66 - const struct set_telem *elem = 67 - (const struct set_telem *) list_set_elem(map, id); 61 + const struct set_telem *elem = list_set_telem(map, id); 68 62 69 63 return ip_set_timeout_expired(elem->timeout); 70 - } 71 - 72 - static inline int 73 - list_set_exist(const struct set_telem *elem) 74 - { 75 - return elem->id != IPSET_INVALID_ID && 76 - !ip_set_timeout_expired(elem->timeout); 77 64 } 78 65 79 66 /* Set list without and with timeout */ ··· 143 146 struct set_telem *e; 144 147 145 148 for (; i < map->size; i++) { 146 - e = (struct set_telem *)list_set_elem(map, i); 149 + e = list_set_telem(map, i); 147 150 swap(e->id, id); 151 + swap(e->timeout, timeout); 148 152 if (e->id == IPSET_INVALID_ID) 149 153 break; 150 - swap(e->timeout, timeout); 151 154 } 152 155 } 153 156 ··· 161 164 /* Last element replaced: e.g. add new,before,last */ 162 165 ip_set_put_byindex(e->id); 163 166 if (with_timeout(map->timeout)) 164 - list_elem_tadd(map, i, id, timeout); 167 + list_elem_tadd(map, i, id, ip_set_timeout_set(timeout)); 165 168 else 166 169 list_elem_add(map, i, id); 167 170 ··· 169 172 } 170 173 171 174 static int 172 - list_set_del(struct list_set *map, ip_set_id_t id, u32 i) 175 + list_set_del(struct list_set *map, u32 i) 173 176 { 174 177 struct set_elem *a = list_set_elem(map, i), *b; 175 178 176 - ip_set_put_byindex(id); 179 + ip_set_put_byindex(a->id); 177 180 178 181 for (; i < map->size - 1; i++) { 179 182 b = list_set_elem(map, i + 1); ··· 305 308 (before == 0 || 306 309 (before > 0 && 307 310 next_id_eq(map, i, refid)))) 308 - ret = list_set_del(map, id, i); 311 + ret = list_set_del(map, i); 309 312 else if (before < 0 && 310 313 elem->id == refid && 311 314 next_id_eq(map, i, id)) 312 - ret = list_set_del(map, id, i + 1); 315 + ret = list_set_del(map, i + 1); 313 316 } 314 317 break; 315 318 default: ··· 366 369 NLA_PUT_NET32(skb, IPSET_ATTR_SIZE, htonl(map->size)); 367 370 if (with_timeout(map->timeout)) 368 371 NLA_PUT_NET32(skb, IPSET_ATTR_TIMEOUT, htonl(map->timeout)); 369 - NLA_PUT_NET32(skb, IPSET_ATTR_REFERENCES, 370 - htonl(atomic_read(&set->ref) - 1)); 372 + NLA_PUT_NET32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref - 1)); 371 373 NLA_PUT_NET32(skb, IPSET_ATTR_MEMSIZE, 372 374 htonl(sizeof(*map) + map->size * map->dsize)); 373 375 ipset_nest_end(skb, nested); ··· 457 461 struct set_telem *e; 458 462 u32 i; 459 463 460 - /* We run parallel with other readers (test element) 461 - * but adding/deleting new entries is locked out */ 462 - read_lock_bh(&set->lock); 463 - for (i = map->size - 1; i >= 0; i--) { 464 - e = (struct set_telem *) list_set_elem(map, i); 465 - if (e->id != IPSET_INVALID_ID && 466 - list_set_expired(map, i)) 467 - list_set_del(map, e->id, i); 464 + write_lock_bh(&set->lock); 465 + for (i = 0; i < map->size; i++) { 466 + e = list_set_telem(map, i); 467 + if (e->id != IPSET_INVALID_ID && list_set_expired(map, i)) 468 + list_set_del(map, i); 468 469 } 469 - read_unlock_bh(&set->lock); 470 + write_unlock_bh(&set->lock); 470 471 471 472 map->gc.expires = jiffies + IPSET_GC_PERIOD(map->timeout) * HZ; 472 473 add_timer(&map->gc);
+1 -1
net/netfilter/ipvs/ip_vs_ctl.c
··· 3120 3120 static int ip_vs_genl_dump_daemons(struct sk_buff *skb, 3121 3121 struct netlink_callback *cb) 3122 3122 { 3123 - struct net *net = skb_net(skb); 3123 + struct net *net = skb_sknet(skb); 3124 3124 struct netns_ipvs *ipvs = net_ipvs(net); 3125 3125 3126 3126 mutex_lock(&__ip_vs_mutex);
+1 -1
net/netfilter/nf_conntrack_h323_asn1.c
··· 631 631 CHECK_BOUND(bs, 2); 632 632 count = *bs->cur++; 633 633 count <<= 8; 634 - count = *bs->cur++; 634 + count += *bs->cur++; 635 635 break; 636 636 case SEMI: 637 637 BYTE_ALIGN(bs);
+8 -8
net/netfilter/nf_conntrack_h323_main.c
··· 731 731 732 732 memset(&fl2, 0, sizeof(fl2)); 733 733 fl2.daddr = dst->ip; 734 - if (!afinfo->route((struct dst_entry **)&rt1, 735 - flowi4_to_flowi(&fl1))) { 736 - if (!afinfo->route((struct dst_entry **)&rt2, 737 - flowi4_to_flowi(&fl2))) { 734 + if (!afinfo->route(&init_net, (struct dst_entry **)&rt1, 735 + flowi4_to_flowi(&fl1), false)) { 736 + if (!afinfo->route(&init_net, (struct dst_entry **)&rt2, 737 + flowi4_to_flowi(&fl2), false)) { 738 738 if (rt1->rt_gateway == rt2->rt_gateway && 739 739 rt1->dst.dev == rt2->dst.dev) 740 740 ret = 1; ··· 755 755 756 756 memset(&fl2, 0, sizeof(fl2)); 757 757 ipv6_addr_copy(&fl2.daddr, &dst->in6); 758 - if (!afinfo->route((struct dst_entry **)&rt1, 759 - flowi6_to_flowi(&fl1))) { 760 - if (!afinfo->route((struct dst_entry **)&rt2, 761 - flowi6_to_flowi(&fl2))) { 758 + if (!afinfo->route(&init_net, (struct dst_entry **)&rt1, 759 + flowi6_to_flowi(&fl1), false)) { 760 + if (!afinfo->route(&init_net, (struct dst_entry **)&rt2, 761 + flowi6_to_flowi(&fl2), false)) { 762 762 if (!memcmp(&rt1->rt6i_gateway, &rt2->rt6i_gateway, 763 763 sizeof(rt1->rt6i_gateway)) && 764 764 rt1->dst.dev == rt2->dst.dev)
+1 -1
net/netfilter/xt_TCPMSS.c
··· 166 166 rcu_read_lock(); 167 167 ai = nf_get_afinfo(family); 168 168 if (ai != NULL) 169 - ai->route((struct dst_entry **)&rt, &fl); 169 + ai->route(&init_net, (struct dst_entry **)&rt, &fl, false); 170 170 rcu_read_unlock(); 171 171 172 172 if (rt != NULL) {
+28 -14
net/netfilter/xt_addrtype.c
··· 32 32 MODULE_ALIAS("ip6t_addrtype"); 33 33 34 34 #if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) 35 - static u32 xt_addrtype_rt6_to_type(const struct rt6_info *rt) 35 + static u32 match_lookup_rt6(struct net *net, const struct net_device *dev, 36 + const struct in6_addr *addr) 36 37 { 38 + const struct nf_afinfo *afinfo; 39 + struct flowi6 flow; 40 + struct rt6_info *rt; 37 41 u32 ret; 42 + int route_err; 38 43 39 - if (!rt) 44 + memset(&flow, 0, sizeof(flow)); 45 + ipv6_addr_copy(&flow.daddr, addr); 46 + if (dev) 47 + flow.flowi6_oif = dev->ifindex; 48 + 49 + rcu_read_lock(); 50 + 51 + afinfo = nf_get_afinfo(NFPROTO_IPV6); 52 + if (afinfo != NULL) 53 + route_err = afinfo->route(net, (struct dst_entry **)&rt, 54 + flowi6_to_flowi(&flow), !!dev); 55 + else 56 + route_err = 1; 57 + 58 + rcu_read_unlock(); 59 + 60 + if (route_err) 40 61 return XT_ADDRTYPE_UNREACHABLE; 41 62 42 63 if (rt->rt6i_flags & RTF_REJECT) ··· 69 48 ret |= XT_ADDRTYPE_LOCAL; 70 49 if (rt->rt6i_flags & RTF_ANYCAST) 71 50 ret |= XT_ADDRTYPE_ANYCAST; 51 + 52 + 53 + dst_release(&rt->dst); 72 54 return ret; 73 55 } 74 56 ··· 89 65 return false; 90 66 91 67 if ((XT_ADDRTYPE_LOCAL | XT_ADDRTYPE_ANYCAST | 92 - XT_ADDRTYPE_UNREACHABLE) & mask) { 93 - struct rt6_info *rt; 94 - u32 type; 95 - int ifindex = dev ? dev->ifindex : 0; 96 - 97 - rt = rt6_lookup(net, addr, NULL, ifindex, !!dev); 98 - 99 - type = xt_addrtype_rt6_to_type(rt); 100 - 101 - dst_release(&rt->dst); 102 - return !!(mask & type); 103 - } 68 + XT_ADDRTYPE_UNREACHABLE) & mask) 69 + return !!(mask & match_lookup_rt6(net, dev, addr)); 104 70 return true; 105 71 } 106 72
+1 -1
net/netfilter/xt_conntrack.c
··· 195 195 return info->match_flags & XT_CONNTRACK_STATE; 196 196 if ((info->match_flags & XT_CONNTRACK_DIRECTION) && 197 197 (CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL) ^ 198 - !!(info->invert_flags & XT_CONNTRACK_DIRECTION)) 198 + !(info->invert_flags & XT_CONNTRACK_DIRECTION)) 199 199 return false; 200 200 201 201 if (info->match_flags & XT_CONNTRACK_ORIGSRC)