Skip to content

Commit ab59a86

Browse files
committed
Merge tag 'net-6.15-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Paolo Abeni: "Including fixes from netfilter. Current release - regressions: - core: hold instance lock during NETDEV_CHANGE - rtnetlink: fix bad unlock balance in do_setlink() - ipv6: - fix null-ptr-deref in addrconf_add_ifaddr() - align behavior across nexthops during path selection Previous releases - regressions: - sctp: prevent transport UaF in sendmsg - mptcp: only inc MPJoinAckHMacFailure for HMAC failures Previous releases - always broken: - sched: - make ->qlen_notify() idempotent - ensure sufficient space when sending filter netlink notifications - sch_sfq: really don't allow 1 packet limit - netfilter: fix incorrect avx2 match of 5th field octet - tls: explicitly disallow disconnect - eth: octeontx2-pf: fix VF root node parent queue priority" * tag 'net-6.15-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (38 commits) ethtool: cmis_cdb: Fix incorrect read / write length extension selftests: netfilter: add test case for recent mismatch bug nft_set_pipapo: fix incorrect avx2 match of 5th field octet net: ppp: Add bound checking for skb data on ppp_sync_txmung net: Fix null-ptr-deref by sock_lock_init_class_and_name() and rmmod. ipv6: Align behavior across nexthops during path selection net: phy: allow MDIO bus PM ops to start/stop state machine for phylink-controlled PHY net: phy: move phy_link_change() prior to mdio_bus_phy_may_suspend() selftests/tc-testing: sfq: check that a derived limit of 1 is rejected net_sched: sch_sfq: move the limit validation net_sched: sch_sfq: use a temporary work area for validating configuration net: libwx: handle page_pool_dev_alloc_pages error selftests: mptcp: validate MPJoin HMacFailure counters mptcp: only inc MPJoinAckHMacFailure for HMAC failures rtnetlink: Fix bad unlock balance in do_setlink(). net: ethtool: Don't call .cleanup_data when prepare_data fails tc: Ensure we have enough buffer space when sending filter netlink notifications net: libwx: Fix the wrong Rx descriptor field octeontx2-pf: qos: fix VF root node parent queue index selftests: tls: check that disconnect does nothing ...
2 parents 2eb959e + eaa517b commit ab59a86

File tree

45 files changed

+649
-150
lines changed

Some content is hidden

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

45 files changed

+649
-150
lines changed

Documentation/networking/netdevices.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,11 @@ operations directly under the netdev instance lock.
338338
Devices drivers are encouraged to rely on the instance lock where possible.
339339

340340
For the (mostly software) drivers that need to interact with the core stack,
341-
there are two sets of interfaces: ``dev_xxx`` and ``netif_xxx`` (e.g.,
342-
``dev_set_mtu`` and ``netif_set_mtu``). The ``dev_xxx`` functions handle
343-
acquiring the instance lock themselves, while the ``netif_xxx`` functions
344-
assume that the driver has already acquired the instance lock.
341+
there are two sets of interfaces: ``dev_xxx``/``netdev_xxx`` and ``netif_xxx``
342+
(e.g., ``dev_set_mtu`` and ``netif_set_mtu``). The ``dev_xxx``/``netdev_xxx``
343+
functions handle acquiring the instance lock themselves, while the
344+
``netif_xxx`` functions assume that the driver has already acquired
345+
the instance lock.
345346

346347
Notifiers and netdev instance lock
347348
==================================
@@ -354,6 +355,7 @@ For devices with locked ops, currently only the following notifiers are
354355
running under the lock:
355356
* ``NETDEV_REGISTER``
356357
* ``NETDEV_UP``
358+
* ``NETDEV_CHANGE``
357359

358360
The following notifiers are running without the lock:
359361
* ``NETDEV_UNREGISTER``

