Skip to content

Commit 896d894

Browse files
committed
Merge tag 'net-6.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Paolo Abeni: "Including fixes from can and netfilter. Current release - regressions: - rtnetlink: fix double call of rtnl_link_get_net_ifla() - tcp: populate XPS related fields of timewait sockets - ethtool: fix access to uninitialized fields in set RXNFC command - selinux: use sk_to_full_sk() in selinux_ip_output() Current release - new code bugs: - net: make napi_hash_lock irq safe - eth: - bnxt_en: support header page pool in queue API - ice: fix NULL pointer dereference in switchdev Previous releases - regressions: - core: fix icmp host relookup triggering ip_rt_bug - ipv6: - avoid possible NULL deref in modify_prefix_route() - release expired exception dst cached in socket - smc: fix LGR and link use-after-free issue - hsr: avoid potential out-of-bound access in fill_frame_info() - can: hi311x: fix potential use-after-free - eth: ice: fix VLAN pruning in switchdev mode Previous releases - always broken: - netfilter: - ipset: hold module reference while requesting a module - nft_inner: incorrect percpu area handling under softirq - can: j1939: fix skb reference counting - eth: - mlxsw: use correct key block on Spectrum-4 - mlx5: fix memory leak in mlx5hws_definer_calc_layout" * tag 'net-6.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (76 commits) net :mana :Request a V2 response version for MANA_QUERY_GF_STAT net: avoid potential UAF in default_operstate() vsock/test: verify socket options after setting them vsock/test: fix parameter types in SO_VM_SOCKETS_* calls vsock/test: fix failures due to wrong SO_RCVLOWAT parameter net/mlx5e: Remove workaround to avoid syndrome for internal port net/mlx5e: SD, Use correct mdev to build channel param net/mlx5: E-Switch, Fix switching to switchdev mode in MPV net/mlx5: E-Switch, Fix switching to switchdev mode with IB device disabled net/mlx5: HWS: Properly set bwc queue locks lock classes net/mlx5: HWS: Fix memory leak in mlx5hws_definer_calc_layout bnxt_en: handle tpa_info in queue API implementation bnxt_en: refactor bnxt_alloc_rx_rings() to call bnxt_alloc_rx_agg_bmap() bnxt_en: refactor tpa_info alloc/free into helpers geneve: do not assume mac header is set in geneve_xmit_skb() mlxsw: spectrum_acl_flex_keys: Use correct key block on Spectrum-4 ethtool: Fix wrong mod state in case of verbose and no_mask bitset ipmr: tune the ipmr_can_free_table() checks. netfilter: nft_set_hash: skip duplicated elements pending gc run netfilter: ipset: Hold module reference while requesting a module ...
2 parents 9d6a414 + 31f1b55 commit 896d894

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+985
-454
lines changed

Documentation/networking/bareudp.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@ Bare UDP Tunnelling Module Documentation
66

