Linux 5.10.135
Greg Kroah-Hartman
maintainerI'm announcing the release of the 5.10.135 kernel.
All users of the 5.10 kernel series must upgrade.
The updated 5.10.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-5.10.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Documentation/admin-guide/kernel-parameters.txt | 2 Documentation/networking/ip-sysctl.rst | 9 Makefile | 2 arch/arm/include/asm/dma.h | 2 arch/arm/lib/xor-neon.c | 3 arch/s390/include/asm/archrandom.h | 9 arch/x86/kernel/cpu/bugs.c | 1 drivers/edac/ghes_edac.c | 11 drivers/gpu/drm/nouveau/nouveau_dmem.c | 6 drivers/net/ethernet/intel/i40e/i40e_main.c | 4 drivers/net/ethernet/intel/ice/ice_ethtool.c | 3 drivers/net/ethernet/intel/ice/ice_main.c | 8 drivers/net/ethernet/sfc/ptp.c | 22 + drivers/net/macsec.c | 33 +- drivers/net/sungem_phy.c | 1 drivers/net/virtio_net.c | 37 ++ drivers/net/wireless/mediatek/mt7601u/usb.c | 1 drivers/scsi/ufs/ufshcd-pltfrm.c | 15 + fs/ntfs/attrib.c | 8 fs/ocfs2/ocfs2.h | 4 fs/ocfs2/slot_map.c | 46 +-- fs/ocfs2/super.c | 21 - fs/xfs/libxfs/xfs_log_format.h | 11 fs/xfs/libxfs/xfs_types.h | 1 fs/xfs/xfs_buf_item.c | 60 +--- fs/xfs/xfs_buf_item_recover.c | 1 fs/xfs/xfs_dquot_item.c | 2 fs/xfs/xfs_file.c | 81 +++--- fs/xfs/xfs_inode.c | 10 fs/xfs/xfs_inode_item.c | 4 fs/xfs/xfs_inode_item.h | 2 fs/xfs/xfs_inode_item_recover.c | 39 ++- fs/xfs/xfs_log.c | 30 +- fs/xfs/xfs_log.h | 4 fs/xfs/xfs_log_cil.c | 32 -- fs/xfs/xfs_log_priv.h | 15 - fs/xfs/xfs_log_recover.c | 5 fs/xfs/xfs_mount.c | 10 fs/xfs/xfs_trans.c | 6 fs/xfs/xfs_trans.h | 4 include/linux/bpf.h | 10 include/net/addrconf.h | 3 include/net/bluetooth/l2cap.h | 1 include/net/inet_connection_sock.h | 10 include/net/tcp.h | 2 include/uapi/linux/bpf.h | 5 kernel/watch_queue.c | 58 ++-- mm/page_alloc.c | 12 net/bluetooth/l2cap_core.c | 61 +++- net/bpf/test_run.c | 243 ++++++++++++++----- net/core/filter.c | 1 net/ipv4/igmp.c | 24 + net/ipv4/tcp.c | 2 net/ipv4/tcp_input.c | 24 + net/ipv4/tcp_ipv4.c | 4 net/ipv4/tcp_metrics.c | 10 net/ipv4/tcp_output.c | 19 - net/ipv6/ping.c | 6 net/ipv6/tcp_ipv6.c | 4 net/mptcp/protocol.c | 2 net/netfilter/nfnetlink_queue.c | 7 net/sctp/associola.c | 5 net/sctp/stream.c | 19 - net/sctp/stream_sched.c | 2 net/tls/tls_device.c | 7 tools/include/uapi/linux/bpf.h | 5 tools/perf/util/symbol-elf.c | 45 +++ tools/testing/selftests/bpf/test_verifier.c | 4 tools/testing/selftests/bpf/verifier/ctx_sk_lookup.c | 1 69 files changed, 754 insertions(+), 407 deletions(-)
Alejandro Lucero (1):
sfc: disable softirqs for ptp TX
Alistair Popple (1):
nouveau/svm: Fix to migrate all requested pages
Brian Foster (2):
xfs: hold buffer across unpin and potential shutdown processing
xfs: remove dead stale buf unpin handling code
ChenXiaoSong (1):
ntfs: fix use-after-free in ntfs_ucsncmp()
Christoph Hellwig (1):
xfs: refactor xfs_file_fsync
Darrick J. Wong (3):
xfs: prevent UAF in xfs_log_item_in_current_chkpt
xfs: fix log intent recovery ENOSPC shutdowns when inactivating inodes
xfs: force the log offline when log intent item recovery fails
Dave Chinner (3):
xfs: xfs_log_force_lsn isn't passed a LSN
xfs: logging the on disk inode LSN can make it go backwards
xfs: Enforce attr3 buffer recovery order
David Howells (1):
watch_queue: Fix missing rcu annotation
Duoming Zhou (1):
sctp: fix sleep in atomic context bug in timer handlers
Eiichi Tsukata (1):
docs/kernel-parameters: Update descriptions for "mitigations=" param with retbleed
Florian Fainelli (1):
ARM: 9216/1: Fix MAX_DMA_ADDRESS overflow
Florian Westphal (1):
netfilter: nf_queue: do not allow packet truncation below transport header offset
Greg Kroah-Hartman (2):
ARM: crypto: comment out gcc warning that breaks clang builds Linux 5.10.135
Harald Freudenberger (1):
s390/archrandom: prevent CPACF trng invocations in interrupt context
Jaewon Kim (1):
page_alloc: fix invalid watermark check on a negative value
Jason Wang (1):
virtio-net: fix the race between refill work and close
Jianglei Nie (1):
net: macsec: fix potential resource leak in macsec_add_rxsa() and macsec_add_txsa()
Junxiao Bi (1):
Revert "ocfs2: mount shared volume without ha stack"
Kuniyuki Iwashima (19):
tcp: Fix data-races around sysctl_tcp_dsack.
tcp: Fix a data-race around sysctl_tcp_app_win.
tcp: Fix a data-race around sysctl_tcp_adv_win_scale.
tcp: Fix a data-race around sysctl_tcp_frto.
tcp: Fix a data-race around sysctl_tcp_nometrics_save.
tcp: Fix data-races around sysctl_tcp_no_ssthresh_metrics_save.
tcp: Fix data-races around sysctl_tcp_moderate_rcvbuf.
tcp: Fix a data-race around sysctl_tcp_limit_output_bytes.
tcp: Fix a data-race around sysctl_tcp_challenge_ack_limit.
net: ping6: Fix memleak in ipv6_renew_options().
igmp: Fix data-races around sysctl_igmp_qrv.
tcp: Fix a data-race around sysctl_tcp_min_tso_segs.
tcp: Fix a data-race around sysctl_tcp_min_rtt_wlen.
tcp: Fix a data-race around sysctl_tcp_autocorking.
tcp: Fix a data-race around sysctl_tcp_invalid_ratelimit.
tcp: Fix a data-race around sysctl_tcp_comp_sack_delay_ns.
tcp: Fix a data-race around sysctl_tcp_comp_sack_slack_ns.
tcp: Fix a data-race around sysctl_tcp_comp_sack_nr.
tcp: Fix data-races around sysctl_tcp_reflect_tos.
Leo Yan (1):
perf symbol: Correct address for bss symbols
Liang He (2):
scsi: ufs: host: Hold reference returned by of_parse_phandle()
net: sungem_phy: Add of_node_put() for reference returned by of_get_parent()
Linus Torvalds (1):
watch_queue: Fix missing locking in add_watch_to_object()
Lorenz Bauer (3):
bpf: Consolidate shared test timing code
bpf: Add PROG_TEST_RUN support for sk_lookup programs
selftests: bpf: Don't run sk_lookup in verifier tests
Luiz Augusto von Dentz (1):
Bluetooth: L2CAP: Fix use-after-free caused by l2cap_chan_put
Maciej Fijalkowski (2):
ice: check (DD | EOF) bits on Rx descriptor rather than (EOP | RS)
ice: do not setup vlan for loopback VSI
Maxim Mikityanskiy (1):
net/tls: Remove the context from the list in tls_device_down
Michal Maloszewski (1):
i40e: Fix interface init with MSI interrupts (no MSI-X)
Sabrina Dubroca (4):
macsec: fix NULL deref in macsec_add_rxsa
macsec: fix error message in macsec_add_rxsa and _txsa
macsec: limit replay window size with XPN
macsec: always read MACSEC_SA_ATTR_PN as a u64
Thadeu Lima de Souza Cascardo (1):
x86/bugs: Do not enable IBPB at firmware entry when IBPB is not available
Toshi Kani (1):
EDAC/ghes: Set the DIMM label unconditionally
Wei Mingzhi (1):
mt7601u: add USB device ID for some versions of XiaoDu WiFi Dongle.
Wei Wang (1):
Revert "tcp: change pingpong threshold to 3"
Xin Long (2):
Documentation: fix sctp_wmem in ip-sysctl.rst
sctp: leave the err path free in sctp_stream_init to sctp_stream_free
Ziyang Xuan (1):
ipv6/addrconf: fix a null-ptr-deref bug for ip6_ptr
Greg Kroah-Hartman
maintainerDocumentation/admin-guide/kernel-parameters.txt +2 -0
@@ -2873,6 +2873,7 @@ no_entry_flush [PPC] no_uaccess_flush [PPC] mmio_stale_data=off [X86] + retbleed=off [X86] Exceptions: This does not have any effect on
@@ -2895,6 +2896,7 @@ mds=full,nosmt [X86] tsx_async_abort=full,nosmt [X86] mmio_stale_data=full,nosmt [X86] + retbleed=auto,nosmt [X86] mminit_loglevel= [KNL] When CONFIG_DEBUG_MEMORY_INIT is set, this
Documentation/networking/ip-sysctl.rst +8 -1
@@ -2629,7 +2629,14 @@ sctp_rmem - vector of 3 INTEGERs: min, default, max Default: 4K sctp_wmem - vector of 3 INTEGERs: min, default, max - Currently this tunable has no effect. + Only the first value ("min") is used, "default" and "max" are + ignored. + + min: Minimum size of send buffer that can be used by SCTP sockets. + It is guaranteed to each SCTP socket (but not association) even + under moderate memory pressure. + + Default: 4K addr_scope_policy - INTEGER Control IPv4 address scoping - draft-stewart-tsvwg-sctp-ipv4-00
Makefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 5 PATCHLEVEL = 10 -SUBLEVEL = 134 +SUBLEVEL = 135 EXTRAVERSION = NAME = Dare mighty things
arch/arm/include/asm/dma.h +1 -1
@@ -10,7 +10,7 @@#else #define MAX_DMA_ADDRESS ({ \ extern phys_addr_t arm_dma_zone_size; \ - arm_dma_zone_size && arm_dma_zone_size < (0x10000000 - PAGE_OFFSET) ? \ + arm_dma_zone_size && arm_dma_zone_size < (0x100000000ULL - PAGE_OFFSET) ? \ (PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; })#endif
arch/arm/lib/xor-neon.c +2 -1
@@ -26,8 +26,9 @@ MODULE_LICENSE("GPL");* While older versions of GCC do not generate incorrect code, they fail to * recognize the parallel nature of these functions, and emit plain ARM code, * which is known to be slower than the optimized ARM code in asm-arm/xor.h. +* +* #warning This code requires at least version 4.6 of GCC */ -#warning This code requires at least version 4.6 of GCC#endif #pragma GCC diagnostic ignored "-Wunused-variable"
arch/s390/include/asm/archrandom.h +6 -3
@@ -2,7 +2,7 @@/* * Kernel interface for the s390 arch_random_* functions * -* Copyright IBM Corp. 2017, 2020 +* Copyright IBM Corp. 2017, 2022 * * Author: Harald Freudenberger <[email protected]> *
@@ -14,6 +14,7 @@#ifdef CONFIG_ARCH_RANDOM #include <linux/static_key.h> +#include <linux/preempt.h> #include <linux/atomic.h> #include <asm/cpacf.h>
@@ -32,7 +33,8 @@ static inline bool __must_check arch_get_random_int(unsigned int *v)static inline bool __must_check arch_get_random_seed_long (unsigned long *v) { -if (static_branch_likely (&s390_arch_random_available)) { +if (static_branch_likely (&s390_arch_random_available) && +in_task ()) {cpacf_trng (NULL ,0 , (u8 *)v,sizeof (*v));atomic64_add (sizeof (*v), &s390_arch_random_counter);return true;
@@ -42,7 +44,8 @@ static inline bool __must_check arch_get_random_seed_long(unsigned long *v)static inline bool __must_check arch_get_random_seed_int (unsigned int *v) { -if (static_branch_likely (&s390_arch_random_available)) { +if (static_branch_likely (&s390_arch_random_available) && +in_task ()) {cpacf_trng (NULL ,0 , (u8 *)v,sizeof (*v));atomic64_add (sizeof (*v), &s390_arch_random_counter);return true;
arch/x86/kernel/cpu/bugs.c +1 -0
@@ -1476,6 +1476,7 @@ static void __init spectre_v2_select_mitigation(void)* enable IBRS around firmware calls. */ if (boot_cpu_has_bug (X86_BUG_RETBLEED ) && +boot_cpu_has (X86_FEATURE_IBPB ) && (boot_cpu_data.x86_vendor ==X86_VENDOR_AMD || boot_cpu_data.x86_vendor ==X86_VENDOR_HYGON )) {
drivers/edac/ghes_edac.c +8 -3
@@ -101,9 +101,14 @@ static void dimm_setup_label(struct dimm_info *dimm, u16 handle)dmi_memdev_name (handle, &bank, &device); -/* both strings must be non-zero */ -if (bank && *bank && device && *device) -snprintf (dimm->label,sizeof (dimm->label),"%s %s" , bank, device); +/* +* Set to a NULL string when both bank and device are zero. In this case, +* the label assigned by default will be preserved. +*/ +snprintf (dimm->label,sizeof (dimm->label),"%s%s%s" , + (bank && *bank) ? bank :"" , + (bank && *bank && device && *device) ?" " :"" , + (device && *device) ? device :"" ); }static void assign_dmi_dimm_info (struct dimm_info *dimm,struct memdev_dmi_entry *entry)
drivers/gpu/drm/nouveau/nouveau_dmem.c +5 -1
@@ -679,7 +679,11 @@ nouveau_dmem_migrate_vma(struct nouveau_drm *drm, goto out_free_dma;for (i =0 ; i < npages; i += max) { - args.end = start + (max <<PAGE_SHIFT ); +if (args.start + (max <<PAGE_SHIFT ) > end) + args.end = end; +else + args.end = args.start + (max <<PAGE_SHIFT ); + ret =migrate_vma_setup (&args);if (ret) goto out_free_pfns;
drivers/net/ethernet/intel/i40e/i40e_main.c +4 -0
@@ -1907,11 +1907,15 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi,* non-zero req_queue_pairs says that user requested a new * queue count via ethtool's set_channels, so use this * value for queues distribution across traffic classes +* We need at least one queue pair for the interface +* to be usable as we see in else statement. */ if (vsi->req_queue_pairs >0 ) vsi->num_queue_pairs = vsi->req_queue_pairs;else if (pf->flags &I40E_FLAG_MSIX_ENABLED ) vsi->num_queue_pairs = pf->num_lan_msix; +else + vsi->num_queue_pairs =1 ; }/* Number of queues per enabled TC */
drivers/net/ethernet/intel/ice/ice_ethtool.c +2 -1
@@ -652,7 +652,8 @@ static int ice_lbtest_receive_frames(struct ice_ring *rx_ring) rx_desc =ICE_RX_DESC (rx_ring, i);if (!(rx_desc->wb.status_error0 & -cpu_to_le16 (ICE_TX_DESC_CMD_EOP |ICE_TX_DESC_CMD_RS ))) + (cpu_to_le16 (BIT (ICE_RX_FLEX_DESC_STATUS0_DD_S )) | +cpu_to_le16 (BIT (ICE_RX_FLEX_DESC_STATUS0_EOF_S )))))continue ; rx_buf = &rx_ring->rx_buf[i];
drivers/net/ethernet/intel/ice/ice_main.c +5 -3
@@ -5203,10 +5203,12 @@ int ice_vsi_cfg(struct ice_vsi *vsi)if (vsi->netdev) {ice_set_rx_mode (vsi->netdev); - err =ice_vsi_vlan_setup (vsi); +if (vsi->type !=ICE_VSI_LB ) { + err =ice_vsi_vlan_setup (vsi); -if (err) -return err; +if (err) +return err; + } }ice_vsi_cfg_dcb_rings (vsi);
drivers/net/ethernet/sfc/ptp.c +22 -0
@@ -1100,7 +1100,29 @@ static void efx_ptp_xmit_skb_queue(struct efx_nic *efx, struct sk_buff *skb) tx_queue =efx_channel_get_tx_queue (ptp_data->channel, type);if (tx_queue && tx_queue->timestamping) { +/* This code invokes normal driver TX code which is always +* protected from softirqs when called from generic TX code, +* which in turn disables preemption. Look at __dev_queue_xmit +* which uses rcu_read_lock_bh disabling preemption for RCU +* plus disabling softirqs. We do not need RCU reader +* protection here. +* +* Although it is theoretically safe for current PTP TX/RX code +* running without disabling softirqs, there are three good +* reasond for doing so: +* +* 1) The code invoked is mainly implemented for non-PTP +* packets and it is always executed with softirqs +* disabled. +* 2) This being a single PTP packet, better to not +* interrupt its processing by softirqs which can lead +* to high latencies. +* 3) netdev_xmit_more checks preemption is disabled and +* triggers a BUG_ON if not. +*/ +local_bh_disable ();efx_enqueue_skb (tx_queue, skb); +local_bh_enable (); }else {WARN_ONCE (1 ,"PTP channel has no timestamped tx queue\n" );dev_kfree_skb_any (skb);
drivers/net/macsec.c +21 -12
@@ -240,6 +240,7 @@ static struct macsec_cb *macsec_skb_cb(struct sk_buff *skb)#define DEFAULT_SEND_SCI true#define DEFAULT_ENCRYPT false#define DEFAULT_ENCODING_SA 0 +#define MACSEC_XPN_MAX_REPLAY_WINDOW (((1 << 30) - 1))static bool send_sci (const struct macsec_secy *secy) {
@@ -1694,7 +1695,7 @@ static bool validate_add_rxsa(struct nlattr **attrs)return false;if (attrs[MACSEC_SA_ATTR_PN ] && - *(u64 *)nla_data (attrs[MACSEC_SA_ATTR_PN ]) ==0 ) +nla_get_u64 (attrs[MACSEC_SA_ATTR_PN ]) ==0 )return false;if (attrs[MACSEC_SA_ATTR_ACTIVE ]) {
@@ -1750,7 +1751,8 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info) } pn_len = secy->xpn ?MACSEC_XPN_PN_LEN :MACSEC_DEFAULT_PN_LEN ; -if (nla_len (tb_sa[MACSEC_SA_ATTR_PN ]) != pn_len) { +if (tb_sa[MACSEC_SA_ATTR_PN ] && +nla_len (tb_sa[MACSEC_SA_ATTR_PN ]) != pn_len) {pr_notice ("macsec: nl: add_rxsa: bad pn length: %d != %d\n" ,nla_len (tb_sa[MACSEC_SA_ATTR_PN ]), pn_len);rtnl_unlock ();
@@ -1766,7 +1768,7 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info)if (nla_len (tb_sa[MACSEC_SA_ATTR_SALT ]) !=MACSEC_SALT_LEN ) {pr_notice ("macsec: nl: add_rxsa: bad salt length: %d != %d\n" ,nla_len (tb_sa[MACSEC_SA_ATTR_SALT ]), -MACSEC_SA_ATTR_SALT ); +MACSEC_SALT_LEN );rtnl_unlock ();return -EINVAL ; }
@@ -1839,7 +1841,7 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info)return 0 ; cleanup: -kfree (rx_sa); +macsec_rxsa_put (rx_sa);rtnl_unlock ();return err; }
@@ -1936,7 +1938,7 @@ static bool validate_add_txsa(struct nlattr **attrs)if (nla_get_u8 (attrs[MACSEC_SA_ATTR_AN ]) >=MACSEC_NUM_AN )return false; -if (nla_get_u32 (attrs[MACSEC_SA_ATTR_PN ]) ==0 ) +if (nla_get_u64 (attrs[MACSEC_SA_ATTR_PN ]) ==0 )return false;if (attrs[MACSEC_SA_ATTR_ACTIVE ]) {
@@ -2008,7 +2010,7 @@ static int macsec_add_txsa(struct sk_buff *skb, struct genl_info *info)if (nla_len (tb_sa[MACSEC_SA_ATTR_SALT ]) !=MACSEC_SALT_LEN ) {pr_notice ("macsec: nl: add_txsa: bad salt length: %d != %d\n" ,nla_len (tb_sa[MACSEC_SA_ATTR_SALT ]), -MACSEC_SA_ATTR_SALT ); +MACSEC_SALT_LEN );rtnl_unlock ();return -EINVAL ; }
@@ -2082,7 +2084,7 @@ static int macsec_add_txsa(struct sk_buff *skb, struct genl_info *info) cleanup: secy->operational = was_operational; -kfree (tx_sa); +macsec_txsa_put (tx_sa);rtnl_unlock ();return err; }
@@ -2290,7 +2292,7 @@ static bool validate_upd_sa(struct nlattr **attrs)if (nla_get_u8 (attrs[MACSEC_SA_ATTR_AN ]) >=MACSEC_NUM_AN )return false; -if (attrs[MACSEC_SA_ATTR_PN ] &&nla_get_u32 (attrs[MACSEC_SA_ATTR_PN ]) ==0 ) +if (attrs[MACSEC_SA_ATTR_PN ] &&nla_get_u64 (attrs[MACSEC_SA_ATTR_PN ]) ==0 )return false;if (attrs[MACSEC_SA_ATTR_ACTIVE ]) {
@@ -3737,9 +3739,6 @@ static int macsec_changelink_common(struct net_device *dev, secy->operational = tx_sa && tx_sa->active; } -if (data[IFLA_MACSEC_WINDOW ]) - secy->replay_window =nla_get_u32 (data[IFLA_MACSEC_WINDOW ]); -if (data[IFLA_MACSEC_ENCRYPT ]) tx_sc->encrypt = !!nla_get_u8 (data[IFLA_MACSEC_ENCRYPT ]);
@@ -3785,6 +3784,16 @@ static int macsec_changelink_common(struct net_device *dev, } } +if (data[IFLA_MACSEC_WINDOW ]) { + secy->replay_window =nla_get_u32 (data[IFLA_MACSEC_WINDOW ]); + +/* IEEE 802.1AEbw-2013 10.7.8 - maximum replay window +* for XPN cipher suites */ +if (secy->xpn && + secy->replay_window >MACSEC_XPN_MAX_REPLAY_WINDOW ) +return -EINVAL ; + } +return 0 ; }
@@ -3814,7 +3823,7 @@ static int macsec_changelink(struct net_device *dev, struct nlattr *tb[], ret =macsec_changelink_common (dev, data);if (ret) -return ret; + goto cleanup;/* If h/w offloading is available, propagate to the device */ if (macsec_is_offloaded (macsec)) {
drivers/net/sungem_phy.c +1 -0
@@ -454,6 +454,7 @@ static int bcm5421_init(struct mii_phy* phy)int can_low_power =1 ;if (np ==NULL ||of_get_property (np,"no-autolowpower" ,NULL )) can_low_power =0 ; +of_node_put (np);if (can_low_power) {/* Enable automatic low-power */ sungem_phy_write (phy,0x1c ,0x9002 );
drivers/net/virtio_net.c +34 -3
@@ -213,9 +213,15 @@ struct virtnet_info {/* Packet virtio header size */ u8 hdr_len; -/* Work struct for refilling if we run low on memory. */ +/* Work struct for delayed refilling if we run low on memory. */ struct delayed_work refill; +/* Is delayed refill enabled? */ +bool refill_enabled; + +/* The lock to synchronize the access to refill_enabled */ +spinlock_t refill_lock; +/* Work struct for config space updates */ struct work_struct config_work;
@@ -319,6 +325,20 @@ static struct page *get_a_page(struct receive_queue *rq, gfp_t gfp_mask)return p; } +static void enable_delayed_refill (struct virtnet_info *vi) +{ +spin_lock_bh (&vi->refill_lock); + vi->refill_enabled = true; +spin_unlock_bh (&vi->refill_lock); +} + +static void disable_delayed_refill (struct virtnet_info *vi) +{ +spin_lock_bh (&vi->refill_lock); + vi->refill_enabled = false; +spin_unlock_bh (&vi->refill_lock); +} +static void virtqueue_napi_schedule (struct napi_struct *napi,struct virtqueue *vq) {
@@ -1403,8 +1423,12 @@ static int virtnet_receive(struct receive_queue *rq, int budget, }if (rq->vq->num_free >min ((unsigned int )budget,virtqueue_get_vring_size (rq->vq)) /2 ) { -if (!try_fill_recv (vi, rq,GFP_ATOMIC )) -schedule_delayed_work (&vi->refill,0 ); +if (!try_fill_recv (vi, rq,GFP_ATOMIC )) { +spin_lock (&vi->refill_lock); +if (vi->refill_enabled) +schedule_delayed_work (&vi->refill,0 ); +spin_unlock (&vi->refill_lock); + } }u64_stats_update_begin (&rq->stats.syncp);
@@ -1523,6 +1547,8 @@ static int virtnet_open(struct net_device *dev)struct virtnet_info *vi =netdev_priv (dev);int i, err; +enable_delayed_refill (vi); +for (i =0 ; i < vi->max_queue_pairs; i++) {if (i < vi->curr_queue_pairs)/* Make sure we have some buffers: if oom use wq. */
@@ -1893,6 +1919,8 @@ static int virtnet_close(struct net_device *dev)struct virtnet_info *vi =netdev_priv (dev);int i; +/* Make sure NAPI doesn't schedule refill work */ +disable_delayed_refill (vi);/* Make sure refill_work doesn't re-enable napi! */ cancel_delayed_work_sync (&vi->refill);
@@ -2390,6 +2418,8 @@ static int virtnet_restore_up(struct virtio_device *vdev)virtio_device_ready (vdev); +enable_delayed_refill (vi); +if (netif_running (vi->dev)) { err =virtnet_open (vi->dev);if (err)
@@ -3092,6 +3122,7 @@ static int virtnet_probe(struct virtio_device *vdev) vdev->priv = vi;INIT_WORK (&vi->config_work, virtnet_config_changed_work); +spin_lock_init (&vi->refill_lock);/* If we can receive ANY GSO packets, we must allocate large ones. */ if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) ||
drivers/net/wireless/mediatek/mt7601u/usb.c +1 -0
@@ -26,6 +26,7 @@ static const struct usb_device_id mt7601u_device_table[] = { { USB_DEVICE(0x2717, 0x4106) }, { USB_DEVICE(0x2955, 0x0001) }, { USB_DEVICE(0x2955, 0x1001) }, + { USB_DEVICE(0x2955, 0x1003) }, { USB_DEVICE(0x2a5f, 0x1000) }, { USB_DEVICE(0x7392, 0x7710) }, { 0, }
drivers/scsi/ufs/ufshcd-pltfrm.c +13 -2
@@ -107,9 +107,20 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba)return ret; } +static bool phandle_exists (const struct device_node *np, +const char *phandle_name,int index) +{ +struct device_node *parse_np =of_parse_phandle (np, phandle_name, index); + +if (parse_np) +of_node_put (parse_np); + +return parse_np !=NULL ; +} +#define MAX_PROP_SIZE 32static int ufshcd_populate_vreg (struct device *dev,const char *name, -struct ufs_vreg **out_vreg) +struct ufs_vreg **out_vreg) {int ret =0 ;char prop_name[MAX_PROP_SIZE ];
@@ -122,7 +133,7 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name, }snprintf (prop_name,MAX_PROP_SIZE ,"%s-supply" , name); -if (!of_parse_phandle (np, prop_name,0 )) { +if (!phandle_exists (np, prop_name,0 )) {dev_info (dev,"%s: Unable to find %s regulator, assuming enabled\n" , __func__, prop_name); goto out;
fs/ntfs/attrib.c +6 -2
@@ -592,8 +592,12 @@ static int ntfs_attr_find(const ATTR_TYPE type, const ntfschar *name, a = (ATTR_RECORD *)((u8 *)ctx->attr +le32_to_cpu (ctx->attr->length));for (;; a = (ATTR_RECORD *)((u8 *)a +le32_to_cpu (a->length))) { -if ((u8 *)a < (u8 *)ctx->mrec || (u8 *)a > (u8 *)ctx->mrec + -le32_to_cpu (ctx->mrec->bytes_allocated)) +u8 *mrec_end = (u8 *)ctx->mrec + +le32_to_cpu (ctx->mrec->bytes_allocated); +u8 *name_end = (u8 *)a +le16_to_cpu (a->name_offset) + + a->name_length *sizeof (ntfschar); +if ((u8 *)a < (u8 *)ctx->mrec || (u8 *)a > mrec_end || + name_end > mrec_end)break ; ctx->attr = a; if (unlikely(le32_to_cpu(a->type) > le32_to_cpu(type) ||
fs/ocfs2/ocfs2.h +1 -3
@@ -279,7 +279,6 @@ enum ocfs2_mount_optionsOCFS2_MOUNT_JOURNAL_ASYNC_COMMIT =1 <<15 ,/* Journal Async Commit */ OCFS2_MOUNT_ERRORS_CONT =1 <<16 ,/* Return EIO to the calling process on error */ OCFS2_MOUNT_ERRORS_ROFS = 1 << 17, /* Change filesystem to read-only on error */ - OCFS2_MOUNT_NOCLUSTER = 1 << 18, /* No cluster aware filesystem mount */ };#define OCFS2_OSB_SOFT_RO 0x0001
@@ -675,8 +674,7 @@ static inline int ocfs2_cluster_o2cb_global_heartbeat(struct ocfs2_super *osb)static inline int ocfs2_mount_local (struct ocfs2_super *osb) { -return ((osb->s_feature_incompat &OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT ) - || (osb->s_mount_opt &OCFS2_MOUNT_NOCLUSTER )); +return (osb->s_feature_incompat &OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT ); }static inline int ocfs2_uses_extended_slot_map (struct ocfs2_super *osb)
fs/ocfs2/slot_map.c +19 -27
65 lines not on this page · raw message
fs/ocfs2/super.c +0 -21
@@ -175,7 +175,6 @@ enum { Opt_dir_resv_level, Opt_journal_async_commit, Opt_err_cont, - Opt_nocluster, Opt_err, };
@@ -209,7 +208,6 @@ static const match_table_t tokens = { {Opt_dir_resv_level, "dir_resv_level=%u"}, {Opt_journal_async_commit, "journal_async_commit"}, {Opt_err_cont, "errors=continue"}, - {Opt_nocluster, "nocluster"}, {Opt_err, NULL} };
@@ -621,13 +619,6 @@ static int ocfs2_remount(struct super_block *sb, int *flags, char *data) goto out; } - tmp =OCFS2_MOUNT_NOCLUSTER ; -if ((osb->s_mount_opt & tmp) != (parsed_options.mount_opt & tmp)) { - ret = -EINVAL ; -mlog (ML_ERROR ,"Cannot change nocluster option on remount\n" ); - goto out; - } - tmp =OCFS2_MOUNT_HB_LOCAL |OCFS2_MOUNT_HB_GLOBAL |OCFS2_MOUNT_HB_NONE ;if ((osb->s_mount_opt & tmp) != (parsed_options.mount_opt & tmp)) {
@@ -868,7 +859,6 @@ static int ocfs2_verify_userspace_stack(struct ocfs2_super *osb, }if (ocfs2_userspace_stack (osb) && - !(osb->s_mount_opt &OCFS2_MOUNT_NOCLUSTER ) &&strncmp (osb->osb_cluster_stack, mopt->cluster_stack,OCFS2_STACK_LABEL_LEN )) { mlog(ML_ERROR,
@@ -1149,11 +1139,6 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) osb->s_mount_opt &OCFS2_MOUNT_DATA_WRITEBACK ?"writeback" : "ordered"); -if ((osb->s_mount_opt &OCFS2_MOUNT_NOCLUSTER ) && - !(osb->s_feature_incompat &OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT )) -printk (KERN_NOTICE "ocfs2: The shared device (%s) is mounted " -"without cluster aware mode.\n" , osb->dev_str); -atomic_set (&osb->vol_state,VOLUME_MOUNTED );wake_up (&osb->osb_mount_event);
@@ -1460,9 +1445,6 @@ static int ocfs2_parse_options(struct super_block *sb,case Opt_journal_async_commit: mopt->mount_opt |=OCFS2_MOUNT_JOURNAL_ASYNC_COMMIT ;break ; -case Opt_nocluster: - mopt->mount_opt |=OCFS2_MOUNT_NOCLUSTER ; -break ;default :mlog (ML_ERROR , "Unrecognized mount option \"%s\" "
@@ -1574,9 +1556,6 @@ static int ocfs2_show_options(struct seq_file *s, struct dentry *root)if (opts &OCFS2_MOUNT_JOURNAL_ASYNC_COMMIT )seq_printf (s,",journal_async_commit" ); -if (opts &OCFS2_MOUNT_NOCLUSTER ) -seq_printf (s,",nocluster" ); -return 0 ; }
fs/xfs/libxfs/xfs_log_format.h +10 -1
@@ -414,7 +414,16 @@ struct xfs_log_dinode {/* start of the extended dinode, writable fields */ uint32_t di_crc;/* CRC of the inode */ uint64_t di_changecount;/* number of attribute changes */ -xfs_lsn_t di_lsn;/* flush sequence */ + +/* +* The LSN we write to this field during formatting is not a reflection +* of the current on-disk LSN. It should never be used for recovery +* sequencing, nor should it be recovered into the on-disk inode at all. +* See xlog_recover_inode_commit_pass2() and xfs_log_dinode_to_disk() +* for details. +*/ +xfs_lsn_t di_lsn; +uint64_t di_flags2;/* more random flags */ uint32_t di_cowextsize;/* basic cow extent size for file */ uint8_t di_pad2[12 ];/* more padding for future expansion */
fs/xfs/libxfs/xfs_types.h +1 -0
@@ -21,6 +21,7 @@ typedef int32_t xfs_suminfo_t; /* type of bitmap summary info */typedef uint32_t xfs_rtword_t ;/* word type for bitmap manipulations */ typedef int64_t xfs_lsn_t ;/* log sequence number */ +typedef int64_t xfs_csn_t ;/* CIL sequence number */ typedef uint32_t xfs_dablk_t ;/* dir/attr block number (in file) */ typedef uint32_t xfs_dahash_t ;/* dir/attr hash value */
fs/xfs/xfs_buf_item.c +24 -36
99 lines not on this page · raw message
fs/xfs/xfs_buf_item_recover.c +1 -0
@@ -796,6 +796,7 @@ xlog_recover_get_buf_lsn(switch (magicda) {case XFS_DIR3_LEAF1_MAGIC :case XFS_DIR3_LEAFN_MAGIC : +case XFS_ATTR3_LEAF_MAGIC :case XFS_DA3_NODE_MAGIC : lsn =be64_to_cpu (((struct xfs_da3_blkinfo *)blk)->lsn); uuid = &((struct xfs_da3_blkinfo *)blk)->uuid;
fs/xfs/xfs_dquot_item.c +1 -1
@@ -188,7 +188,7 @@ xfs_qm_dquot_logitem_release( STATIC voidxfs_qm_dquot_logitem_committing (struct xfs_log_item *lip, -xfs_lsn_t commit_lsn) +xfs_csn_t seq) {return xfs_qm_dquot_logitem_release (lip); }
fs/xfs/xfs_file.c +50 -31
102 lines not on this page · raw message
fs/xfs/xfs_inode.c +5 -5
@@ -2754,7 +2754,7 @@ xfs_iunpin(trace_xfs_inode_unpin_nowait (ip, _RET_IP_);/* Give the log a push to start the unpinning I/O */ -xfs_log_force_lsn (ip->i_mount, ip->i_itemp->ili_last_lsn,0 ,NULL ); +xfs_log_force_seq (ip->i_mount, ip->i_itemp->ili_commit_seq,0 ,NULL ); }
@@ -3716,16 +3716,16 @@ intxfs_log_force_inode ( struct xfs_inode *ip) { -xfs_lsn_t lsn =0 ; +xfs_csn_t seq =0 ;xfs_ilock (ip,XFS_ILOCK_SHARED );if (xfs_ipincount (ip)) - lsn = ip->i_itemp->ili_last_lsn; + seq = ip->i_itemp->ili_commit_seq;xfs_iunlock (ip,XFS_ILOCK_SHARED ); -if (!lsn) +if (!seq)return 0 ; -return xfs_log_force_lsn (ip->i_mount, lsn,XFS_LOG_SYNC ,NULL ); +return xfs_log_force_seq (ip->i_mount, seq,XFS_LOG_SYNC ,NULL ); }/*
fs/xfs/xfs_inode_item.c +2 -2
@@ -617,9 +617,9 @@ xfs_inode_item_committed( STATIC voidxfs_inode_item_committing (struct xfs_log_item *lip, -xfs_lsn_t commit_lsn) +xfs_csn_t seq) { -INODE_ITEM (lip)->ili_last_lsn = commit_lsn; +INODE_ITEM (lip)->ili_commit_seq = seq;return xfs_inode_item_release (lip); }
fs/xfs/xfs_inode_item.h +1 -1
@@ -33,7 +33,7 @@ struct xfs_inode_log_item {unsigned int ili_fields;/* fields to be logged */ unsigned int ili_fsync_fields;/* logged since last fsync */ xfs_lsn_t ili_flush_lsn;/* lsn at last flush */ -xfs_lsn_t ili_last_lsn;/* lsn at last transaction */ +xfs_csn_t ili_commit_seq;/* last transaction commit */ };static inline int xfs_inode_clean (struct xfs_inode *ip)
fs/xfs/xfs_inode_item_recover.c +29 -10
@@ -145,7 +145,8 @@ xfs_log_dinode_to_disk_ts( STATIC voidxfs_log_dinode_to_disk (struct xfs_log_dinode *from, -struct xfs_dinode *to) +struct xfs_dinode *to, +xfs_lsn_t lsn) { to->di_magic =cpu_to_be16 (from->di_magic); to->di_mode =cpu_to_be16 (from->di_mode);
@@ -182,7 +183,7 @@ xfs_log_dinode_to_disk( to->di_flags2 =cpu_to_be64 (from->di_flags2); to->di_cowextsize =cpu_to_be32 (from->di_cowextsize); to->di_ino =cpu_to_be64 (from->di_ino); - to->di_lsn =cpu_to_be64 (from->di_lsn); + to->di_lsn =cpu_to_be64 (lsn);memcpy (to->di_pad2, from->di_pad2,sizeof (to->di_pad2));uuid_copy (&to->di_uuid, &from->di_uuid); to->di_flushiter =0 ;
@@ -261,16 +262,25 @@ xlog_recover_inode_commit_pass2( }/* -* If the inode has an LSN in it, recover the inode only if it's less -* than the lsn of the transaction we are replaying. Note: we still -* need to replay an owner change even though the inode is more recent -* than the transaction as there is no guarantee that all the btree -* blocks are more recent than this transaction, too. +* If the inode has an LSN in it, recover the inode only if the on-disk +* inode's LSN is older than the lsn of the transaction we are +* replaying. We can have multiple checkpoints with the same start LSN, +* so the current LSN being equal to the on-disk LSN doesn't necessarily +* mean that the on-disk inode is more recent than the change being +* replayed. +* +* We must check the current_lsn against the on-disk inode +* here because the we can't trust the log dinode to contain a valid LSN +* (see comment below before replaying the log dinode for details). +* +* Note: we still need to replay an owner change even though the inode +* is more recent than the transaction as there is no guarantee that all +* the btree blocks are more recent than this transaction, too. */ if (dip->di_version >=3 ) {xfs_lsn_t lsn =be64_to_cpu (dip->di_lsn); -if (lsn && lsn !=-1 &&XFS_LSN_CMP (lsn, current_lsn) >=0 ) { +if (lsn && lsn !=-1 &&XFS_LSN_CMP (lsn, current_lsn) >0 ) {trace_xfs_log_recover_inode_skip (log, in_f); error =0 ; goto out_owner_change;
@@ -368,8 +378,17 @@ xlog_recover_inode_commit_pass2( goto out_release; } -/* recover the log dinode inode into the on disk inode */ -xfs_log_dinode_to_disk (ldip, dip); +/* +* Recover the log dinode inode into the on disk inode. +* +* The LSN in the log dinode is garbage - it can be zero or reflect +* stale in-memory runtime state that isn't coherent with the changes +* logged in this transaction or the changes written to the on-disk +* inode. Hence we write the current lSN into the inode because that +* matches what xfs_iflush() would write inode the inode when flushing +* the changes in this transaction. +*/ +xfs_log_dinode_to_disk (ldip, dip, current_lsn); fields = in_f->ilf_fields;if (fields &XFS_ILOG_DEV )
fs/xfs/xfs_log.c +17 -13
@@ -765,6 +765,9 @@ xfs_log_mount_finish(if (readonly) mp->m_flags |=XFS_MOUNT_RDONLY ; +/* Make sure the log is dead if we're returning failure. */ +ASSERT (!error || (mp->m_log->l_flags &XLOG_IO_ERROR )); +return error; }
@@ -3210,14 +3213,13 @@ xfs_log_force( }static int -__xfs_log_force_lsn ( -struct xfs_mount *mp, +xlog_force_lsn ( +struct xlog *log,xfs_lsn_t lsn,uint flags,int *log_flushed,bool already_slept) { -struct xlog *log = mp->m_log;struct xlog_in_core *iclog;spin_lock (&log->l_icloglock);
@@ -3250,8 +3252,6 @@ __xfs_log_force_lsn(if (!already_slept && (iclog->ic_prev->ic_state ==XLOG_STATE_WANT_SYNC || iclog->ic_prev->ic_state ==XLOG_STATE_SYNCING )) { -XFS_STATS_INC (mp, xs_log_force_sleep); -xlog_wait (&iclog->ic_prev->ic_write_wait, &log->l_icloglock);return -EAGAIN ;
@@ -3289,25 +3289,29 @@ __xfs_log_force_lsn(* to disk, that thread will wake up all threads waiting on the queue. */ int -xfs_log_force_lsn ( +xfs_log_force_seq (struct xfs_mount *mp, -xfs_lsn_t lsn, +xfs_csn_t seq,uint flags,int *log_flushed) { +struct xlog *log = mp->m_log; +xfs_lsn_t lsn;int ret; -ASSERT (lsn !=0 ); +ASSERT (seq !=0 );XFS_STATS_INC (mp, xs_log_force); -trace_xfs_log_force (mp, lsn, _RET_IP_); +trace_xfs_log_force (mp, seq, _RET_IP_); - lsn =xlog_cil_force_lsn (mp->m_log, lsn); + lsn =xlog_cil_force_seq (log, seq);if (lsn ==NULLCOMMITLSN )return 0 ; - ret =__xfs_log_force_lsn (mp, lsn, flags, log_flushed, false); -if (ret == -EAGAIN ) - ret =__xfs_log_force_lsn (mp, lsn, flags, log_flushed, true); + ret =xlog_force_lsn (log, lsn, flags, log_flushed, false); +if (ret == -EAGAIN ) { +XFS_STATS_INC (mp, xs_log_force_sleep); + ret =xlog_force_lsn (log, lsn, flags, log_flushed, true); + }return ret; }
fs/xfs/xfs_log.h +1 -3
@@ -106,7 +106,7 @@ struct xfs_item_ops;struct xfs_trans ;int xfs_log_force (struct xfs_mount *mp,uint flags); -int xfs_log_force_lsn (struct xfs_mount *mp,xfs_lsn_t lsn,uint flags, +int xfs_log_force_seq (struct xfs_mount *mp,xfs_csn_t seq,uint flags,int *log_forced); int xfs_log_mount(struct xfs_mount *mp, struct xfs_buftarg *log_target,
@@ -132,8 +132,6 @@ bool xfs_log_writable(struct xfs_mount *mp);struct xlog_ticket *xfs_log_ticket_get (struct xlog_ticket *ticket);void xfs_log_ticket_put (struct xlog_ticket *ticket); -void xfs_log_commit_cil (struct xfs_mount *mp,struct xfs_trans *tp, -xfs_lsn_t *commit_lsn,bool regrant);void xlog_cil_process_committed (struct list_head *list);bool xfs_log_item_in_current_chkpt (struct xfs_log_item *lip);
fs/xfs/xfs_log_cil.c +12 -20
@@ -777,7 +777,7 @@ xlog_cil_push_work(* that higher sequences will wait for us to write out a commit record * before they do. * -* xfs_log_force_lsn requires us to mirror the new sequence into the cil +* xfs_log_force_seq requires us to mirror the new sequence into the cil * structure atomically with the addition of this sequence to the * committing list. This also ensures that we can do unlocked checks * against the current sequence in log forces without risking
@@ -1020,16 +1020,14 @@ xlog_cil_empty(* allowed again. */ void -xfs_log_commit_cil ( -struct xfs_mount *mp, +xlog_cil_commit ( +struct xlog *log,struct xfs_trans *tp, -xfs_lsn_t *commit_lsn, +xfs_csn_t *commit_seq,bool regrant) { -struct xlog *log = mp->m_log;struct xfs_cil *cil = log->l_cilp;struct xfs_log_item *lip, *next; -xfs_lsn_t xc_commit_lsn;/* * Do all necessary memory allocation before we lock the CIL.
@@ -1043,10 +1041,6 @@ xfs_log_commit_cil(xlog_cil_insert_items (log, tp); - xc_commit_lsn = cil->xc_ctx->sequence; -if (commit_lsn) - *commit_lsn = xc_commit_lsn; -if (regrant && !XLOG_FORCED_SHUTDOWN (log))xfs_log_ticket_regrant (log, tp->t_ticket);else
@@ -1069,8 +1063,10 @@ xfs_log_commit_cil(list_for_each_entry_safe (lip, next, &tp->t_items, li_trans) {xfs_trans_del_item (lip);if (lip->li_ops->iop_committing) - lip->li_ops->iop_committing (lip, xc_commit_lsn); + lip->li_ops->iop_committing (lip, cil->xc_ctx->sequence); } +if (commit_seq) + *commit_seq = cil->xc_ctx->sequence;/* xlog_cil_push_background() releases cil->xc_ctx_lock */ xlog_cil_push_background (log);
@@ -1087,9 +1083,9 @@ xfs_log_commit_cil(* iclog flush is necessary following this call. */ xfs_lsn_t -xlog_cil_force_lsn ( +xlog_cil_force_seq (struct xlog *log, -xfs_lsn_t sequence) +xfs_csn_t sequence) {struct xfs_cil *cil = log->l_cilp;struct xfs_cil_ctx *ctx;
@@ -1183,23 +1179,19 @@ xlog_cil_force_lsn(*/ bool xfs_log_item_in_current_chkpt ( -struct xfs_log_item *lip) +struct xfs_log_item *lip) { -struct xfs_cil_ctx *ctx; +struct xfs_cil *cil = lip->li_mountp->m_log->l_cilp;if (list_empty (&lip->li_cil))return false; - ctx = lip->li_mountp->m_log->l_cilp->xc_ctx; -/* * li_seq is written on the first commit of a log item to record the * first checkpoint it is written to. Hence if it is different to the * current sequence, we're in a new checkpoint. */ -if (XFS_LSN_CMP (lip->li_seq, ctx->sequence) !=0 ) -return false; -return true; +return lip->li_seq ==READ_ONCE (cil->xc_current_sequence); }/*
fs/xfs/xfs_log_priv.h +7 -8
@@ -230,7 +230,7 @@ struct xfs_cil;struct xfs_cil_ctx {struct xfs_cil *cil; -xfs_lsn_t sequence;/* chkpt sequence # */ +xfs_csn_t sequence;/* chkpt sequence # */ xfs_lsn_t start_lsn;/* first LSN of chkpt commit */ xfs_lsn_t commit_lsn;/* chkpt commit record lsn */ struct xlog_ticket *ticket;/* chkpt ticket */
@@ -268,10 +268,10 @@ struct xfs_cil {struct xfs_cil_ctx *xc_ctx;spinlock_t xc_push_lock____cacheline_aligned_in_smp ; -xfs_lsn_t xc_push_seq; +xfs_csn_t xc_push_seq;struct list_head xc_committing;wait_queue_head_t xc_commit_wait; -xfs_lsn_t xc_current_sequence; +xfs_csn_t xc_current_sequence;struct work_struct xc_push_work;wait_queue_head_t xc_push_wait;/* background push throttle */ }____cacheline_aligned_in_smp ;
@@ -547,19 +547,18 @@ int xlog_cil_init(struct xlog *log);void xlog_cil_init_post_recovery (struct xlog *log);void xlog_cil_destroy (struct xlog *log);bool xlog_cil_empty (struct xlog *log); +void xlog_cil_commit (struct xlog *log,struct xfs_trans *tp, +xfs_csn_t *commit_seq,bool regrant);/* * CIL force routines */ -xfs_lsn_t -xlog_cil_force_lsn ( -struct xlog *log, -xfs_lsn_t sequence); +xfs_lsn_t xlog_cil_force_seq (struct xlog *log,xfs_csn_t sequence);static inline void xlog_cil_force (struct xlog *log) { -xlog_cil_force_lsn (log, log->l_cilp->xc_current_sequence); +xlog_cil_force_seq (log, log->l_cilp->xc_current_sequence); }/*
fs/xfs/xfs_log_recover.c +4 -1
@@ -2457,8 +2457,10 @@ xlog_finish_defer_ops( error =xfs_trans_alloc (mp, &resv, dfc->dfc_blkres, dfc->dfc_rtxres,XFS_TRANS_RESERVE , &tp); -if (error) +if (error) { +xfs_force_shutdown (mp,SHUTDOWN_LOG_IO_ERROR );return error; + }/* * Transfer to this new transaction all the dfops we captured
@@ -3454,6 +3456,7 @@ xlog_recover_finish(* this) before we get around to xfs_log_mount_cancel. */ xlog_recover_cancel_intents (log); +xfs_force_shutdown (log->l_mp,SHUTDOWN_LOG_IO_ERROR );xfs_alert (log->l_mp,"Failed to recover intents" );return error; }
fs/xfs/xfs_mount.c +9 -1
@@ -968,9 +968,17 @@ xfs_mountfs(/* * Finish recovering the file system. This part needed to be delayed * until after the root and real-time bitmap inodes were consistently -* read in. +* read in. Temporarily create per-AG space reservations for metadata +* btree shape changes because space freeing transactions (for inode +* inactivation) require the per-AG reservation in lieu of reserving +* blocks. */ + error =xfs_fs_reserve_ag_blocks (mp); +if (error && error == -ENOSPC ) +xfs_warn (mp, +"ENOSPC reserving per-AG metadata pool, log recovery may fail." ); error =xfs_log_mount_finish (mp); +xfs_fs_unreserve_ag_blocks (mp);if (error) {xfs_warn (mp,"log mount finish failed" ); goto out_rtunmount;
fs/xfs/xfs_trans.c +3 -3
@@ -832,7 +832,7 @@ __xfs_trans_commit( bool regrant) {struct xfs_mount *mp = tp->t_mountp; -xfs_lsn_t commit_lsn =-1 ; +xfs_csn_t commit_seq =0 ;int error =0 ;int sync = tp->t_flags &XFS_TRANS_SYNC ;
@@ -874,7 +874,7 @@ __xfs_trans_commit(xfs_trans_apply_sb_deltas (tp);xfs_trans_apply_dquot_deltas (tp); -xfs_log_commit_cil (mp, tp, &commit_lsn, regrant); +xlog_cil_commit (mp->m_log, tp, &commit_seq, regrant);xfs_trans_free (tp);
@@ -883,7 +883,7 @@ __xfs_trans_commit(* log out now and wait for it. */ if (sync) { - error =xfs_log_force_lsn (mp, commit_lsn,XFS_LOG_SYNC ,NULL ); + error =xfs_log_force_seq (mp, commit_seq,XFS_LOG_SYNC ,NULL );XFS_STATS_INC (mp, xs_trans_sync); }else {XFS_STATS_INC (mp, xs_trans_async);
fs/xfs/xfs_trans.h +2 -2
@@ -43,7 +43,7 @@ struct xfs_log_item {struct list_head li_cil;/* CIL pointers */ struct xfs_log_vec *li_lv;/* active log vector */ struct xfs_log_vec *li_lv_shadow;/* standby vector */ -xfs_lsn_t li_seq;/* CIL commit seq */ +xfs_csn_t li_seq;/* CIL commit seq */ };/*
@@ -69,7 +69,7 @@ struct xfs_item_ops {void (*iop_pin)(struct xfs_log_item *);void (*iop_unpin)(struct xfs_log_item *,int remove);uint (*iop_push)(struct xfs_log_item *,struct list_head *); -void (*iop_committing)(struct xfs_log_item *,xfs_lsn_t commit_lsn); +void (*iop_committing)(struct xfs_log_item *lip,xfs_csn_t seq);void (*iop_release)(struct xfs_log_item *);xfs_lsn_t (*iop_committed)(struct xfs_log_item *,xfs_lsn_t ); int (*iop_recover)(struct xfs_log_item *lip,
include/linux/bpf.h +10 -0
@@ -1457,6 +1457,9 @@ int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog,int bpf_prog_test_run_raw_tp (struct bpf_prog *prog,const union bpf_attr *kattr,union bpf_attr __user *uattr); +int bpf_prog_test_run_sk_lookup (struct bpf_prog *prog, +const union bpf_attr *kattr, +union bpf_attr __user *uattr);bool btf_ctx_access (int off,int size,enum bpf_access_type type,const struct bpf_prog *prog,struct bpf_insn_access_aux *info);
@@ -1671,6 +1674,13 @@ static inline int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog,return -ENOTSUPP ; } +static inline int bpf_prog_test_run_sk_lookup (struct bpf_prog *prog, +const union bpf_attr *kattr, +union bpf_attr __user *uattr) +{ +return -ENOTSUPP ; +} +static inline void bpf_map_put (struct bpf_map *map) { }
include/net/addrconf.h +3 -0
@@ -405,6 +405,9 @@ static inline bool ip6_ignore_linkdown(const struct net_device *dev) {const struct inet6_dev *idev =__in6_dev_get (dev); +if (unlikely (!idev)) +return true; +return !!idev->cnf.ignore_routes_with_linkdown; }
include/net/bluetooth/l2cap.h +1 -0
@@ -845,6 +845,7 @@ enum { };void l2cap_chan_hold (struct l2cap_chan *c); +struct l2cap_chan *l2cap_chan_hold_unless_zero (struct l2cap_chan *c);void l2cap_chan_put (struct l2cap_chan *c);static inline void l2cap_chan_lock (struct l2cap_chan *chan)
include/net/inet_connection_sock.h +1 -9
@@ -317,7 +317,7 @@ void inet_csk_update_fastreuse(struct inet_bind_bucket *tb,struct dst_entry *inet_csk_update_pmtu (struct sock *sk,u32 mtu); -#define TCP_PINGPONG_THRESH 3 +#define TCP_PINGPONG_THRESH 1static inline void inet_csk_enter_pingpong_mode (struct sock *sk) {
@@ -334,14 +334,6 @@ static inline bool inet_csk_in_pingpong_mode(struct sock *sk)return inet_csk (sk)->icsk_ack.pingpong >=TCP_PINGPONG_THRESH ; } -static inline void inet_csk_inc_pingpong_cnt (struct sock *sk) -{ -struct inet_connection_sock *icsk =inet_csk (sk); - -if (icsk->icsk_ack.pingpong <U8_MAX ) - icsk->icsk_ack.pingpong++; -} -static inline bool inet_csk_has_ulp (struct sock *sk) {return inet_sk (sk)->is_icsk && !!inet_csk (sk)->icsk_ulp_ops;
include/net/tcp.h +1 -1
@@ -1396,7 +1396,7 @@ void tcp_select_initial_window(const struct sock *sk, int __space,static inline int tcp_win_from_space (const struct sock *sk,int space) { -int tcp_adv_win_scale =sock_net (sk)->ipv4.sysctl_tcp_adv_win_scale; +int tcp_adv_win_scale =READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_adv_win_scale);return tcp_adv_win_scale <=0 ? (space>>(-tcp_adv_win_scale)) :
include/uapi/linux/bpf.h +4 -1
@@ -5007,7 +5007,10 @@ struct bpf_pidns_info {/* User accessible data for SK_LOOKUP programs. Add new fields at the end. */ struct bpf_sk_lookup { - __bpf_md_ptr(struct bpf_sock *, sk); /* Selected socket */ +union { + __bpf_md_ptr(struct bpf_sock *, sk); /* Selected socket */ +__u64 cookie;/* Non-zero if socket was selected in PROG_TEST_RUN */ + };__u32 family;/* Protocol family (AF_INET, AF_INET6) */ __u32 protocol;/* IP protocol (IPPROTO_TCP, IPPROTO_UDP) */
kernel/watch_queue.c +36 -22
76 lines not on this page · raw message
mm/page_alloc.c +8 -4
@@ -3679,11 +3679,15 @@ static inline bool zone_watermark_fast(struct zone *z, unsigned int order,* need to be calculated. */ if (!order) { -long fast_free; +long usable_free; +long reserved; - fast_free = free_pages; - fast_free -=__zone_watermark_unusable_free (z,0 , alloc_flags); -if (fast_free > mark + z->lowmem_reserve[highest_zoneidx]) + usable_free = free_pages; + reserved =__zone_watermark_unusable_free (z,0 , alloc_flags); + +/* reserved may over estimate high-atomic reserves. */ + usable_free -=min (usable_free, reserved); +if (usable_free > mark + z->lowmem_reserve[highest_zoneidx])return true; }
net/bluetooth/l2cap_core.c +48 -13
180 lines not on this page · raw message
net/bpf/test_run.c +182 -61
307 lines not on this page · raw message
net/core/filter.c +1 -0
@@ -10334,6 +10334,7 @@ static u32 sk_lookup_convert_ctx_access(enum bpf_access_type type, }const struct bpf_prog_ops sk_lookup_prog_ops = { + .test_run = bpf_prog_test_run_sk_lookup, };const struct bpf_verifier_ops sk_lookup_verifier_ops = {
net/ipv4/igmp.c +13 -11
@@ -827,7 +827,7 @@ static void igmp_ifc_event(struct in_device *in_dev)struct net *net =dev_net (in_dev->dev);if (IGMP_V1_SEEN (in_dev) ||IGMP_V2_SEEN (in_dev))return ; -WRITE_ONCE (in_dev->mr_ifc_count, in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv); +WRITE_ONCE (in_dev->mr_ifc_count, in_dev->mr_qrv ?:READ_ONCE (net->ipv4.sysctl_igmp_qrv));igmp_ifc_start_timer (in_dev,1 ); }
@@ -1009,7 +1009,7 @@ static bool igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb,* received value was zero, use the default or statically * configured value. */ - in_dev->mr_qrv = ih3->qrv ?: net->ipv4.sysctl_igmp_qrv; + in_dev->mr_qrv = ih3->qrv ?:READ_ONCE (net->ipv4.sysctl_igmp_qrv); in_dev->mr_qi =IGMPV3_QQIC (ih3->qqic)*HZ ?:IGMP_QUERY_INTERVAL ;/* RFC3376, 8.3. Query Response Interval:
@@ -1189,7 +1189,7 @@ static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im, pmc->interface = im->interface;in_dev_hold (in_dev); pmc->multiaddr = im->multiaddr; - pmc->crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv; + pmc->crcount = in_dev->mr_qrv ?:READ_ONCE (net->ipv4.sysctl_igmp_qrv); pmc->sfmode = im->sfmode;if (pmc->sfmode ==MCAST_INCLUDE ) {struct ip_sf_list *psf;
@@ -1240,9 +1240,11 @@ static void igmpv3_del_delrec(struct in_device *in_dev, struct ip_mc_list *im)swap (im->tomb, pmc->tomb);swap (im->sources, pmc->sources);for (psf = im->sources; psf; psf = psf->sf_next) - psf->sf_crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv; + psf->sf_crcount = in_dev->mr_qrv ?: +READ_ONCE (net->ipv4.sysctl_igmp_qrv); }else { - im->crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv; + im->crcount = in_dev->mr_qrv ?: +READ_ONCE (net->ipv4.sysctl_igmp_qrv); }in_dev_put (pmc->interface);kfree_pmc (pmc);
@@ -1349,7 +1351,7 @@ static void igmp_group_added(struct ip_mc_list *im)if (in_dev->dead)return ; - im->unsolicit_count = net->ipv4.sysctl_igmp_qrv; + im->unsolicit_count =READ_ONCE (net->ipv4.sysctl_igmp_qrv);if (IGMP_V1_SEEN (in_dev) ||IGMP_V2_SEEN (in_dev)) {spin_lock_bh (&im->lock);igmp_start_timer (im,IGMP_INITIAL_REPORT_DELAY );
@@ -1363,7 +1365,7 @@ static void igmp_group_added(struct ip_mc_list *im)* IN() to IN(A). */ if (im->sfmode ==MCAST_EXCLUDE ) - im->crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv; + im->crcount = in_dev->mr_qrv ?:READ_ONCE (net->ipv4.sysctl_igmp_qrv);igmp_ifc_event (in_dev);#endif
@@ -1754,7 +1756,7 @@ static void ip_mc_reset(struct in_device *in_dev) in_dev->mr_qi =IGMP_QUERY_INTERVAL ; in_dev->mr_qri =IGMP_QUERY_RESPONSE_INTERVAL ; - in_dev->mr_qrv = net->ipv4.sysctl_igmp_qrv; + in_dev->mr_qrv = READ_ONCE(net->ipv4.sysctl_igmp_qrv); }#else static void ip_mc_reset (struct in_device *in_dev)
@@ -1888,7 +1890,7 @@ static int ip_mc_del1_src(struct ip_mc_list *pmc, int sfmode,#ifdef CONFIG_IP_MULTICAST if (psf->sf_oldin && !IGMP_V1_SEEN (in_dev) && !IGMP_V2_SEEN (in_dev)) { - psf->sf_crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv; + psf->sf_crcount = in_dev->mr_qrv ?:READ_ONCE (net->ipv4.sysctl_igmp_qrv); psf->sf_next = pmc->tomb; pmc->tomb = psf; rv =1 ;
@@ -1952,7 +1954,7 @@ static int ip_mc_del_src(struct in_device *in_dev, __be32 *pmca, int sfmode,/* filter mode change */ pmc->sfmode =MCAST_INCLUDE ;#ifdef CONFIG_IP_MULTICAST - pmc->crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv; + pmc->crcount = in_dev->mr_qrv ?:READ_ONCE (net->ipv4.sysctl_igmp_qrv);WRITE_ONCE (in_dev->mr_ifc_count, pmc->crcount);for (psf = pmc->sources; psf; psf = psf->sf_next) psf->sf_crcount =0 ;
@@ -2131,7 +2133,7 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode,#ifdef CONFIG_IP_MULTICAST /* else no filters; keep old mode for reports */ - pmc->crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv; + pmc->crcount = in_dev->mr_qrv ?:READ_ONCE (net->ipv4.sysctl_igmp_qrv);WRITE_ONCE (in_dev->mr_ifc_count, pmc->crcount);for (psf = pmc->sources; psf; psf = psf->sf_next) psf->sf_crcount =0 ;
net/ipv4/tcp.c +1 -1
@@ -698,7 +698,7 @@ static bool tcp_should_autocork(struct sock *sk, struct sk_buff *skb, int size_goal) {return skb->len < size_goal && -sock_net (sk)->ipv4.sysctl_tcp_autocorking && +READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_autocorking) && !tcp_rtx_queue_empty (sk) &&refcount_read (&sk->sk_wmem_alloc) > skb->truesize; }
net/ipv4/tcp_input.c +13 -11
@@ -503,7 +503,7 @@ static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb)*/ static void tcp_init_buffer_space (struct sock *sk) { -int tcp_app_win =sock_net (sk)->ipv4.sysctl_tcp_app_win; +int tcp_app_win =READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_app_win);struct tcp_sock *tp =tcp_sk (sk);int maxwin;
@@ -693,7 +693,7 @@ void tcp_rcv_space_adjust(struct sock *sk)* <prev RTT . ><current RTT .. ><next RTT .... > */ -if (sock_net (sk)->ipv4.sysctl_tcp_moderate_rcvbuf && +if (READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_moderate_rcvbuf) && !(sk->sk_userlocks &SOCK_RCVBUF_LOCK )) {int rcvmem, rcvbuf;u64 rcvwin, grow;
@@ -2135,7 +2135,7 @@ void tcp_enter_loss(struct sock *sk)* loss recovery is underway except recurring timeout(s) on * the same SND.UNA (sec 3.2). Disable F-RTO on path MTU probing */ - tp->frto = net->ipv4.sysctl_tcp_frto && + tp->frto =READ_ONCE (net->ipv4.sysctl_tcp_frto) && (new_recovery || icsk->icsk_retransmits) && !inet_csk (sk)->icsk_mtup.probe_size; }
@@ -3004,7 +3004,7 @@ static void tcp_fastretrans_alert(struct sock *sk, const u32 prior_snd_una,static void tcp_update_rtt_min (struct sock *sk,u32 rtt_us,const int flag) { -u32 wlen =sock_net (sk)->ipv4.sysctl_tcp_min_rtt_wlen *HZ ; +u32 wlen =READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_min_rtt_wlen) *HZ ;struct tcp_sock *tp =tcp_sk (sk);if ((flag &FLAG_ACK_MAYBE_DELAYED ) && rtt_us >tcp_min_rtt (tp)) {
@@ -3528,7 +3528,8 @@ static bool __tcp_oow_rate_limited(struct net *net, int mib_idx,if (*last_oow_ack_time) {s32 elapsed = (s32)(tcp_jiffies32 - *last_oow_ack_time); -if (0 <= elapsed && elapsed < net->ipv4.sysctl_tcp_invalid_ratelimit) { +if (0 <= elapsed && + elapsed <READ_ONCE (net->ipv4.sysctl_tcp_invalid_ratelimit)) {NET_INC_STATS (net, mib_idx);return true;/* rate-limited: don't send yet! */ }
@@ -3576,7 +3577,7 @@ static void tcp_send_challenge_ack(struct sock *sk, const struct sk_buff *skb)/* Then check host-wide RFC 5961 rate limit. */ now = jiffies /HZ ;if (now != challenge_timestamp) { -u32 ack_limit = net->ipv4.sysctl_tcp_challenge_ack_limit; +u32 ack_limit =READ_ONCE (net->ipv4.sysctl_tcp_challenge_ack_limit);u32 half = (ack_limit +1 ) >>1 ; challenge_timestamp = now;
@@ -4367,7 +4368,7 @@ static void tcp_dsack_set(struct sock *sk, u32 seq, u32 end_seq) {struct tcp_sock *tp =tcp_sk (sk); -if (tcp_is_sack (tp) &&sock_net (sk)->ipv4.sysctl_tcp_dsack) { +if (tcp_is_sack (tp) &&READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_dsack)) {int mib_idx;if (before (seq, tp->rcv_nxt))
@@ -4414,7 +4415,7 @@ static void tcp_send_dupack(struct sock *sk, const struct sk_buff *skb)NET_INC_STATS (sock_net (sk),LINUX_MIB_DELAYEDACKLOST );tcp_enter_quickack_mode (sk,TCP_MAX_QUICKACKS ); -if (tcp_is_sack (tp) &&sock_net (sk)->ipv4.sysctl_tcp_dsack) { +if (tcp_is_sack (tp) &&READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_dsack)) {u32 end_seq =TCP_SKB_CB (skb)->end_seq;tcp_rcv_spurious_retrans (sk, skb);
@@ -5439,7 +5440,7 @@ static void __tcp_ack_snd_check(struct sock *sk, int ofo_possible) }if (!tcp_is_sack (tp) || - tp->compressed_ack >=sock_net (sk)->ipv4.sysctl_tcp_comp_sack_nr) + tp->compressed_ack >=READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_comp_sack_nr)) goto send_now;if (tp->compressed_ack_rcv_nxt != tp->rcv_nxt) {
@@ -5460,11 +5461,12 @@ static void __tcp_ack_snd_check(struct sock *sk, int ofo_possible)if (tp->srtt_us && tp->srtt_us < rtt) rtt = tp->srtt_us; - delay = min_t(unsigned long, sock_net(sk)->ipv4.sysctl_tcp_comp_sack_delay_ns, + delay = min_t(unsigned long, +READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_comp_sack_delay_ns), rtt * (NSEC_PER_USEC >>3 )/20 );sock_hold (sk);hrtimer_start_range_ns (&tp->compressed_ack_timer,ns_to_ktime (delay), -sock_net (sk)->ipv4.sysctl_tcp_comp_sack_slack_ns, +READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_comp_sack_slack_ns),HRTIMER_MODE_REL_PINNED_SOFT ); }
net/ipv4/tcp_ipv4.c +2 -2
@@ -983,7 +983,7 @@ static int tcp_v4_send_synack(const struct sock *sk, struct dst_entry *dst,if (skb) {__tcp_v4_send_check (skb, ireq->ir_loc_addr, ireq->ir_rmt_addr); - tos =sock_net (sk)->ipv4.sysctl_tcp_reflect_tos ? + tos =READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_reflect_tos) ? (tcp_rsk (req)->syn_tos & ~INET_ECN_MASK ) | (inet_sk (sk)->tos &INET_ECN_MASK ) :inet_sk (sk)->tos;
@@ -1558,7 +1558,7 @@ struct sock *tcp_v4_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,/* Set ToS of the new socket based upon the value of incoming SYN. * ECT bits are set later in tcp_init_transfer(). */ -if (sock_net (sk)->ipv4.sysctl_tcp_reflect_tos) +if (READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_reflect_tos)) newinet->tos =tcp_rsk (req)->syn_tos & ~INET_ECN_MASK ;if (!dst) {
net/ipv4/tcp_metrics.c +5 -5
@@ -329,7 +329,7 @@ void tcp_update_metrics(struct sock *sk)int m;sk_dst_confirm (sk); -if (net->ipv4.sysctl_tcp_nometrics_save || !dst) +if (READ_ONCE (net->ipv4.sysctl_tcp_nometrics_save) || !dst)return ;rcu_read_lock ();
@@ -385,7 +385,7 @@ void tcp_update_metrics(struct sock *sk)if (tcp_in_initial_slowstart (tp)) {/* Slow start still did not finish. */ -if (!net->ipv4.sysctl_tcp_no_ssthresh_metrics_save && +if (!READ_ONCE (net->ipv4.sysctl_tcp_no_ssthresh_metrics_save) && !tcp_metric_locked (tm,TCP_METRIC_SSTHRESH )) { val =tcp_metric_get (tm,TCP_METRIC_SSTHRESH );if (val && (tp->snd_cwnd >>1 ) > val)
@@ -401,7 +401,7 @@ void tcp_update_metrics(struct sock *sk) }else if (!tcp_in_slow_start (tp) && icsk->icsk_ca_state == TCP_CA_Open) {/* Cong. avoidance phase, cwnd is reliable. */ -if (!net->ipv4.sysctl_tcp_no_ssthresh_metrics_save && +if (!READ_ONCE (net->ipv4.sysctl_tcp_no_ssthresh_metrics_save) && !tcp_metric_locked (tm,TCP_METRIC_SSTHRESH ))tcp_metric_set (tm,TCP_METRIC_SSTHRESH ,max (tp->snd_cwnd >>1 , tp->snd_ssthresh));
@@ -418,7 +418,7 @@ void tcp_update_metrics(struct sock *sk)tcp_metric_set (tm,TCP_METRIC_CWND , (val + tp->snd_ssthresh) >>1 ); } -if (!net->ipv4.sysctl_tcp_no_ssthresh_metrics_save && +if (!READ_ONCE (net->ipv4.sysctl_tcp_no_ssthresh_metrics_save) && !tcp_metric_locked (tm,TCP_METRIC_SSTHRESH )) { val =tcp_metric_get (tm,TCP_METRIC_SSTHRESH );if (val && tp->snd_ssthresh > val)
@@ -463,7 +463,7 @@ void tcp_init_metrics(struct sock *sk)if (tcp_metric_locked (tm,TCP_METRIC_CWND )) tp->snd_cwnd_clamp =tcp_metric_get (tm,TCP_METRIC_CWND ); - val = net->ipv4.sysctl_tcp_no_ssthresh_metrics_save ? + val =READ_ONCE (net->ipv4.sysctl_tcp_no_ssthresh_metrics_save) ?0 :tcp_metric_get (tm,TCP_METRIC_SSTHRESH );if (val) { tp->snd_ssthresh = val;
net/ipv4/tcp_output.c +8 -11
@@ -167,16 +167,13 @@ static void tcp_event_data_sent(struct tcp_sock *tp,if (tcp_packets_in_flight (tp) ==0 )tcp_ca_event (sk,CA_EVENT_TX_START ); -/* If this is the first data packet sent in response to the -* previous received data, -* and it is a reply for ato after last received packet, -* increase pingpong count. -*/ -if (before (tp->lsndtime, icsk->icsk_ack.lrcvtime) && - (u32)(now - icsk->icsk_ack.lrcvtime) < icsk->icsk_ack.ato) -inet_csk_inc_pingpong_cnt (sk); - tp->lsndtime = now; + +/* If it is a reply for ato after last received +* packet, enter pingpong mode. +*/ +if ((u32)(now - icsk->icsk_ack.lrcvtime) < icsk->icsk_ack.ato) +inet_csk_enter_pingpong_mode (sk); }/* Account for an ACK we sent. */
@@ -1987,7 +1984,7 @@ static u32 tcp_tso_segs(struct sock *sk, unsigned int mss_now) min_tso = ca_ops->min_tso_segs ? ca_ops->min_tso_segs (sk) : -sock_net (sk)->ipv4.sysctl_tcp_min_tso_segs; +READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_min_tso_segs); tso_segs =tcp_tso_autosize (sk, mss_now, min_tso);return min_t (u32, tso_segs, sk->sk_gso_max_segs);
@@ -2502,7 +2499,7 @@ static bool tcp_small_queue_check(struct sock *sk, const struct sk_buff *skb, sk->sk_pacing_rate >> READ_ONCE(sk->sk_pacing_shift));if (sk->sk_pacing_status ==SK_PACING_NONE ) limit = min_t(unsigned long, limit, -sock_net (sk)->ipv4.sysctl_tcp_limit_output_bytes); +READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_limit_output_bytes)); limit <<= factor; if (static_branch_unlikely(&tcp_tx_delay_enabled) &&
net/ipv6/ping.c +6 -0
@@ -22,6 +22,11 @@#include <linux/proc_fs.h> #include <net/ping.h> +static void ping_v6_destroy (struct sock *sk) +{ +inet6_destroy_sock (sk); +} +/* Compatibility glue so we can support IPv6 when it's compiled as a module */ static int dummy_ipv6_recv_error (struct sock *sk,struct msghdr *msg,int len,int *addr_len)
@@ -166,6 +171,7 @@ struct proto pingv6_prot = { .owner = THIS_MODULE, .init = ping_init_sock, .close = ping_close, + .destroy = ping_v6_destroy, .connect = ip6_datagram_connect_v6_only, .disconnect = __udp_disconnect, .setsockopt = ipv6_setsockopt,
net/ipv6/tcp_ipv6.c +2 -2
@@ -542,7 +542,7 @@ static int tcp_v6_send_synack(const struct sock *sk, struct dst_entry *dst,if (np->repflow && ireq->pktopts) fl6->flowlabel =ip6_flowlabel (ipv6_hdr (ireq->pktopts)); - tclass =sock_net (sk)->ipv4.sysctl_tcp_reflect_tos ? + tclass =READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_reflect_tos) ? (tcp_rsk (req)->syn_tos & ~INET_ECN_MASK ) | (np->tclass &INET_ECN_MASK ) : np->tclass;
@@ -1344,7 +1344,7 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff */* Set ToS of the new socket based upon the value of incoming SYN. * ECT bits are set later in tcp_init_transfer(). */ -if (sock_net (sk)->ipv4.sysctl_tcp_reflect_tos) +if (READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_reflect_tos)) newnp->tclass =tcp_rsk (req)->syn_tos & ~INET_ECN_MASK ;/* Clone native IPv6 options from listening socket (if any)
net/mptcp/protocol.c +1 -1
@@ -1421,7 +1421,7 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied)if (msk->rcvq_space.copied <= msk->rcvq_space.space) goto new_measure; -if (sock_net (sk)->ipv4.sysctl_tcp_moderate_rcvbuf && +if (READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_moderate_rcvbuf) && !(sk->sk_userlocks &SOCK_RCVBUF_LOCK )) {int rcvmem, rcvbuf;u64 rcvwin, grow;
net/netfilter/nfnetlink_queue.c +6 -1
@@ -838,11 +838,16 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum) }static int -nfqnl_mangle (void *data,int data_len,struct nf_queue_entry *e,int diff) +nfqnl_mangle (void *data,unsigned int data_len,struct nf_queue_entry *e,int diff) {struct sk_buff *nskb;if (diff <0 ) { +unsigned int min_len =skb_transport_offset (e->skb); + +if (data_len < min_len) +return -EINVAL ; +if (pskb_trim (e->skb, data_len))return -ENOMEM ; }else if (diff >0 ) {
net/sctp/associola.c +2 -3
@@ -226,9 +226,8 @@ static struct sctp_association *sctp_association_init(if (!sctp_ulpq_init (&asoc->ulpq, asoc)) goto fail_init; -if (sctp_stream_init (&asoc->stream, asoc->c.sinit_num_ostreams, -0 , gfp)) - goto fail_init; +if (sctp_stream_init (&asoc->stream, asoc->c.sinit_num_ostreams,0 , gfp)) + goto stream_free;/* Initialize default path MTU. */ asoc->pathmtu = sp->pathmtu;
net/sctp/stream.c +3 -16
@@ -137,7 +137,7 @@ int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt, ret =sctp_stream_alloc_out (stream, outcnt, gfp);if (ret) - goto out_err; +return ret;for (i =0 ; i < stream->outcnt; i++)SCTP_SO (stream, i)->state =SCTP_STREAM_OPEN ;
@@ -145,22 +145,9 @@ int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt, handle_in:sctp_stream_interleave_init (stream);if (!incnt) - goto out; - - ret =sctp_stream_alloc_in (stream, incnt, gfp); -if (ret) - goto in_err; - - goto out; +return 0 ; -in_err: - sched->free (stream); -genradix_free (&stream->in); -out_err: -genradix_free (&stream->out); - stream->outcnt =0 ; -out: -return ret; +return sctp_stream_alloc_in (stream, incnt, gfp); }int sctp_stream_init_ext (struct sctp_stream *stream,__u16 sid)
net/sctp/stream_sched.c +1 -1
@@ -163,7 +163,7 @@ int sctp_sched_set_sched(struct sctp_association *asoc,if (!SCTP_SO (&asoc->stream, i)->ext)continue ; - ret = n->init_sid (&asoc->stream, i,GFP_KERNEL ); + ret = n->init_sid (&asoc->stream, i,GFP_ATOMIC );if (ret) goto err; }
net/tls/tls_device.c +6 -1
@@ -1349,8 +1349,13 @@ static int tls_device_down(struct net_device *netdev)* by tls_device_free_ctx. rx_conf and tx_conf stay in TLS_HW. * Now release the ref taken above. */ -if (refcount_dec_and_test (&ctx->refcount)) +if (refcount_dec_and_test (&ctx->refcount)) { +/* sk_destruct ran after tls_device_down took a ref, and +* it returned early. Complete the destruction here. +*/ +list_del (&ctx->list);tls_device_free_ctx (ctx); + } }up_write (&device_offload_lock);
tools/include/uapi/linux/bpf.h +4 -1
@@ -5006,7 +5006,10 @@ struct bpf_pidns_info {/* User accessible data for SK_LOOKUP programs. Add new fields at the end. */ struct bpf_sk_lookup { - __bpf_md_ptr(struct bpf_sock *, sk); /* Selected socket */ +union { + __bpf_md_ptr(struct bpf_sock *, sk); /* Selected socket */ +__u64 cookie;/* Non-zero if socket was selected in PROG_TEST_RUN */ + };__u32 family;/* Protocol family (AF_INET, AF_INET6) */ __u32 protocol;/* IP protocol (IPPROTO_TCP, IPPROTO_UDP) */
tools/perf/util/symbol-elf.c +41 -4
64 lines not on this page · raw message
tools/testing/selftests/bpf/test_verifier.c +2 -2
@@ -100,7 +100,7 @@ struct bpf_test {enum bpf_prog_type prog_type;uint8_t flags;void (*fill_helper)(struct bpf_test *self); -uint8_t runs; +int runs;#define bpf_testdata_struct_t \ struct { \ uint32_t retval, retval_unpriv; \
@@ -1054,7 +1054,7 @@ static void do_test_single(struct bpf_test *test, bool unpriv, run_errs =0 ; run_successes =0 ; -if (!alignment_prevented_execution && fd_prog >=0 ) { +if (!alignment_prevented_execution && fd_prog >=0 && test->runs >=0 ) {uint32_t expected_val;int i;
tools/testing/selftests/bpf/verifier/ctx_sk_lookup.c +1 -0
@@ -239,6 +239,7 @@ .result = ACCEPT, .prog_type = BPF_PROG_TYPE_SK_LOOKUP, .expected_attach_type = BPF_SK_LOOKUP, + .runs = -1, },/* invalid 8-byte reads from a 4-byte fields in bpf_sk_lookup */ {