Skip to content

Commit b527cae

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Make fragmentation IDs less predictable, from Eric Dumazet. 2) TSO tunneling can crash in bnx2x driver, fix from Dmitry Kravkov. 3) Don't allow NULL msg->msg_name just because msg->msg_namelen is non-zero, from Andrey Ryabinin. 4) ndm->ndm_type set using wrong macros, from Jun Zhao. 5) cdc-ether devices can come up with entries in their address filter, so explicitly clear the filter after the device initializes. From Oliver Neukum. 6) Forgotten refcount bump in xfrm_lookup(), from Steffen Klassert. 7) Short packets not padded properly, exposing random data, in bcmgenet driver. Fix from Florian Fainelli. 8) xgbe_probe() doesn't return an error code, but rather zero, when netif_set_real_num_tx_queues() fails. Fix from Wei Yongjun. 9) USB speed not probed properly in r8152 driver, from Hayes Wang. 10) Transmit logic choosing the outgoing port in the sunvnet driver needs to consider a) is the port actually up and b) whether it is a switch port. Fix from David L Stevens. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (27 commits) net: phy: re-apply PHY fixups during phy_register_device cdc-ether: clean packet filter upon probe cdc_subset: deal with a device that needs reset for timeout net: sendmsg: fix NULL pointer dereference isdn/bas_gigaset: fix a leak on failure path in gigaset_probe() ip: make IP identifiers less predictable neighbour : fix ndm_type type error issue sunvnet: only use connected ports when sending can: c_can_platform: Fix raminit, use devm_ioremap() instead of devm_ioremap_resource() bnx2x: fix crash during TSO tunneling r8152: fix the checking of the usb speed net: phy: Ensure the MDIO bus module is held net: phy: Set the driver when registering an MDIO bus device bnx2x: fix set_setting for some PHYs hyperv: Fix error return code in netvsc_init_buf() amd-xgbe: Fix error return code in xgbe_probe() ath9k: fix aggregation session lockup net: bcmgenet: correctly pad short packets net: sctp: inherit auth_capable on INIT collisions mac80211: fix crash on getting sta info with uninitialized rate control ...
2 parents c98158e + d92f5de commit b527cae

File tree

33 files changed

+197
-63
lines changed

33 files changed

+197
-63
lines changed

drivers/isdn/gigaset/bas-gigaset.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2400,6 +2400,7 @@ static int gigaset_probe(struct usb_interface *interface,
24002400
error:
24012401
freeurbs(cs);
24022402
usb_set_intfdata(interface, NULL);
2403+
usb_put_dev(udev);
24032404
gigaset_freecs(cs);
24042405
return rc;
24052406
}

drivers/net/can/c_can/c_can_platform.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,8 @@ static int c_can_plat_probe(struct platform_device *pdev)
287287
break;
288288
}
289289

290-
priv->raminit_ctrlreg = devm_ioremap_resource(&pdev->dev, res);
290+
priv->raminit_ctrlreg = devm_ioremap(&pdev->dev, res->start,
291+
resource_size(res));
291292
if (IS_ERR(priv->raminit_ctrlreg) || priv->instance < 0)
292293
dev_info(&pdev->dev, "control memory is not used for raminit\n");
293294
else