77
There are various L3 encapsulation standards using UDP being discussed to
88
leverage the UDP based load balancing capability of different networks.
9-
MPLSoUDP (__ https://tools.ietf.org/html/rfc7510) is one among them.
9+
MPLSoUDP (https://tools.ietf.org/html/rfc7510) is one among them.
1010

1111
The Bareudp tunnel module provides a generic L3 encapsulation support for
1212
tunnelling different L3 protocols like MPLS, IP, NSH etc. inside a UDP tunnel.
1313

1414
Special Handling
1515
----------------
16+
1617
The bareudp device supports special handling for MPLS & IP as they can have
1718
multiple ethertypes.
18-
MPLS procotcol can have ethertypes ETH_P_MPLS_UC (unicast) & ETH_P_MPLS_MC (multicast).
19+
The MPLS protocol can have ethertypes ETH_P_MPLS_UC (unicast) & ETH_P_MPLS_MC (multicast).
1920
IP protocol can have ethertypes ETH_P_IP (v4) & ETH_P_IPV6 (v6).
2021
This special handling can be enabled only for ethertypes ETH_P_IP & ETH_P_MPLS_UC
2122
with a flag called multiproto mode.
@@ -52,7 +53,7 @@ be enabled explicitly with the "multiproto" flag.
5253
3) Device Usage
5354

5455
The bareudp device could be used along with OVS or flower filter in TC.
55-
The OVS or TC flower layer must set the tunnel information in SKB dst field before
56-
sending packet buffer to the bareudp device for transmission. On reception the
57-
bareudp device extracts and stores the tunnel information in SKB dst field before
56+
The OVS or TC flower layer must set the tunnel information in the SKB dst field before
57+
sending the packet buffer to the bareudp device for transmission. On reception, the
58+
bareUDP device extracts and stores the tunnel information in the SKB dst field before
5859
passing the packet buffer to the network stack.

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16267,6 +16267,7 @@ F: Documentation/devicetree/bindings/net/
1626716267
F: Documentation/networking/net_cachelines/net_device.rst
1626816268
F: drivers/connector/
1626916269
F: drivers/net/
16270+
F: drivers/ptp/
1627016271
F: include/dt-bindings/net/
1627116272
F: include/linux/cn_proc.h
1627216273
F: include/linux/etherdevice.h

drivers/net/can/c_can/c_can_main.c

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,49 +1014,57 @@ static int c_can_handle_bus_err(struct net_device *dev,
10141014

10151015
/* propagate the error condition to the CAN stack */
10161016
skb = alloc_can_err_skb(dev, &cf);
1017-
if (unlikely(!skb))
1018-
return 0;
10191017

10201018
/* check for 'last error code' which tells us the
10211019
* type of the last error to occur on the CAN bus
10221020
*/
1023-
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
1021+
if (likely(skb))
1022+
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
10241023

10251024
switch (lec_type) {
10261025
case LEC_STUFF_ERROR:
10271026
netdev_dbg(dev, "stuff error\n");
1028-
cf->data[2] |= CAN_ERR_PROT_STUFF;
1027+
if (likely(skb))
1028+
cf->data[2] |= CAN_ERR_PROT_STUFF;
10291029
stats->rx_errors++;
10301030
break;
10311031
case LEC_FORM_ERROR:
10321032
netdev_dbg(dev, "form error\n");
1033-
cf->data[2] |= CAN_ERR_PROT_FORM;
1033+
if (likely(skb))
1034+
cf->data[2] |= CAN_ERR_PROT_FORM;
10341035
stats->rx_errors++;
10351036
break;
10361037
case LEC_ACK_ERROR:
10371038
netdev_dbg(dev, "ack error\n");
1038-
cf->data[3] = CAN_ERR_PROT_LOC_ACK;
1039+
if (likely(skb))
1040+
cf->data[3] = CAN_ERR_PROT_LOC_ACK;
10391041
stats->tx_errors++;
10401042
break;
10411043
case LEC_BIT1_ERROR:
10421044
netdev_dbg(dev, "bit1 error\n");
1043-
cf->data[2] |= CAN_ERR_PROT_BIT1;
1045+
if (likely(skb))
1046+
cf->data[2] |= CAN_ERR_PROT_BIT1;
10441047
stats->tx_errors++;
10451048
break;
10461049
case LEC_BIT0_ERROR:
10471050
netdev_dbg(dev, "bit0 error\n");
1048-
cf->data[2] |= CAN_ERR_PROT_BIT0;
1051+
if (likely(skb))
1052+
cf->data[2] |= CAN_ERR_PROT_BIT0;
10491053
stats->tx_errors++;
10501054
break;
10511055
case LEC_CRC_ERROR:
10521056
netdev_dbg(dev, "CRC error\n");
1053-
cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
1057+
if (likely(skb))
1058+
cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
10541059
stats->rx_errors++;
10551060
break;
10561061
default:
10571062
break;
10581063
}
10591064

1065+
if (unlikely(!skb))
1066+
return 0;
1067+
10601068
netif_receive_skb(skb);
10611069
return 1;
10621070
}

drivers/net/can/dev/dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ static int can_set_termination(struct net_device *ndev, u16 term)
468468
else
469469
set = 0;
470470

471-
gpiod_set_value(priv->termination_gpio, set);
471+
gpiod_set_value_cansleep(priv->termination_gpio, set);
472472

473473
return 0;
474474
}

