Skip to content

Commit f0dc7f9

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix several bpfilter/UMH bugs, in particular make the UMH build not depend upon X86 specific Kconfig symbols. From Alexei Starovoitov. 2) Fix handling of modified context pointer in bpf verifier, from Daniel Borkmann. 3) Kill regression in ifdown/ifup sequences for hv_netvsc driver, from Dexuan Cui. 4) When the bonding primary member name changes, we have to re-evaluate the bond->force_primary setting, from Xiangning Yu. 5) Eliminate possible padding beyone end of SKB in cdc_ncm driver, from Bjørn Mork. 6) RX queue length reported for UDP sockets in procfs and socket diag are inaccurate, from Paolo Abeni. 7) Fix br_fdb_find_port() locking, from Petr Machata. 8) Limit sk_rcvlowat values properly in TCP, from Soheil Hassas Yeganeh. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (23 commits) tcp: limit sk_rcvlowat by the maximum receive buffer net: phy: dp83822: use BMCR_ANENABLE instead of BMSR_ANEGCAPABLE for DP83620 socket: close race condition between sock_close() and sockfs_setattr() net: bridge: Fix locking in br_fdb_find_port() udp: fix rx queue len reported by diag and proc interface cdc_ncm: avoid padding beyond end of skb net/sched: act_simple: fix parsing of TCA_DEF_DATA net: fddi: fix a possible null-ptr-deref net: aquantia: fix unsigned numvecs comparison with less than zero net: stmmac: fix build failure due to missing COMMON_CLK dependency bpfilter: fix race in pipe access bpf, xdp: fix crash in xdp_umem_unaccount_pages xsk: Fix umem fill/completion queue mmap on 32-bit tools/bpf: fix selftest get_cgroup_id_user bpfilter: fix OUTPUT_FORMAT umh: fix race condition net: mscc: ocelot: Fix uninitialized error in ocelot_netdevice_event() bonding: re-evaluate force_primary when the primary slave name changes ip_tunnel: Fix name string concatenate in __ip_tunnel_create() hv_netvsc: Fix a network regression after ifdown/ifup ...
2 parents 1aaccb5 + 867f816 commit f0dc7f9

File tree

37 files changed

+301
-129
lines changed

37 files changed

+301
-129
lines changed

arch/um/drivers/vector_transports.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ static int raw_form_header(uint8_t *header,
120120
skb,
121121
vheader,
122122
virtio_legacy_is_little_endian(),
123-
false
123+
false,
124+
0
124125
);
125126

126127
return 0;

drivers/net/bonding/bond_options.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,7 @@ static int bond_option_primary_set(struct bonding *bond,
11421142
slave->dev->name);
11431143
rcu_assign_pointer(bond->primary_slave, slave);
11441144
strcpy(bond->params.primary, slave->dev->name);
1145+
bond->force_primary = true;
11451146
bond_select_active_slave(bond);
11461147
goto out;
11471148
}

drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,13 @@ static int aq_pci_probe(struct pci_dev *pdev,
267267
numvecs = min(numvecs, num_online_cpus());
268268
/*enable interrupts */
269269
#if !AQ_CFG_FORCE_LEGACY_INT
270-
numvecs = pci_alloc_irq_vectors(self->pdev, 1, numvecs,
271-
PCI_IRQ_MSIX | PCI_IRQ_MSI |
272-
PCI_IRQ_LEGACY);
270+
err = pci_alloc_irq_vectors(self->pdev, 1, numvecs,
271+
PCI_IRQ_MSIX | PCI_IRQ_MSI |
272+
PCI_IRQ_LEGACY);
273273

274-
if (numvecs < 0) {
275-
err = numvecs;
274+
if (err < 0)
276275
goto err_hwinit;
277-
}
276+
numvecs = err;
278277
#endif
279278
self->irqvecs = numvecs;
280279

drivers/net/ethernet/mscc/ocelot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ static int ocelot_netdevice_event(struct notifier_block *unused,
11261126
{
11271127
struct netdev_notifier_changeupper_info *info = ptr;
11281128
struct net_device *dev = netdev_notifier_info_to_dev(ptr);
1129-
int ret;
1129+
int ret = 0;
11301130

11311131
if (netif_is_lag_master(dev)) {
11321132
struct net_device *slave;

drivers/net/ethernet/stmicro/stmmac/Kconfig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ config DWMAC_DWC_QOS_ETH
3333
select PHYLIB
3434
select CRC32
3535
select MII
36-
depends on OF && HAS_DMA
36+
depends on OF && COMMON_CLK && HAS_DMA
3737
help
3838
Support for chips using the snps,dwc-qos-ethernet.txt DT binding.
3939

@@ -57,7 +57,7 @@ config DWMAC_ANARION
5757
config DWMAC_IPQ806X
5858
tristate "QCA IPQ806x DWMAC support"
5959
default ARCH_QCOM
60-
depends on OF && (ARCH_QCOM || COMPILE_TEST)
60+
depends on OF && COMMON_CLK && (ARCH_QCOM || COMPILE_TEST)
6161
select MFD_SYSCON
6262
help
6363
Support for QCA IPQ806X DWMAC Ethernet.
@@ -100,7 +100,7 @@ config DWMAC_OXNAS
100100
config DWMAC_ROCKCHIP
101101
tristate "Rockchip dwmac support"
102102
default ARCH_ROCKCHIP
103-
depends on OF && (ARCH_ROCKCHIP || COMPILE_TEST)
103+
depends on OF && COMMON_CLK && (ARCH_ROCKCHIP || COMPILE_TEST)
104104
select MFD_SYSCON
105105
help
106106
Support for Ethernet controller on Rockchip RK3288 SoC.
@@ -123,7 +123,7 @@ config DWMAC_SOCFPGA
123123
config DWMAC_STI
124124
tristate "STi GMAC support"
125125
default ARCH_STI
126-
depends on OF && (ARCH_STI || COMPILE_TEST)
126+
depends on OF && COMMON_CLK && (ARCH_STI || COMPILE_TEST)
127127
select MFD_SYSCON
128128
---help---
129129
Support for ethernet controller on STi SOCs.
@@ -147,7 +147,7 @@ config DWMAC_STM32
147147
config DWMAC_SUNXI
148148
tristate "Allwinner GMAC support"
149149
default ARCH_SUNXI
150-
depends on OF && (ARCH_SUNXI || COMPILE_TEST)
150+
depends on OF && COMMON_CLK && (ARCH_SUNXI || COMPILE_TEST)
151151
---help---
152152
Support for Allwinner A20/A31 GMAC ethernet controllers.
153153

drivers/net/fddi/skfp/skfddi.c

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,11 @@ static int skfp_init_one(struct pci_dev *pdev,
297297
return 0;
298298
err_out5:
299299
if (smc->os.SharedMemAddr)
300-
pci_free_consistent(pdev, smc->os.SharedMemSize,
301-
smc->os.SharedMemAddr,
302-
smc->os.SharedMemDMA);
303-
pci_free_consistent(pdev, MAX_FRAME_SIZE,
304-
smc->os.LocalRxBuffer, smc->os.LocalRxBufferDMA);
300+
dma_free_coherent(&pdev->dev, smc->os.SharedMemSize,
301+
smc->os.SharedMemAddr,
302+
smc->os.SharedMemDMA);
303+
dma_free_coherent(&pdev->dev, MAX_FRAME_SIZE,
304+
smc->os.LocalRxBuffer, smc->os.LocalRxBufferDMA);
305305
err_out4:
306306
free_netdev(dev);
307307
err_out3:
@@ -328,17 +328,17 @@ static void skfp_remove_one(struct pci_dev *pdev)
328328
unregister_netdev(p);
329329

330330
if (lp->os.SharedMemAddr) {
331-
pci_free_consistent(&lp->os.pdev,
332-
lp->os.SharedMemSize,
333-
lp->os.SharedMemAddr,
334-
lp->os.SharedMemDMA);
331+
dma_free_coherent(&pdev->dev,
332+
lp->os.SharedMemSize,
333+
lp->os.SharedMemAddr,
334+
lp->os.SharedMemDMA);
335335
lp->os.SharedMemAddr = NULL;
336336
}
337337
if (lp->os.LocalRxBuffer) {
338-
pci_free_consistent(&lp->os.pdev,
339-
MAX_FRAME_SIZE,
340-
lp->os.LocalRxBuffer,
341-
lp->os.LocalRxBufferDMA);
338+
dma_free_coherent(&pdev->dev,
339+
MAX_FRAME_SIZE,
340+
lp->os.LocalRxBuffer,
341+
lp->os.LocalRxBufferDMA);
342342
lp->os.LocalRxBuffer = NULL;
343343
}
344344
#ifdef MEM_MAPPED_IO
@@ -394,7 +394,9 @@ static int skfp_driver_init(struct net_device *dev)
394394
spin_lock_init(&bp->DriverLock);
395395

396396
// Allocate invalid frame
397-
bp->LocalRxBuffer = pci_alloc_consistent(&bp->pdev, MAX_FRAME_SIZE, &bp->LocalRxBufferDMA);
397+
bp->LocalRxBuffer = dma_alloc_coherent(&bp->pdev.dev, MAX_FRAME_SIZE,
398+
&bp->LocalRxBufferDMA,
399+
GFP_ATOMIC);
398400
if (!bp->LocalRxBuffer) {
399401
printk("could not allocate mem for ");
400402
printk("LocalRxBuffer: %d byte\n", MAX_FRAME_SIZE);
@@ -407,23 +409,22 @@ static int skfp_driver_init(struct net_device *dev)
407409
if (bp->SharedMemSize > 0) {
408410
bp->SharedMemSize += 16; // for descriptor alignment
409411

410-
bp->SharedMemAddr = pci_alloc_consistent(&bp->pdev,
411-
bp->SharedMemSize,
412-
&bp->SharedMemDMA);
412+
bp->SharedMemAddr = dma_zalloc_coherent(&bp->pdev.dev,
413+
bp->SharedMemSize,
414+
&bp->SharedMemDMA,
415+
GFP_ATOMIC);
413416
if (!bp->SharedMemAddr) {
414417
printk("could not allocate mem for ");
415418
printk("hardware module: %ld byte\n",
416419
bp->SharedMemSize);
417420
goto fail;
418421
}
419-
bp->SharedMemHeap = 0; // Nothing used yet.
420422

421423
} else {
422424
bp->SharedMemAddr = NULL;
423-
bp->SharedMemHeap = 0;
424-
} // SharedMemSize > 0
425+
}
425426

426-
memset(bp->SharedMemAddr, 0, bp->SharedMemSize);
427+
bp->SharedMemHeap = 0;
427428

428429
card_stop(smc); // Reset adapter.
429430

@@ -442,15 +443,15 @@ static int skfp_driver_init(struct net_device *dev)
442443

443444
fail:
444445
if (bp->SharedMemAddr) {
445-
pci_free_consistent(&bp->pdev,
446-
bp->SharedMemSize,
447-
bp->SharedMemAddr,
448-
bp->SharedMemDMA);
446+
dma_free_coherent(&bp->pdev.dev,
447+
bp->SharedMemSize,
448+
bp->SharedMemAddr,
449+
bp->SharedMemDMA);
449450
bp->SharedMemAddr = NULL;
450451
}
451452
if (bp->LocalRxBuffer) {
452-
pci_free_consistent(&bp->pdev, MAX_FRAME_SIZE,
453-
bp->LocalRxBuffer, bp->LocalRxBufferDMA);
453+
dma_free_coherent(&bp->pdev.dev, MAX_FRAME_SIZE,
454+
bp->LocalRxBuffer, bp->LocalRxBufferDMA);
454455
bp->LocalRxBuffer = NULL;
455456
}
456457
return err;

drivers/net/hyperv/netvsc_drv.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,10 @@ static int netvsc_open(struct net_device *net)
125125
}
126126

127127
rdev = nvdev->extension;
128-
if (!rdev->link_state)
128+
if (!rdev->link_state) {
129129
netif_carrier_on(net);
130+
netif_tx_wake_all_queues(net);
131+
}
130132

131133
if (vf_netdev) {
132134
/* Setting synthetic device up transparently sets

drivers/net/phy/dp83848.c

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,25 @@ static int dp83848_config_intr(struct phy_device *phydev)
7474
return phy_write(phydev, DP83848_MICR, control);
7575
}
7676

77+
static int dp83848_config_init(struct phy_device *phydev)
78+
{
79+
int err;
80+
int val;
81+
82+
err = genphy_config_init(phydev);
83+
if (err < 0)
84+
return err;
85+
86+
/* DP83620 always reports Auto Negotiation Ability on BMSR. Instead,
87+
* we check initial value of BMCR Auto negotiation enable bit
88+
*/
89+
val = phy_read(phydev, MII_BMCR);
90+
if (!(val & BMCR_ANENABLE))
91+
phydev->autoneg = AUTONEG_DISABLE;
92+
93+
return 0;
94+
}
95+
7796
static struct mdio_device_id __maybe_unused dp83848_tbl[] = {
7897
{ TI_DP83848C_PHY_ID, 0xfffffff0 },
7998
{ NS_DP83848C_PHY_ID, 0xfffffff0 },
@@ -83,7 +102,7 @@ static struct mdio_device_id __maybe_unused dp83848_tbl[] = {
83102
};
84103
MODULE_DEVICE_TABLE(mdio, dp83848_tbl);
85104

86-
#define DP83848_PHY_DRIVER(_id, _name) \
105+
#define DP83848_PHY_DRIVER(_id, _name, _config_init) \
87106
{ \
88107
.phy_id = _id, \
89108
.phy_id_mask = 0xfffffff0, \
@@ -92,7 +111,7 @@ MODULE_DEVICE_TABLE(mdio, dp83848_tbl);
92111
.flags = PHY_HAS_INTERRUPT, \
93112
\
94113
.soft_reset = genphy_soft_reset, \
95-
.config_init = genphy_config_init, \
114+
.config_init = _config_init, \
96115
.suspend = genphy_suspend, \
97116
.resume = genphy_resume, \
98117
\
@@ -102,10 +121,14 @@ MODULE_DEVICE_TABLE(mdio, dp83848_tbl);
102121
}
103122

104123
static struct phy_driver dp83848_driver[] = {
105-
DP83848_PHY_DRIVER(TI_DP83848C_PHY_ID, "TI DP83848C 10/100 Mbps PHY"),
106-
DP83848_PHY_DRIVER(NS_DP83848C_PHY_ID, "NS DP83848C 10/100 Mbps PHY"),
107-
DP83848_PHY_DRIVER(TI_DP83620_PHY_ID, "TI DP83620 10/100 Mbps PHY"),
108-
DP83848_PHY_DRIVER(TLK10X_PHY_ID, "TI TLK10X 10/100 Mbps PHY"),
124+
DP83848_PHY_DRIVER(TI_DP83848C_PHY_ID, "TI DP83848C 10/100 Mbps PHY",
125+
genphy_config_init),
126+
DP83848_PHY_DRIVER(NS_DP83848C_PHY_ID, "NS DP83848C 10/100 Mbps PHY",
127+
genphy_config_init),
128+
DP83848_PHY_DRIVER(TI_DP83620_PHY_ID, "TI DP83620 10/100 Mbps PHY",
129+
dp83848_config_init),
130+
DP83848_PHY_DRIVER(TLK10X_PHY_ID, "TI TLK10X 10/100 Mbps PHY",
131+
genphy_config_init),
109132
};
110133
module_phy_driver(dp83848_driver);
111134

drivers/net/tap.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,13 +774,16 @@ static ssize_t tap_put_user(struct tap_queue *q,
774774
int total;
775775

776776
if (q->flags & IFF_VNET_HDR) {
777+
int vlan_hlen = skb_vlan_tag_present(skb) ? VLAN_HLEN : 0;
777778
struct virtio_net_hdr vnet_hdr;
779+
778780
vnet_hdr_len = READ_ONCE(q->vnet_hdr_sz);
779781
if (iov_iter_count(iter) < vnet_hdr_len)
780782
return -EINVAL;
781783

782784
if (virtio_net_hdr_from_skb(skb, &vnet_hdr,
783-
tap_is_little_endian(q), true))
785+
tap_is_little_endian(q), true,
786+
vlan_hlen))
784787
BUG();
785788

786789
if (copy_to_iter(&vnet_hdr, sizeof(vnet_hdr), iter) !=

drivers/net/tun.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2089,7 +2089,8 @@ static ssize_t tun_put_user(struct tun_struct *tun,
20892089
return -EINVAL;
20902090

20912091
if (virtio_net_hdr_from_skb(skb, &gso,
2092-
tun_is_little_endian(tun), true)) {
2092+
tun_is_little_endian(tun), true,
2093+
vlan_hlen)) {
20932094
struct skb_shared_info *sinfo = skb_shinfo(skb);
20942095
pr_err("unexpected GSO type: "
20952096
"0x%x, gso_size %d, hdr_len %d\n",

drivers/net/usb/cdc_ncm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
11241124
* accordingly. Otherwise, we should check here.
11251125
*/
11261126
if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END)
1127-
delayed_ndp_size = ctx->max_ndp_size;
1127+
delayed_ndp_size = ALIGN(ctx->max_ndp_size, ctx->tx_ndp_modulus);
11281128
else
11291129
delayed_ndp_size = 0;
11301130

@@ -1285,7 +1285,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
12851285
/* If requested, put NDP at end of frame. */
12861286
if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) {
12871287
nth16 = (struct usb_cdc_ncm_nth16 *)skb_out->data;
1288-
cdc_ncm_align_tail(skb_out, ctx->tx_ndp_modulus, 0, ctx->tx_curr_size);
1288+
cdc_ncm_align_tail(skb_out, ctx->tx_ndp_modulus, 0, ctx->tx_curr_size - ctx->max_ndp_size);
12891289
nth16->wNdpIndex = cpu_to_le16(skb_out->len);
12901290
skb_put_data(skb_out, ctx->delayed_ndp16, ctx->max_ndp_size);
12911291

drivers/net/virtio_net.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1411,7 +1411,8 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb)
14111411
hdr = skb_vnet_hdr(skb);
14121412

14131413
if (virtio_net_hdr_from_skb(skb, &hdr->hdr,
1414-
virtio_is_little_endian(vi->vdev), false))
1414+
virtio_is_little_endian(vi->vdev), false,
1415+
0))
14151416
BUG();
14161417

14171418
if (vi->mergeable_rx_bufs)

include/linux/virtio_net.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,
5858
static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb,
5959
struct virtio_net_hdr *hdr,
6060
bool little_endian,
61-
bool has_data_valid)
61+
bool has_data_valid,
62+
int vlan_hlen)
6263
{
6364
memset(hdr, 0, sizeof(*hdr)); /* no info leak */
6465

@@ -83,12 +84,8 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb,
8384

8485
if (skb->ip_summed == CHECKSUM_PARTIAL) {
8586
hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM;
86-
if (skb_vlan_tag_present(skb))
87-
hdr->csum_start = __cpu_to_virtio16(little_endian,
88-
skb_checksum_start_offset(skb) + VLAN_HLEN);
89-
else
90-
hdr->csum_start = __cpu_to_virtio16(little_endian,
91-
skb_checksum_start_offset(skb));
87+
hdr->csum_start = __cpu_to_virtio16(little_endian,
88+
skb_checksum_start_offset(skb) + vlan_hlen);
9289
hdr->csum_offset = __cpu_to_virtio16(little_endian,
9390
skb->csum_offset);
9491
} else if (has_data_valid &&

include/net/transp_v6.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,15 @@ int ip6_datagram_send_ctl(struct net *net, struct sock *sk, struct msghdr *msg,
4545
struct flowi6 *fl6, struct ipcm6_cookie *ipc6,
4646
struct sockcm_cookie *sockc);
4747

48-
void ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp,
49-
__u16 srcp, __u16 destp, int bucket);
48+
void __ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp,
49+
__u16 srcp, __u16 destp, int rqueue, int bucket);
50+
static inline void
51+
ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp, __u16 srcp,
52+
__u16 destp, int bucket)
53+
{
54+
__ip6_dgram_sock_seq_show(seq, sp, srcp, destp, sk_rmem_alloc_get(sp),
55+
bucket);
56+
}
5057

5158
#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006)
5259

include/net/udp.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ static inline __be16 udp_flow_src_port(struct net *net, struct sk_buff *skb,
247247
return htons((((u64) hash * (max - min)) >> 32) + min);
248248
}
249249

250+
static inline int udp_rqueue_get(struct sock *sk)
251+
{
252+
return sk_rmem_alloc_get(sk) - READ_ONCE(udp_sk(sk)->forward_deficit);
253+
}
254+
250255
/* net/ipv4/udp.c */
251256
void udp_destruct_sock(struct sock *sk);
252257
void skb_consume_udp(struct sock *sk, struct sk_buff *skb, int len);

include/uapi/linux/if_xdp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ struct xdp_statistics {
6363
/* Pgoff for mmaping the rings */
6464
#define XDP_PGOFF_RX_RING 0
6565
#define XDP_PGOFF_TX_RING 0x80000000
66-
#define XDP_UMEM_PGOFF_FILL_RING 0x100000000
67-
#define XDP_UMEM_PGOFF_COMPLETION_RING 0x180000000
66+
#define XDP_UMEM_PGOFF_FILL_RING 0x100000000ULL
67+
#define XDP_UMEM_PGOFF_COMPLETION_RING 0x180000000ULL
6868

6969
/* Rx/Tx descriptor */
7070
struct xdp_desc {

0 commit comments

Comments
 (0)