drivers/net/ethernet/amd/xgbe/xgbe-main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ static int xgbe_probe(struct platform_device *pdev)
339339
/* Calculate the number of Tx and Rx rings to be created */
340340
pdata->tx_ring_count = min_t(unsigned int, num_online_cpus(),
341341
pdata->hw_feat.tx_ch_cnt);
342-
if (netif_set_real_num_tx_queues(netdev, pdata->tx_ring_count)) {
342+
ret = netif_set_real_num_tx_queues(netdev, pdata->tx_ring_count);
343+
if (ret) {
343344
dev_err(dev, "error setting real tx queue count\n");
344345
goto err_io;
345346
}

drivers/net/ethernet/broadcom/bnx2x/bnx2x.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ struct sw_tx_bd {
346346
u8 flags;
347347
/* Set on the first BD descriptor when there is a split BD */
348348
#define BNX2X_TSO_SPLIT_BD (1<<0)
349+
#define BNX2X_HAS_SECOND_PBD (1<<1)
349350
};
350351

351352
struct sw_rx_page {

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,12 @@ static u16 bnx2x_free_tx_pkt(struct bnx2x *bp, struct bnx2x_fp_txdata *txdata,
227227
--nbd;
228228
bd_idx = TX_BD(NEXT_TX_IDX(bd_idx));
229229

230+
if (tx_buf->flags & BNX2X_HAS_SECOND_PBD) {
231+
/* Skip second parse bd... */
232+
--nbd;
233+
bd_idx = TX_BD(NEXT_TX_IDX(bd_idx));
234+
}
235+
230236
/* TSO headers+data bds share a common mapping. See bnx2x_tx_split() */
231237
if (tx_buf->flags & BNX2X_TSO_SPLIT_BD) {
232238
tx_data_bd = &txdata->tx_desc_ring[bd_idx].reg_bd;
@@ -3889,6 +3895,9 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
38893895
/* set encapsulation flag in start BD */
38903896
SET_FLAG(tx_start_bd->general_data,
38913897
ETH_TX_START_BD_TUNNEL_EXIST, 1);
3898+
3899+
tx_buf->flags |= BNX2X_HAS_SECOND_PBD;
3900+
38923901
nbd++;
38933902
} else if (xmit_type & XMIT_CSUM) {
38943903
/* Set PBD in checksum offload case w/o encapsulation */

drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
379379
break;
380380
case PORT_FIBRE:
381381
case PORT_DA:
382+
case PORT_NONE:
382383
if (!(bp->port.supported[0] & SUPPORTED_FIBRE ||
383384
bp->port.supported[1] & SUPPORTED_FIBRE)) {
384385
DP(BNX2X_MSG_ETHTOOL,

drivers/net/ethernet/broadcom/genet/bcmgenet.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,11 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
11491149
goto out;
11501150
}
11511151

1152+
if (skb_padto(skb, ETH_ZLEN)) {
1153+
ret = NETDEV_TX_OK;
1154+
goto out;
1155+
}
1156+
11521157
/* set the SKB transmit checksum */
11531158
if (priv->desc_64b_en) {
11541159
ret = bcmgenet_put_tx_csum(dev, skb);

drivers/net/ethernet/sun/sunvnet.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -610,21 +610,33 @@ static int __vnet_tx_trigger(struct vnet_port *port)
610610
return err;
611611
}
612612

613+
static inline bool port_is_up(struct vnet_port *vnet)
614+
{
615+
struct vio_driver_state *vio = &vnet->vio;
616+
617+
return !!(vio->hs_state & VIO_HS_COMPLETE);
618+
}
619+
613620
struct vnet_port *__tx_port_find(struct vnet *vp, struct sk_buff *skb)
614621
{
615622
unsigned int hash = vnet_hashfn(skb->data);
616623
struct hlist_head *hp = &vp->port_hash[hash];
617624
struct vnet_port *port;
618625

619626
hlist_for_each_entry(port, hp, hash) {
627+
if (!port_is_up(port))
628+
continue;
620629
if (ether_addr_equal(port->raddr, skb->data))
621630
return port;
622631
}
623-
port = NULL;
624-
if (!list_empty(&vp->port_list))
625-
port = list_entry(vp->port_list.next, struct vnet_port, list);
626-
627-
return port;
632+
list_for_each_entry(port, &vp->port_list, list) {
633+
if (!port->switch_port)
634+
continue;
635+
if (!port_is_up(port))
636+
continue;
637+
return port;
638+
}
639+
return NULL;
628640
}
629641

630642
struct vnet_port *tx_port_find(struct vnet *vp, struct sk_buff *skb)

drivers/net/hyperv/netvsc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,10 @@ static int netvsc_init_buf(struct hv_device *device)
378378

379379
net_device->send_section_map =
380380
kzalloc(net_device->map_words * sizeof(ulong), GFP_KERNEL);
381-
if (net_device->send_section_map == NULL)
381+
if (net_device->send_section_map == NULL) {
382+
ret = -ENOMEM;
382383
goto cleanup;
384+
}
383385

384386
goto exit;
385387

drivers/net/phy/mdio_bus.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ int mdiobus_register(struct mii_bus *bus)
255255

256256
bus->dev.parent = bus->parent;
257257
bus->dev.class = &mdio_bus_class;
258+
bus->dev.driver = bus->parent->driver;
258259
bus->dev.groups = NULL;
259260
dev_set_name(&bus->dev, "%s", bus->id);
260261

drivers/net/phy/phy_device.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ int phy_device_register(struct phy_device *phydev)
355355
phydev->bus->phy_map[phydev->addr] = phydev;
356356

357357
/* Run all of the fixups for this PHY */
358-
err = phy_init_hw(phydev);
358+
err = phy_scan_fixups(phydev);
359359
if (err) {
360360
pr_err("PHY %d failed to initialize\n", phydev->addr);
361361
goto out;
@@ -575,6 +575,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
575575
u32 flags, phy_interface_t interface)
576576
{
577577
struct device *d = &phydev->dev;
578+
struct module *bus_module;
578579
int err;
579580

580581
/* Assume that if there is no driver, that it doesn't
@@ -599,6 +600,14 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
599600
return -EBUSY;
600601
}
601602

603+
/* Increment the bus module reference count */
604+
bus_module = phydev->bus->dev.driver ?
605+
phydev->bus->dev.driver->owner : NULL;
606+
if (!try_module_get(bus_module)) {
607+
dev_err(&dev->dev, "failed to get the bus module\n");
608+
return -EIO;
609+
}
610+
602611
phydev->attached_dev = dev;
603612
dev->phydev = phydev;
604613

@@ -664,6 +673,10 @@ EXPORT_SYMBOL(phy_attach);
664673
void phy_detach(struct phy_device *phydev)
665674
{
666675
int i;
676+
677+
if (phydev->bus->dev.driver)
678+
module_put(phydev->bus->dev.driver->owner);
679+
667680
phydev->attached_dev->phydev = NULL;
668681
phydev->attached_dev = NULL;
669682
phy_suspend(phydev);

drivers/net/usb/cdc_ether.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,22 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
341341
usb_driver_release_interface(driver, info->data);
342342
return -ENODEV;
343343
}
344+
345+
/* Some devices don't initialise properly. In particular
346+
* the packet filter is not reset. There are devices that
347+
* don't do reset all the way. So the packet filter should
348+
* be set to a sane initial value.
349+
*/
350+
usb_control_msg(dev->udev,
351+
usb_sndctrlpipe(dev->udev, 0),
352+
USB_CDC_SET_ETHERNET_PACKET_FILTER,
353+
USB_TYPE_CLASS | USB_RECIP_INTERFACE,
354+
USB_CDC_PACKET_TYPE_ALL_MULTICAST | USB_CDC_PACKET_TYPE_DIRECTED | USB_CDC_PACKET_TYPE_BROADCAST,
355+
intf->cur_altsetting->desc.bInterfaceNumber,
356+
NULL,
357+
0,
358+
USB_CTRL_SET_TIMEOUT
359+
);
344360
return 0;
345361

346362
bad_desc:

drivers/net/usb/cdc_subset.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,34 @@ static int always_connected (struct usbnet *dev)
8585
*
8686
*-------------------------------------------------------------------------*/
8787

88+
static void m5632_recover(struct usbnet *dev)
89+
{
90+
struct usb_device *udev = dev->udev;
91+
struct usb_interface *intf = dev->intf;
92+
int r;
93+
94+
r = usb_lock_device_for_reset(udev, intf);
95+
if (r < 0)
96+
return;
97+
98+
usb_reset_device(udev);
99+
usb_unlock_device(udev);
100+
}
101+
102+
static int dummy_prereset(struct usb_interface *intf)
103+
{
104+
return 0;
105+
}
106+
107+
static int dummy_postreset(struct usb_interface *intf)
108+
{
109+
return 0;
110+
}
111+
88112
static const struct driver_info ali_m5632_info = {
89113
.description = "ALi M5632",
90114
.flags = FLAG_POINTTOPOINT,
115+
.recover = m5632_recover,
91116
};
92117

93118
#endif
@@ -332,6 +357,8 @@ static struct usb_driver cdc_subset_driver = {
332357
.probe = usbnet_probe,
333358
.suspend = usbnet_suspend,
334359
.resume = usbnet_resume,
360+
.pre_reset = dummy_prereset,
361+
.post_reset = dummy_postreset,
335362
.disconnect = usbnet_disconnect,
336363
.id_table = products,
337364
.disable_hub_initiated_lpm = 1,

drivers/net/usb/r8152.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@
282282
/* USB_DEV_STAT */
283283
#define STAT_SPEED_MASK 0x0006
284284
#define STAT_SPEED_HIGH 0x0000
285-
#define STAT_SPEED_FULL 0x0001
285+
#define STAT_SPEED_FULL 0x0002
286286

287287
/* USB_TX_AGG */
288288
#define TX_AGG_MAX_THRESHOLD 0x03
@@ -2292,9 +2292,8 @@ static void r8152b_exit_oob(struct r8152 *tp)
22922292
/* rx share fifo credit full threshold */
22932293
ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL0, RXFIFO_THR1_NORMAL);
22942294

2295-
ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_DEV_STAT);
2296-
ocp_data &= STAT_SPEED_MASK;
2297-
if (ocp_data == STAT_SPEED_FULL) {
2295+
if (tp->udev->speed == USB_SPEED_FULL ||
2296+
tp->udev->speed == USB_SPEED_LOW) {
22982297
/* rx share fifo credit near full threshold */
22992298
ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL1,
23002299
RXFIFO_THR2_FULL);

drivers/net/usb/usbnet.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,8 +1218,12 @@ void usbnet_tx_timeout (struct net_device *net)
12181218

12191219
unlink_urbs (dev, &dev->txq);
12201220
tasklet_schedule (&dev->bh);
1221-
1222-
// FIXME: device recovery -- reset?
1221+
/* this needs to be handled individually because the generic layer
1222+
* doesn't know what is sufficient and could not restore private
1223+
* information if a remedy of an unconditional reset were used.
1224+
*/
1225+
if (dev->driver_info->recover)
1226+
(dev->driver_info->recover)(dev);
12231227
}
12241228
EXPORT_SYMBOL_GPL(usbnet_tx_timeout);
12251229

drivers/net/vxlan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,
339339
ndm->ndm_state = fdb->state;
340340
ndm->ndm_ifindex = vxlan->dev->ifindex;
341341
ndm->ndm_flags = fdb->flags;
342-
ndm->ndm_type = NDA_DST;
342+
ndm->ndm_type = RTN_UNICAST;
343343

344344
if (send_eth && nla_put(skb, NDA_LLADDR, ETH_ALEN, &fdb->eth_addr))
345345
goto nla_put_failure;

drivers/net/wireless/ath/ath9k/xmit.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,15 @@ ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq,
887887

888888
tx_info = IEEE80211_SKB_CB(skb);
889889
tx_info->flags &= ~IEEE80211_TX_CTL_CLEAR_PS_FILT;
890+
891+
/*
892+
* No aggregation session is running, but there may be frames
893+
* from a previous session or a failed attempt in the queue.
894+
* Send them out as normal data frames
895+
*/
896+
if (!tid->active)
897+
tx_info->flags &= ~IEEE80211_TX_CTL_AMPDU;
898+
890899
if (!(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) {
891900
bf->bf_state.bf_type = 0;
892901
return bf;

drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,8 +1072,12 @@ static int iwl_mvm_mac_ctxt_cmd_ap(struct iwl_mvm *mvm,
10721072
/* Fill the common data for all mac context types */
10731073
iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action);
10741074

1075-
/* Also enable probe requests to pass */
1076-
cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_PROBE_REQUEST);
1075+
/*
1076+
* pass probe requests and beacons from other APs (needed
1077+
* for ht protection)
1078+
*/
1079+
cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_PROBE_REQUEST |
1080+
MAC_FILTER_IN_BEACON);
10771081

10781082
/* Fill the data specific for ap mode */
10791083
iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.ap,
@@ -1094,6 +1098,13 @@ static int iwl_mvm_mac_ctxt_cmd_go(struct iwl_mvm *mvm,
10941098
/* Fill the common data for all mac context types */
10951099
iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action);
10961100

1101+
/*
1102+
* pass probe requests and beacons from other APs (needed
1103+
* for ht protection)
1104+
*/
1105+
cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_PROBE_REQUEST |
1106+
MAC_FILTER_IN_BEACON);
1107+
10971108
/* Fill the data specific for GO mode */
10981109
iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.go.ap,
10991110
action == FW_CTXT_ACTION_ADD);

drivers/net/wireless/iwlwifi/mvm/mac80211.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,6 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
303303
hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP;
304304
}
305305

306-
if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT &&
307-
!iwlwifi_mod_params.uapsd_disable) {
308-
hw->flags |= IEEE80211_HW_SUPPORTS_UAPSD;
309-
hw->uapsd_queues = IWL_UAPSD_AC_INFO;
310-
hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP;
311-
}
312-
313306
hw->sta_data_size = sizeof(struct iwl_mvm_sta);
314307
hw->vif_data_size = sizeof(struct iwl_mvm_vif);
315308
hw->chanctx_data_size = sizeof(u16);

include/linux/usb/usbnet.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ struct driver_info {
148148
struct sk_buff *(*tx_fixup)(struct usbnet *dev,
149149
struct sk_buff *skb, gfp_t flags);
150150

151+
/* recover from timeout */
152+
void (*recover)(struct usbnet *dev);
153+
151154
/* early initialization code, can sleep. This is for minidrivers
152155
* having 'subminidrivers' that need to do extra initialization
153156
* right after minidriver have initialized hardware. */

include/net/ip.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -309,16 +309,7 @@ static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb)
309309
}
310310
}
311311

312-
#define IP_IDENTS_SZ 2048u
313-
extern atomic_t *ip_idents;
314-
315-
static inline u32 ip_idents_reserve(u32 hash, int segs)
316-
{
317-
atomic_t *id_ptr = ip_idents + hash % IP_IDENTS_SZ;
318-
319-
return atomic_add_return(segs, id_ptr) - segs;
320-
}
321-
312+
u32 ip_idents_reserve(u32 hash, int segs);
322313
void __ip_select_ident(struct iphdr *iph, int segs);
323314

324315
static inline void ip_select_ident_segs(struct sk_buff *skb, struct sock *sk, int segs)

0 commit comments

Comments
 (0)