drivers/net/can/ifi_canfd/ifi_canfd.c

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -390,43 +390,65 @@ static int ifi_canfd_handle_lec_err(struct net_device *ndev)
390390
return 0;
391391

392392
priv->can.can_stats.bus_error++;
393-
stats->rx_errors++;
394393

395394
/* Propagate the error condition to the CAN stack. */
396395
skb = alloc_can_err_skb(ndev, &cf);
397-
if (unlikely(!skb))
398-
return 0;
399396

400397
/* Read the error counter register and check for new errors. */
401-
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
398+
if (likely(skb))
399+
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
402400

403-
if (errctr & IFI_CANFD_ERROR_CTR_OVERLOAD_FIRST)
404-
cf->data[2] |= CAN_ERR_PROT_OVERLOAD;
401+
if (errctr & IFI_CANFD_ERROR_CTR_OVERLOAD_FIRST) {
402+
stats->rx_errors++;
403+
if (likely(skb))
404+
cf->data[2] |= CAN_ERR_PROT_OVERLOAD;
405+
}
405406

406-
if (errctr & IFI_CANFD_ERROR_CTR_ACK_ERROR_FIRST)
407-
cf->data[3] = CAN_ERR_PROT_LOC_ACK;
407+
if (errctr & IFI_CANFD_ERROR_CTR_ACK_ERROR_FIRST) {
408+
stats->tx_errors++;
409+
if (likely(skb))
410+
cf->data[3] = CAN_ERR_PROT_LOC_ACK;
411+
}
408412

409-
if (errctr & IFI_CANFD_ERROR_CTR_BIT0_ERROR_FIRST)
410-
cf->data[2] |= CAN_ERR_PROT_BIT0;
413+
if (errctr & IFI_CANFD_ERROR_CTR_BIT0_ERROR_FIRST) {
414+
stats->tx_errors++;
415+
if (likely(skb))
416+
cf->data[2] |= CAN_ERR_PROT_BIT0;
417+
}
411418

412-
if (errctr & IFI_CANFD_ERROR_CTR_BIT1_ERROR_FIRST)
413-
cf->data[2] |= CAN_ERR_PROT_BIT1;
419+
if (errctr & IFI_CANFD_ERROR_CTR_BIT1_ERROR_FIRST) {
420+
stats->tx_errors++;
421+
if (likely(skb))
422+
cf->data[2] |= CAN_ERR_PROT_BIT1;
423+
}
414424

415-
if (errctr & IFI_CANFD_ERROR_CTR_STUFF_ERROR_FIRST)
416-
cf->data[2] |= CAN_ERR_PROT_STUFF;
425+
if (errctr & IFI_CANFD_ERROR_CTR_STUFF_ERROR_FIRST) {
426+
stats->rx_errors++;
427+
if (likely(skb))
428+
cf->data[2] |= CAN_ERR_PROT_STUFF;
429+
}
417430

418-
if (errctr & IFI_CANFD_ERROR_CTR_CRC_ERROR_FIRST)
419-
cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
431+
if (errctr & IFI_CANFD_ERROR_CTR_CRC_ERROR_FIRST) {
432+
stats->rx_errors++;
433+
if (likely(skb))
434+
cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
435+
}
420436

421-
if (errctr & IFI_CANFD_ERROR_CTR_FORM_ERROR_FIRST)
422-
cf->data[2] |= CAN_ERR_PROT_FORM;
437+
if (errctr & IFI_CANFD_ERROR_CTR_FORM_ERROR_FIRST) {
438+
stats->rx_errors++;
439+
if (likely(skb))
440+
cf->data[2] |= CAN_ERR_PROT_FORM;
441+
}
423442