drivers/net/ethernet/marvell/octeontx2/nic/qos.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ static void __otx2_qos_txschq_cfg(struct otx2_nic *pfvf,
165165

166166
otx2_config_sched_shaping(pfvf, node, cfg, &num_regs);
167167
} else if (level == NIX_TXSCH_LVL_TL2) {
168+
/* configure parent txschq */
169+
cfg->reg[num_regs] = NIX_AF_TL2X_PARENT(node->schq);
170+
cfg->regval[num_regs] = (u64)hw->tx_link << 16;
171+
num_regs++;
172+
168173
/* configure link cfg */
169174
if (level == pfvf->qos.link_cfg_lvl) {
170175
cfg->reg[num_regs] = NIX_AF_TL3_TL2X_LINKX_CFG(node->schq, hw->tx_link);

drivers/net/ethernet/wangxun/libwx/wx_lib.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,8 @@ static bool wx_alloc_mapped_page(struct wx_ring *rx_ring,
310310
return true;
311311

312312
page = page_pool_dev_alloc_pages(rx_ring->page_pool);
313-
WARN_ON(!page);
313+
if (unlikely(!page))
314+
return false;
314315
dma = page_pool_get_dma_addr(page);
315316

316317
bi->page_dma = dma;
@@ -546,7 +547,8 @@ static void wx_rx_checksum(struct wx_ring *ring,
546547
return;
547548

548549
/* Hardware can't guarantee csum if IPv6 Dest Header found */
549-
if (dptype.prot != WX_DEC_PTYPE_PROT_SCTP && WX_RXD_IPV6EX(rx_desc))
550+
if (dptype.prot != WX_DEC_PTYPE_PROT_SCTP &&
551+
wx_test_staterr(rx_desc, WX_RXD_STAT_IPV6EX))
550552
return;
551553

552554
/* if L4 checksum error */

drivers/net/ethernet/wangxun/libwx/wx_type.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ enum WX_MSCA_CMD_value {
513513
#define WX_RXD_STAT_L4CS BIT(7) /* L4 xsum calculated */
514514
#define WX_RXD_STAT_IPCS BIT(8) /* IP xsum calculated */
515515
#define WX_RXD_STAT_OUTERIPCS BIT(10) /* Cloud IP xsum calculated*/
516+
#define WX_RXD_STAT_IPV6EX BIT(12) /* IPv6 Dest Header */
516517
#define WX_RXD_STAT_TS BIT(14) /* IEEE1588 Time Stamp */
517518

518519
#define WX_RXD_ERR_OUTERIPER BIT(26) /* CRC IP Header error */
@@ -589,8 +590,6 @@ enum wx_l2_ptypes {
589590

590591
#define WX_RXD_PKTTYPE(_rxd) \
591592
((le32_to_cpu((_rxd)->wb.lower.lo_dword.data) >> 9) & 0xFF)
592-
#define WX_RXD_IPV6EX(_rxd) \
593-
((le32_to_cpu((_rxd)->wb.lower.lo_dword.data) >> 6) & 0x1)
594593
/*********************** Transmit Descriptor Config Masks ****************/
595594
#define WX_TXD_STAT_DD BIT(0) /* Descriptor Done */
596595
#define WX_TXD_DTYP_DATA 0 /* Adv Data Descriptor */

drivers/net/phy/phy_device.c

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,46 @@ static bool phy_drv_wol_enabled(struct phy_device *phydev)
244244
return wol.wolopts != 0;
245245
}
246246

247+
static void phy_link_change(struct phy_device *phydev, bool up)
248+
{
249+
struct net_device *netdev = phydev->attached_dev;
250+
251+
if (up)
252+
netif_carrier_on(netdev);
253+
else
254+
netif_carrier_off(netdev);
255+
phydev->adjust_link(netdev);
256+
if (phydev->mii_ts && phydev->mii_ts->link_state)
257+
phydev->mii_ts->link_state(phydev->mii_ts, phydev);
258+
}
259+
260+
/**
261+
* phy_uses_state_machine - test whether consumer driver uses PAL state machine
262+
* @phydev: the target PHY device structure
263+
*
264+
* Ultimately, this aims to indirectly determine whether the PHY is attached
265+
* to a consumer which uses the state machine by calling phy_start() and
266+
* phy_stop().
267+
*
268+
* When the PHY driver consumer uses phylib, it must have previously called
269+
* phy_connect_direct() or one of its derivatives, so that phy_prepare_link()
270+
* has set up a hook for monitoring state changes.
271+
*
272+
* When the PHY driver is used by the MAC driver consumer through phylink (the
273+
* only other provider of a phy_link_change() method), using the PHY state
274+
* machine is not optional.
275+
*
276+
* Return: true if consumer calls phy_start() and phy_stop(), false otherwise.
277+
*/
278+
static bool phy_uses_state_machine(struct phy_device *phydev)
279+
{
280+
if (phydev->phy_link_change == phy_link_change)
281+
return phydev->attached_dev && phydev->adjust_link;
282+
283+
/* phydev->phy_link_change is implicitly phylink_phy_change() */
284+
return true;
285+
}
286+
247287
static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
248288
{
249289
struct device_driver *drv = phydev->mdio.dev.driver;
@@ -310,7 +350,7 @@ static __maybe_unused int mdio_bus_phy_suspend(struct device *dev)
310350
* may call phy routines that try to grab the same lock, and that may
311351
* lead to a deadlock.
312352
*/
313-
if (phydev->attached_dev && phydev->adjust_link)
353+
if (phy_uses_state_machine(phydev))
314354
phy_stop_machine(phydev);
315355

316356
if (!mdio_bus_phy_may_suspend(phydev))
@@ -364,7 +404,7 @@ static __maybe_unused int mdio_bus_phy_resume(struct device *dev)
364404
}
365405
}
366406

367-
if (phydev->attached_dev && phydev->adjust_link)
407+
if (phy_uses_state_machine(phydev))
368408
phy_start_machine(phydev);
369409

370410
return 0;
@@ -1055,19 +1095,6 @@ struct phy_device *phy_find_first(struct mii_bus *bus)
10551095
}
10561096
EXPORT_SYMBOL(phy_find_first);
10571097

1058-
static void phy_link_change(struct phy_device *phydev, bool up)
1059-
{
1060-
struct net_device *netdev = phydev->attached_dev;
1061-
1062-
if (up)
1063-
netif_carrier_on(netdev);
1064-
else
1065-
netif_carrier_off(netdev);
1066-
phydev->adjust_link(netdev);
1067-
if (phydev->mii_ts && phydev->mii_ts->link_state)
1068-
phydev->mii_ts->link_state(phydev->mii_ts, phydev);
1069-
}
1070-
10711098
/**
10721099
* phy_prepare_link - prepares the PHY layer to monitor link status
10731100
* @phydev: target phy_device struct

drivers/net/ppp/ppp_synctty.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,11 @@ ppp_sync_txmunge(struct syncppp *ap, struct sk_buff *skb)
506506
unsigned char *data;
507507
int islcp;
508508

509+
/* Ensure we can safely access protocol field and LCP code */
510+
if (!pskb_may_pull(skb, 3)) {
511+
kfree_skb(skb);
512+
return NULL;
513+
}
509514
data = skb->data;
510515
proto = get_unaligned_be16(data);
511516

include/linux/netdevice.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4429,6 +4429,7 @@ void linkwatch_fire_event(struct net_device *dev);
44294429
* pending work list (if queued).
44304430
*/
44314431
void linkwatch_sync_dev(struct net_device *dev);
4432+
void __linkwatch_sync_dev(struct net_device *dev);
44324433

44334434
/**
44344435
* netif_carrier_ok - test if carrier present
@@ -4974,6 +4975,7 @@ void dev_set_rx_mode(struct net_device *dev);
49744975
int dev_set_promiscuity(struct net_device *dev, int inc);
49754976
int netif_set_allmulti(struct net_device *dev, int inc, bool notify);
49764977
int dev_set_allmulti(struct net_device *dev, int inc);
4978+
void netif_state_change(struct net_device *dev);
49774979
void netdev_state_change(struct net_device *dev);
49784980
void __netdev_notify_peers(struct net_device *dev);
49794981
void netdev_notify_peers(struct net_device *dev);

include/linux/rtnetlink.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,6 @@ rtnl_notify_needed(const struct net *net, u16 nlflags, u32 group)
240240
return (nlflags & NLM_F_ECHO) || rtnl_has_listeners(net, group);
241241
}
242242

243-
void netdev_set_operstate(struct net_device *dev, int newstate);
243+
void netif_set_operstate(struct net_device *dev, int newstate);
244244

245245
#endif /* __LINUX_RTNETLINK_H */

include/net/sctp/structs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,7 @@ struct sctp_transport {
775775

776776
/* Reference counting. */
777777
refcount_t refcnt;
778+
__u32 dead:1,
778779
/* RTO-Pending : A flag used to track if one of the DATA
779780
* chunks sent to this address is currently being
780781
* used to compute a RTT. If this flag is 0,
@@ -784,7 +785,7 @@ struct sctp_transport {
784785
* calculation completes (i.e. the DATA chunk
785786
* is SACK'd) clear this flag.
786787
*/
787-
__u32 rto_pending:1,
788+
rto_pending:1,
788789

789790
/*
790791
* hb_sent : a flag that signals that we have a pending

include/net/sock.h

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ struct sk_filter;
339339
* @sk_txtime_unused: unused txtime flags
340340
* @ns_tracker: tracker for netns reference
341341
* @sk_user_frags: xarray of pages the user is holding a reference on.
342+
* @sk_owner: reference to the real owner of the socket that calls
343+
* sock_lock_init_class_and_name().
342344
*/
343345
struct sock {
344346
/*
@@ -547,6 +549,10 @@ struct sock {
547549
struct rcu_head sk_rcu;
548550
netns_tracker ns_tracker;
549551
struct xarray sk_user_frags;
552+
553+
#if IS_ENABLED(CONFIG_PROVE_LOCKING) && IS_ENABLED(CONFIG_MODULES)
554+
struct module *sk_owner;
555+
#endif
550556
};
551557

552558
struct sock_bh_locked {
@@ -1583,6 +1589,35 @@ static inline void sk_mem_uncharge(struct sock *sk, int size)
15831589
sk_mem_reclaim(sk);
15841590
}
15851591

1592+
#if IS_ENABLED(CONFIG_PROVE_LOCKING) && IS_ENABLED(CONFIG_MODULES)
1593+
static inline void sk_owner_set(struct sock *sk, struct module *owner)
1594+
{
1595+
__module_get(owner);
1596+
sk->sk_owner = owner;
1597+
}
1598+
1599+
static inline void sk_owner_clear(struct sock *sk)
1600+
{
1601+
sk->sk_owner = NULL;
1602+
}
1603+
1604+
static inline void sk_owner_put(struct sock *sk)
1605+
{
1606+
module_put(sk->sk_owner);
1607+
}
1608+
#else
1609+
static inline void sk_owner_set(struct sock *sk, struct module *owner)
1610+
{
1611+
}
1612+
1613+
static inline void sk_owner_clear(struct sock *sk)
1614+
{
1615+
}
1616+
1617+
static inline void sk_owner_put(struct sock *sk)
1618+
{
1619+
}
1620+
#endif
15861621
/*
15871622
* Macro so as to not evaluate some arguments when
15881623
* lockdep is not enabled.
@@ -1592,13 +1627,14 @@ static inline void sk_mem_uncharge(struct sock *sk, int size)
15921627
*/
15931628
#define sock_lock_init_class_and_name(sk, sname, skey, name, key) \
15941629
do { \
1630+
sk_owner_set(sk, THIS_MODULE); \
15951631
sk->sk_lock.owned = 0; \
15961632
init_waitqueue_head(&sk->sk_lock.wq); \
15971633
spin_lock_init(&(sk)->sk_lock.slock); \
15981634
debug_check_no_locks_freed((void *)&(sk)->sk_lock, \
1599-
sizeof((sk)->sk_lock)); \
1635+
sizeof((sk)->sk_lock)); \
16001636
lockdep_set_class_and_name(&(sk)->sk_lock.slock, \
1601-
(skey), (sname)); \
1637+
(skey), (sname)); \
16021638
lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \
16031639
} while (0)
16041640

0 commit comments

Comments
 (0)