424443
/* Reset the error counter, ack the IRQ and re-enable the counter. */
425444
writel(IFI_CANFD_ERROR_CTR_ER_RESET, priv->base + IFI_CANFD_ERROR_CTR);
426445
writel(IFI_CANFD_INTERRUPT_ERROR_COUNTER,
427446
priv->base + IFI_CANFD_INTERRUPT);
428447
writel(IFI_CANFD_ERROR_CTR_ER_ENABLE, priv->base + IFI_CANFD_ERROR_CTR);
429448

449+
if (unlikely(!skb))
450+
return 0;
451+
430452
netif_receive_skb(skb);
431453

432454
return 1;

drivers/net/can/m_can/m_can.c

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -695,47 +695,60 @@ static int m_can_handle_lec_err(struct net_device *dev,
695695
u32 timestamp = 0;
696696

697697
cdev->can.can_stats.bus_error++;
698-
stats->rx_errors++;
699698

700699
/* propagate the error condition to the CAN stack */
701700
skb = alloc_can_err_skb(dev, &cf);
702-
if (unlikely(!skb))
703-
return 0;
704701

705702
/* check for 'last error code' which tells us the
706703
* type of the last error to occur on the CAN bus
707704
*/
708-
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
705+
if (likely(skb))
706+
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
709707

710708
switch (lec_type) {
711709
case LEC_STUFF_ERROR:
712710
netdev_dbg(dev, "stuff error\n");
713-
cf->data[2] |= CAN_ERR_PROT_STUFF;
711+
stats->rx_errors++;
712+
if (likely(skb))
713+
cf->data[2] |= CAN_ERR_PROT_STUFF;
714714
break;
715715
case LEC_FORM_ERROR:
716716
netdev_dbg(dev, "form error\n");
717-
cf->data[2] |= CAN_ERR_PROT_FORM;
717+
stats->rx_errors++;
718+
if (likely(skb))
719+
cf->data[2] |= CAN_ERR_PROT_FORM;
718720
break;
719721
case LEC_ACK_ERROR:
720722
netdev_dbg(dev, "ack error\n");
721-
cf->data[3] = CAN_ERR_PROT_LOC_ACK;
723+
stats->tx_errors++;
724+
if (likely(skb))
725+
cf->data[3] = CAN_ERR_PROT_LOC_ACK;
722726
break;
723727
case LEC_BIT1_ERROR:
724728
netdev_dbg(dev, "bit1 error\n");
725-
cf->data[2] |= CAN_ERR_PROT_BIT1;
729+
stats->tx_errors++;
730+
if (likely(skb))
731+
cf->data[2] |= CAN_ERR_PROT_BIT1;
726732
break;
727733
case LEC_BIT0_ERROR:
728734
netdev_dbg(dev, "bit0 error\n");
729-
cf->data[2] |= CAN_ERR_PROT_BIT0;
735+
stats->tx_errors++;
736+
if (likely(skb))
737+
cf->data[2] |= CAN_ERR_PROT_BIT0;
730738
break;
731739
case LEC_CRC_ERROR:
732740
netdev_dbg(dev, "CRC error\n");
733-
cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
741+
stats->rx_errors++;
742+
if (likely(skb))
743+
cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
734744
break;
735745
default:
736746
break;
737747
}
738748

749+
if (unlikely(!skb))
750+
return 0;
751+
739752
if (cdev->is_peripheral)
740753
timestamp = m_can_get_timestamp(cdev);
741754

drivers/net/can/sja1000/sja1000.c

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -416,17 +416,18 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
416416
int ret = 0;
417417

418418
skb = alloc_can_err_skb(dev, &cf);
419-
if (skb == NULL)
420-
return -ENOMEM;
421419

422420
txerr = priv->read_reg(priv, SJA1000_TXERR);
423421
rxerr = priv->read_reg(priv, SJA1000_RXERR);
424422

425423
if (isrc & IRQ_DOI) {
426424
/* data overrun interrupt */
427425
netdev_dbg(dev, "data overrun interrupt\n");
428-
cf->can_id |= CAN_ERR_CRTL;
429-
cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;
426+
if (skb) {
427+
cf->can_id |= CAN_ERR_CRTL;
428+
cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;
429+
}
430+
430431
stats->rx_over_errors++;
431432
stats->rx_errors++;
432433
sja1000_write_cmdreg(priv, CMD_CDO); /* clear bit */
@@ -452,41 +453,46 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
452453
else
453454
state = CAN_STATE_ERROR_ACTIVE;
454455
}
455-
if (state != CAN_STATE_BUS_OFF) {
456+
if (state != CAN_STATE_BUS_OFF && skb) {
456457
cf->can_id |= CAN_ERR_CNT;
457458
cf->data[6] = txerr;
458459
cf->data[7] = rxerr;
459460
}
460461
if (isrc & IRQ_BEI) {
461462
/* bus error interrupt */
462463
priv->can.can_stats.bus_error++;
463-
stats->rx_errors++;
464464

465465
ecc = priv->read_reg(priv, SJA1000_ECC);
466+
if (skb) {
467+
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
466468

467-
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
468-
469-
/* set error type */
470-
switch (ecc & ECC_MASK) {
471-
case ECC_BIT:
472-
cf->data[2] |= CAN_ERR_PROT_BIT;
473-
break;
474-
case ECC_FORM:
475-
cf->data[2] |= CAN_ERR_PROT_FORM;
476-
break;
477-
case ECC_STUFF:
478-
cf->data[2] |= CAN_ERR_PROT_STUFF;
479-
break;
480-
default:
481-
break;
482-
}
469+
/* set error type */
470+
switch (ecc & ECC_MASK) {
471+
case ECC_BIT:
472+
cf->data[2] |= CAN_ERR_PROT_BIT;
473+
break;
474+
case ECC_FORM:
475+
cf->data[2] |= CAN_ERR_PROT_FORM;
476+
break;
477+
case ECC_STUFF:
478+
cf->data[2] |= CAN_ERR_PROT_STUFF;
479+
break;
480+
default:
481+
break;
482+
}
483483

484-
/* set error location */
485-
cf->data[3] = ecc & ECC_SEG;
484+
/* set error location */
485+
cf->data[3] = ecc & ECC_SEG;
486+
}
486487

487488
/* Error occurred during transmission? */
488-
if ((ecc & ECC_DIR) == 0)
489-
cf->data[2] |= CAN_ERR_PROT_TX;
489+
if ((ecc & ECC_DIR) == 0) {
490+
stats->tx_errors++;
491+
if (skb)
492+
cf->data[2] |= CAN_ERR_PROT_TX;
493+
} else {
494+
stats->rx_errors++;
495+
}
490496
}
491497
if (isrc & IRQ_EPI) {
492498
/* error passive interrupt */
@@ -502,8 +508,10 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
502508
netdev_dbg(dev, "arbitration lost interrupt\n");
503509
alc = priv->read_reg(priv, SJA1000_ALC);
504510
priv->can.can_stats.arbitration_lost++;
505-
cf->can_id |= CAN_ERR_LOSTARB;
506-
cf->data[0] = alc & 0x1f;
511+
if (skb) {
512+
cf->can_id |= CAN_ERR_LOSTARB;
513+
cf->data[0] = alc & 0x1f;
514+
}
507515
}
508516

509517
if (state != priv->can.state) {
@@ -516,6 +524,9 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
516524
can_bus_off(dev);
517525
}
518526

527+
if (!skb)
528+
return -ENOMEM;
529+
519530
netif_rx(skb);
520531

521532
return ret;

0 commit comments

Comments
 (0)