-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmUJdfMACgkQONu9yGCS aT7i/w//Wbvt3F9hF/9Rmg9A4J23OWl2o07Z8Fi0a4F4B0FJjuQGSPRvpSvKtIWv +7taCzOw9+Qi52hTR7BK+QpLpEPgMbv1IdgyPu1gtjL4WHuKk1aOeafISYuQDgeZ XSFoV1EGjxkg3wbMZkucnmQVitGxC/iV0ojvxKleiIE9UNzceQclGmmBL0FwmEYp c91XKEACZ5K/spSyyxocP4Fw6mbk98ISiju+74op5EDFry9qnIYa2pU/au3gZvh/ TScOYOQsBojOFTy/wuEfpOiVBK9gLFq8du0J/gHS2aUqswkp/qFcpH7wbS5Po3+l Ja9a76o2B4btMCz6UhyhwzB+0QTQ1Gdea35FHRbF3d4ssNJDqDtwBCHqd3zeMUYo uTDhyTsSGV40Gm9A5Sojyzjgj4X12rQ0ffL+zcXfXe60flE8SNIxR8DiIXPlAsC+ pgNQ5l/HcdJE1abRoTkvpsptaT2sNXgwZZij+VOBI3Vp4wr61U69CfP/QWWPZZF5 ECEh8ZDK1roiEyBjn6njqXmt5vbmNasgI5umgnNPBgKEB2OLXqox6rn9XK0qMJ+X /oiCaL9RveU/QL5qNvV6Z2beXPwT51Vdy8+bQBfb5bUFRGQcTVIWaBRG0ZIHeSGm pG10/VAnCGtNrC6M/HVGd0Wyih+ur65Jz/rNKbkMX69cvJuxPWk= =RAs8 -----END PGP SIGNATURE----- Merge 5.10.195 into android12-5.10-lts Changes in 5.10.195 erofs: ensure that the post-EOF tails are all zeroed ARM: pxa: remove use of symbol_get() mmc: au1xmmc: force non-modular build and remove symbol_get usage net: enetc: use EXPORT_SYMBOL_GPL for enetc_phc_index rtc: ds1685: use EXPORT_SYMBOL_GPL for ds1685_rtc_poweroff modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules USB: serial: option: add Quectel EM05G variant (0x030e) USB: serial: option: add FOXCONN T99W368/T99W373 product usb: dwc3: meson-g12a: do post init to fix broken usb after resumption usb: chipidea: imx: improve logic if samsung,picophy-* parameter is 0 HID: wacom: remove the battery when the EKR is off staging: rtl8712: fix race condition Bluetooth: btsdio: fix use after free bug in btsdio_remove due to race condition configfs: fix a race in configfs_lookup() serial: qcom-geni: fix opp vote on shutdown serial: sc16is7xx: fix broken port 0 uart init serial: sc16is7xx: fix bug when first setting GPIO direction firmware: stratix10-svc: Fix an NULL vs IS_ERR() bug in probe fsi: master-ast-cf: Add MODULE_FIRMWARE macro nilfs2: fix general protection fault in nilfs_lookup_dirty_data_buffers() nilfs2: fix WARNING in mark_buffer_dirty due to discarded buffer reuse pinctrl: amd: Don't show `Invalid config param` errors ASoC: rt5682: Fix a problem with error handling in the io init function of the soundwire ARM: dts: imx: update sdma node name format ARM: dts: imx7s: Drop dma-apb interrupt-names ARM: dts: imx: Adjust dma-apbh node name ARM: dts: imx: Set default tuning step for imx7d usdhc phy: qcom-snps-femto-v2: use qcom_snps_hsphy_suspend/resume error code media: pulse8-cec: handle possible ping error media: pci: cx23885: fix error handling for cx23885 ATSC boards 9p: virtio: make sure 'offs' is initialized in zc_request ASoC: da7219: Flush pending AAD IRQ when suspending ASoC: da7219: Check for failure reading AAD IRQ events ethernet: atheros: fix return value check in atl1c_tso_csum() vxlan: generalize vxlan_parse_gpe_hdr and remove unused args m68k: Fix invalid .section syntax s390/dasd: use correct number of retries for ERP requests s390/dasd: fix hanging device after request requeue fs/nls: make load_nls() take a const parameter ASoc: codecs: ES8316: Fix DMIC config ASoC: atmel: Fix the 8K sample parameter in I2SC master platform/x86: intel: hid: Always call BTNL ACPI method platform/x86: huawei-wmi: Silence ambient light sensor drm/amd/display: Exit idle optimizations before attempt to access PHY ovl: Always reevaluate the file signature for IMA ata: pata_arasan_cf: Use dev_err_probe() instead dev_err() in data_xfer() security: keys: perform capable check only on privileged operations kprobes: Prohibit probing on CFI preamble symbol clk: fixed-mmio: make COMMON_CLK_FIXED_MMIO depend on HAS_IOMEM vmbus_testing: fix wrong python syntax for integer value comparison net: usb: qmi_wwan: add Quectel EM05GV2 idmaengine: make FSL_EDMA and INTEL_IDMA64 depends on HAS_IOMEM scsi: qedi: Fix potential deadlock on &qedi_percpu->p_work_lock netlabel: fix shift wrapping bug in netlbl_catmap_setlong() bnx2x: fix page fault following EEH recovery sctp: handle invalid error codes without calling BUG() scsi: storvsc: Always set no_report_opcodes ALSA: seq: oss: Fix racy open/close of MIDI devices tracing: Introduce pipe_cpumask to avoid race on trace_pipes platform/mellanox: Fix mlxbf-tmfifo not handling all virtio CONSOLE notifications net: Avoid address overwrite in kernel_connect udf: Check consistency of Space Bitmap Descriptor udf: Handle error when adding extent to a file Revert "net: macsec: preserve ingress frame ordering" reiserfs: Check the return value from __getblk() eventfd: Export eventfd_ctx_do_read() eventfd: prevent underflow for eventfd semaphores fs: Fix error checking for d_hash_and_lookup() tmpfs: verify {g,u}id mount options correctly selftests/harness: Actually report SKIP for signal tests refscale: Fix uninitalized use of wait_queue_head_t OPP: Fix passing 0 to PTR_ERR in _opp_attach_genpd() selftests/resctrl: Don't leak buffer in fill_cache() selftests/resctrl: Unmount resctrl FS if child fails to run benchmark selftests/resctrl: Close perf value read fd on errors x86/decompressor: Don't rely on upper 32 bits of GPRs being preserved perf/imx_ddr: don't enable counter0 if none of 4 counters are used s390/pkey: fix/harmonize internal keyblob headers s390/paes: fix PKEY_TYPE_EP11_AES handling for secure keyblobs x86/efistub: Fix PCI ROM preservation in mixed mode cpufreq: powernow-k8: Use related_cpus instead of cpus in driver.exit() bpftool: Use a local bpf_perf_event_value to fix accessing its fields bpf: Clear the probe_addr for uprobe tcp: tcp_enter_quickack_mode() should be static hwrng: nomadik - keep clock enabled while hwrng is registered regmap: rbtree: Use alloc_flags for memory allocations udp: re-score reuseport groups when connected sockets are present bpf: reject unhashed sockets in bpf_sk_assign wifi: mt76: testmode: add nla_policy for MT76_TM_ATTR_TX_LENGTH spi: tegra20-sflash: fix to check return value of platform_get_irq() in tegra_sflash_probe() can: gs_usb: gs_usb_receive_bulk_callback(): count RX overflow errors also in case of OOM wifi: mwifiex: Fix OOB and integer underflow when rx packets wifi: mwifiex: fix error recovery in PCIE buffer descriptor management selftests/bpf: fix static assert compilation issue for test_cls_*.c crypto: stm32 - Properly handle pm_runtime_get failing crypto: api - Use work queue in crypto_destroy_instance Bluetooth: nokia: fix value check in nokia_bluetooth_serdev_probe() Bluetooth: Fix potential use-after-free when clear keys net: tcp: fix unexcepted socket die when snd_wnd is 0 selftests/bpf: Clean up fmod_ret in bench_rename test script ice: ice_aq_check_events: fix off-by-one check when filling buffer crypto: caam - fix unchecked return value error hwrng: iproc-rng200 - Implement suspend and resume calls lwt: Fix return values of BPF xmit ops lwt: Check LWTUNNEL_XMIT_CONTINUE strictly fs: ocfs2: namei: check return value of ocfs2_add_entry() wifi: mwifiex: fix memory leak in mwifiex_histogram_read() wifi: mwifiex: Fix missed return in oob checks failed path samples/bpf: fix broken map lookup probe wifi: ath9k: fix races between ath9k_wmi_cmd and ath9k_wmi_ctrl_rx wifi: ath9k: protect WMI command response buffer replacement with a lock wifi: mwifiex: avoid possible NULL skb pointer dereference Bluetooth: btusb: Do not call kfree_skb() under spin_lock_irqsave() wifi: ath9k: use IS_ERR() with debugfs_create_dir() net: arcnet: Do not call kfree_skb() under local_irq_disable() mlxsw: i2c: Fix chunk size setting in output mailbox buffer mlxsw: i2c: Limit single transaction buffer size hwmon: (tmp513) Fix the channel number in tmp51x_is_visible() net/sched: sch_hfsc: Ensure inner classes have fsc curve netrom: Deny concurrent connect(). drm/bridge: tc358764: Fix debug print parameter order quota: factor out dquot_write_dquot() quota: rename dquot_active() to inode_quota_active() quota: add new helper dquot_active() quota: fix dqput() to follow the guarantees dquot_srcu should provide ASoC: stac9766: fix build errors with REGMAP_AC97 soc: qcom: ocmem: Add OCMEM hardware version print soc: qcom: ocmem: Fix NUM_PORTS & NUM_MACROS macros arm64: dts: qcom: msm8996: Add missing interrupt to the USB2 controller drm/amdgpu: avoid integer overflow warning in amdgpu_device_resize_fb_bar() ARM: dts: BCM5301X: Harmonize EHCI/OHCI DT nodes name ARM: dts: BCM53573: Describe on-SoC BCM53125 rev 4 switch ARM: dts: BCM53573: Drop nonexistent #usb-cells ARM: dts: BCM53573: Add cells sizes to PCIe node ARM: dts: BCM53573: Use updated "spi-gpio" binding properties drm/etnaviv: fix dumping of active MMU context x86/mm: Fix PAT bit missing from page protection modify mask ARM: dts: s3c64xx: align pinctrl with dtschema ARM: dts: samsung: s3c6410-mini6410: correct ethernet reg addresses (split) ARM: dts: s5pv210: adjust node names to DT spec ARM: dts: s5pv210: add dummy 5V regulator for backlight on SMDKv210 ARM: dts: samsung: s5pv210-smdkv210: correct ethernet reg addresses (split) drm: adv7511: Fix low refresh rate register for ADV7533/5 ARM: dts: BCM53573: Fix Ethernet info for Luxul devices arm64: dts: qcom: sdm845: Add missing RPMh power domain to GCC arm64: dts: qcom: sdm845: Fix the min frequency of "ice_core_clk" drm/amdgpu: Update min() to min_t() in 'amdgpu_info_ioctl' md/bitmap: don't set max_write_behind if there is no write mostly device md/md-bitmap: hold 'reconfig_mutex' in backlog_store() drm/tegra: Remove superfluous error messages around platform_get_irq() drm/tegra: dpaux: Fix incorrect return value of platform_get_irq of: unittest: fix null pointer dereferencing in of_unittest_find_node_by_name() drm/armada: Fix off-by-one error in armada_overlay_get_property() drm/panel: simple: Add missing connector type and pixel format for AUO T215HVN01 ima: Remove deprecated IMA_TRUSTED_KEYRING Kconfig drm: xlnx: zynqmp_dpsub: Add missing check for dma_set_mask drm/msm/mdp5: Don't leak some plane state firmware: meson_sm: fix to avoid potential NULL pointer dereference smackfs: Prevent underflow in smk_set_cipso() drm/amd/pm: fix variable dereferenced issue in amdgpu_device_attr_create() drm/msm/a2xx: Call adreno_gpu_init() earlier audit: fix possible soft lockup in __audit_inode_child() bus: ti-sysc: Fix build warning for 64-bit build drm/mediatek: Fix potential memory leak if vmap() fail bus: ti-sysc: Fix cast to enum warning of: unittest: Fix overlay type in apply/revert check ALSA: ac97: Fix possible error value of *rac97 ipmi:ssif: Add check for kstrdup ipmi:ssif: Fix a memory leak when scanning for an adapter drivers: clk: keystone: Fix parameter judgment in _of_pll_clk_init() clk: sunxi-ng: Modify mismatched function name clk: qcom: gcc-sc7180: use ARRAY_SIZE instead of specifying num_parents clk: qcom: gcc-sc7180: Fix up gcc_sdcc2_apps_clk_src ext4: correct grp validation in ext4_mb_good_group clk: qcom: gcc-sm8250: use ARRAY_SIZE instead of specifying num_parents clk: qcom: gcc-sm8250: Fix gcc_sdcc2_apps_clk_src clk: qcom: reset: Use the correct type of sleep/delay based on length PCI: Mark NVIDIA T4 GPUs to avoid bus reset pinctrl: mcp23s08: check return value of devm_kasprintf() PCI: pciehp: Use RMW accessors for changing LNKCTL PCI/ASPM: Use RMW accessors for changing LNKCTL clk: imx8mp: fix sai4 clock clk: imx: composite-8m: fix clock pauses when set_rate would be a no-op vfio/type1: fix cap_migration information leak powerpc/fadump: reset dump area size if fadump memory reserve fails powerpc/perf: Convert fsl_emb notifier to state machine callbacks drm/amdgpu: Use RMW accessors for changing LNKCTL drm/radeon: Use RMW accessors for changing LNKCTL net/mlx5: Use RMW accessors for changing LNKCTL wifi: ath10k: Use RMW accessors for changing LNKCTL powerpc: Don't include lppaca.h in paca.h powerpc/pseries: Rework lppaca_shared_proc() to avoid DEBUG_PREEMPT nfs/blocklayout: Use the passed in gfp flags powerpc/iommu: Fix notifiers being shared by PCI and VIO buses jfs: validate max amount of blocks before allocation. fs: lockd: avoid possible wrong NULL parameter NFSD: da_addr_body field missing in some GETDEVICEINFO replies NFS: Guard against READDIR loop when entry names exceed MAXNAMELEN NFSv4.2: fix handling of COPY ERR_OFFLOAD_NO_REQ media: ad5820: Drop unsupported ad5823 from i2c_ and of_device_id tables media: i2c: tvp5150: check return value of devm_kasprintf() media: v4l2-core: Fix a potential resource leak in v4l2_fwnode_parse_link() drivers: usb: smsusb: fix error handling code in smsusb_init_device media: dib7000p: Fix potential division by zero media: dvb-usb: m920x: Fix a potential memory leak in m920x_i2c_xfer() media: cx24120: Add retval check for cx24120_message_send() scsi: hisi_sas: Print SAS address for v3 hw erroneous completion print scsi: libsas: Introduce more SAM status code aliases in enum exec_status scsi: hisi_sas: Modify v3 HW SSP underflow error processing scsi: hisi_sas: Modify v3 HW SATA completion error processing scsi: hisi_sas: Fix warnings detected by sparse scsi: hisi_sas: Fix normally completed I/O analysed as failed media: rkvdec: increase max supported height for H.264 media: mediatek: vcodec: Return NULL if no vdec_fb is found usb: phy: mxs: fix getting wrong state with mxs_phy_is_otg_host() scsi: RDMA/srp: Fix residual handling scsi: iscsi: Rename iscsi_set_param() to iscsi_if_set_param() scsi: iscsi: Add length check for nlattr payload scsi: iscsi: Add strlen() check in iscsi_if_set{_host}_param() scsi: be2iscsi: Add length check when parsing nlattrs scsi: qla4xxx: Add length check when parsing nlattrs serial: sprd: Assign sprd_port after initialized to avoid wrong access serial: sprd: Fix DMA buffer leak issue x86/APM: drop the duplicate APM_MINOR_DEV macro scsi: qedf: Do not touch __user pointer in qedf_dbg_stop_io_on_error_cmd_read() directly scsi: qedf: Do not touch __user pointer in qedf_dbg_debug_cmd_read() directly scsi: qedf: Do not touch __user pointer in qedf_dbg_fp_int_cmd_read() directly coresight: tmc: Explicit type conversions to prevent integer overflow dma-buf/sync_file: Fix docs syntax driver core: test_async: fix an error code IB/uverbs: Fix an potential error pointer dereference fsi: aspeed: Reset master errors after CFAM reset iommu/qcom: Disable and reset context bank before programming iommu/vt-d: Fix to flush cache of PASID directory table media: go7007: Remove redundant if statement USB: gadget: f_mass_storage: Fix unused variable warning media: ov5640: Enable MIPI interface in ov5640_set_power_mipi() media: i2c: ov2680: Set V4L2_CTRL_FLAG_MODIFY_LAYOUT on flips media: ov2680: Remove auto-gain and auto-exposure controls media: ov2680: Fix ov2680_bayer_order() media: ov2680: Fix vflip / hflip set functions media: ov2680: Fix regulators being left enabled on ov2680_power_on() errors cgroup:namespace: Remove unused cgroup_namespaces_init() scsi: core: Use 32-bit hostnum in scsi_host_lookup() scsi: fcoe: Fix potential deadlock on &fip->ctlr_lock serial: tegra: handle clk prepare error in tegra_uart_hw_init() amba: bus: fix refcount leak Revert "IB/isert: Fix incorrect release of isert connection" RDMA/siw: Balance the reference of cep->kref in the error path RDMA/siw: Correct wrong debug message HID: logitech-dj: Fix error handling in logi_dj_recv_switch_to_dj_mode() HID: multitouch: Correct devm device reference for hidinput input_dev name x86/speculation: Mark all Skylake CPUs as vulnerable to GDS tracing: Fix race issue between cpu buffer write and swap mtd: rawnand: brcmnand: Fix mtd oobsize phy/rockchip: inno-hdmi: use correct vco_div_5 macro on rk3328 phy/rockchip: inno-hdmi: round fractal pixclock in rk3328 recalc_rate phy/rockchip: inno-hdmi: do not power on rk3328 post pll on reg write rpmsg: glink: Add check for kstrdup mtd: spi-nor: Check bus width while setting QE bit mtd: rawnand: fsmc: handle clk prepare error in fsmc_nand_resume() um: Fix hostaudio build errors dmaengine: ste_dma40: Add missing IRQ check in d40_probe cpufreq: Fix the race condition while updating the transition_task of policy virtio_ring: fix avail_wrap_counter in virtqueue_add_packed igmp: limit igmpv3_newpack() packet size to IP_MAX_MTU netfilter: ipset: add the missing IP_SET_HASH_WITH_NET0 macro for ip_set_hash_netportnet.c netfilter: xt_u32: validate user space input netfilter: xt_sctp: validate the flag_info count skbuff: skb_segment, Call zero copy functions before using skbuff frags igb: set max size RX buffer when store bad packet is enabled PM / devfreq: Fix leak in devfreq_dev_release() ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl printk: ringbuffer: Fix truncating buffer size min_t cast scsi: core: Fix the scsi_set_resid() documentation ipmi_si: fix a memleak in try_smi_init() ARM: OMAP2+: Fix -Warray-bounds warning in _pwrdm_state_switch() backlight/gpio_backlight: Compare against struct fb_info.device backlight/bd6107: Compare against struct fb_info.device backlight/lv5207lp: Compare against struct fb_info.device xtensa: PMU: fix base address for the newer hardware arm64: csum: Fix OoB access in IP checksum code for negative lengths media: dvb: symbol fixup for dvb_attach() Revert "scsi: qla2xxx: Fix buffer overrun" scsi: mpt3sas: Perform additional retries if doorbell read returns 0 ntb: Drop packets when qp link is down ntb: Clean up tx tail index on link down ntb: Fix calculation ntb_transport_tx_free_entry() Revert "PCI: Mark NVIDIA T4 GPUs to avoid bus reset" procfs: block chmod on /proc/thread-self/comm parisc: Fix /proc/cpuinfo output for lscpu dlm: fix plock lookup when using multiple lockspaces dccp: Fix out of bounds access in DCCP error handler X.509: if signature is unsupported skip validation net: handle ARPHRD_PPP in dev_is_mac_header_xmit() fsverity: skip PKCS#7 parser when keyring is empty pstore/ram: Check start of empty przs during init s390/ipl: add missing secure/has_secure file to ipl type 'unknown' crypto: stm32 - fix loop iterating through scatterlist for DMA cpufreq: brcmstb-avs-cpufreq: Fix -Warray-bounds bug usb: typec: bus: verify partner exists in typec_altmode_attention USB: core: Unite old scheme and new scheme descriptor reads USB: core: Change usb_get_device_descriptor() API USB: core: Fix race by not overwriting udev->descriptor in hub_port_init() USB: core: Fix oversight in SuperSpeed initialization usb: typec: tcpci: clear the fault status bit tracing: Zero the pipe cpumask on alloc to avoid spurious -EBUSY md/md-bitmap: remove unnecessary local variable in backlog_store() udf: initialize newblock to 0 net/ipv6: SKB symmetric hash should incorporate transport ports io_uring: always lock in io_apoll_task_func io_uring: break out of iowq iopoll on teardown io_uring: break iopolling on signal scsi: qla2xxx: Fix deletion race condition scsi: qla2xxx: fix inconsistent TMF timeout scsi: qla2xxx: Fix erroneous link up failure scsi: qla2xxx: Turn off noisy message log scsi: qla2xxx: Remove unsupported ql2xenabledif option fbdev/ep93xx-fb: Do not assign to struct fb_info.dev drm/ast: Fix DRAM init on AST2200 lib/test_meminit: allocate pages up to order MAX_ORDER parisc: led: Fix LAN receive and transmit LEDs parisc: led: Reduce CPU overhead for disk & lan LED computation pinctrl: cherryview: fix address_space_handler() argument dt-bindings: clock: xlnx,versal-clk: drop select:false clk: imx: pll14xx: dynamically configure PLL for 393216000/361267200Hz clk: qcom: gcc-mdm9615: use proper parent for pll0_vote clock soc: qcom: qmi_encdec: Restrict string length in decode NFS: Fix a potential data corruption NFSv4/pnfs: minor fix for cleanup path in nfs4_get_device_info kconfig: fix possible buffer overflow backlight: gpio_backlight: Drop output GPIO direction check for initial power state perf annotate bpf: Don't enclose non-debug code with an assert() x86/virt: Drop unnecessary check on extended CPUID level in cpu_has_svm() perf top: Don't pass an ERR_PTR() directly to perf_session__delete() watchdog: intel-mid_wdt: add MODULE_ALIAS() to allow auto-load pwm: lpc32xx: Remove handling of PWM channels net/sched: fq_pie: avoid stalls in fq_pie_timer() sctp: annotate data-races around sk->sk_wmem_queued ipv4: annotate data-races around fi->fib_dead net: read sk->sk_family once in sk_mc_loop() drm/i915/gvt: Save/restore HW status to support GVT suspend/resume drm/i915/gvt: Drop unused helper intel_vgpu_reset_gtt() ipv4: ignore dst hint for multipath routes igb: disable virtualization features on 82580 veth: Fixing transmit return status for dropped packets net: ipv6/addrconf: avoid integer underflow in ipv6_create_tempaddr af_unix: Fix data-races around user->unix_inflight. af_unix: Fix data-race around unix_tot_inflight. af_unix: Fix data-races around sk->sk_shutdown. af_unix: Fix data race around sk->sk_err. net: sched: sch_qfq: Fix UAF in qfq_dequeue() kcm: Destroy mutex in kcm_exit_net() igc: Change IGC_MIN to allow set rx/tx value between 64 and 80 igbvf: Change IGBVF_MIN to allow set rx/tx value between 64 and 80 igb: Change IGB_MIN to allow set rx/tx value between 64 and 80 s390/zcrypt: don't leak memory if dev_set_name() fails idr: fix param name in idr_alloc_cyclic() doc ip_tunnels: use DEV_STATS_INC() net: dsa: sja1105: fix bandwidth discrepancy between tc-cbs software and offload net: dsa: sja1105: fix -ENOSPC when replacing the same tc-cbs too many times netfilter: nfnetlink_osf: avoid OOB read net: hns3: fix the port information display when sfp is absent sh: boards: Fix CEU buffer size passed to dma_declare_coherent_memory() ext4: add correct group descriptors and reserved GDT blocks to system zone ata: sata_gemini: Add missing MODULE_DESCRIPTION ata: pata_ftide010: Add missing MODULE_DESCRIPTION fuse: nlookup missing decrement in fuse_direntplus_link btrfs: don't start transaction when joining with TRANS_JOIN_NOSTART btrfs: use the correct superblock to compare fsid in btrfs_validate_super mtd: rawnand: brcmnand: Fix crash during the panic_write mtd: rawnand: brcmnand: Fix potential out-of-bounds access in oob write mtd: rawnand: brcmnand: Fix potential false time out warning drm/amd/display: prevent potential division by zero errors perf hists browser: Fix hierarchy mode header perf tools: Handle old data in PERF_RECORD_ATTR perf hists browser: Fix the number of entries for 'e' key ACPI: APEI: explicit init of HEST and GHES in apci_init() arm64: sdei: abort running SDEI handlers during crash scsi: qla2xxx: If fcport is undergoing deletion complete I/O with retry scsi: qla2xxx: Consolidate zio threshold setting for both FCP & NVMe scsi: qla2xxx: Fix crash in PCIe error handling scsi: qla2xxx: Flush mailbox commands on chip reset ARM: dts: samsung: exynos4210-i9100: Fix LCD screen's physical size ARM: dts: BCM5301X: Extend RAM to full 256MB for Linksys EA6500 V2 bus: mhi: host: Skip MHI reset if device is in RDDM net: ipv4: fix one memleak in __inet_del_ifa() selftests/kselftest/runner/run_one(): allow running non-executable files kselftest/runner.sh: Propagate SIGTERM to runner child net/smc: use smc_lgr_list.lock to protect smc_lgr_list.list iterate in smcr_port_add net: ethernet: mvpp2_main: fix possible OOB write in mvpp2_ethtool_get_rxnfc() net: ethernet: mtk_eth_soc: fix possible NULL pointer dereference in mtk_hwlro_get_fdir_all() hsr: Fix uninit-value access in fill_frame_info() r8152: check budget for r8152_poll() kcm: Fix memory leak in error path of kcm_sendmsg() platform/mellanox: mlxbf-tmfifo: Drop the Rx packet if no more descriptors platform/mellanox: mlxbf-tmfifo: Drop jumbo frames net/tls: do not free tls_rec on async operation in bpf_exec_tx_verdict() ipv6: fix ip6_sock_set_addr_preferences() typo ixgbe: fix timestamp configuration code kcm: Fix error handling for SOCK_DGRAM in kcm_sendmsg(). drm/amd/display: Fix a bug when searching for insert_above_mpcc parisc: Drop loops_per_jiffy from per_cpu struct Linux 5.10.195 Change-Id: I4eef618f573b6d4201e05c9cf56088d77d712d97 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
792 lines
22 KiB
C
792 lines
22 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* INET An implementation of the TCP/IP protocol suite for the LINUX
|
|
* operating system. INET is implemented using the BSD Socket
|
|
* interface as the means of communication with the user level.
|
|
*
|
|
* Definitions for the IP module.
|
|
*
|
|
* Version: @(#)ip.h 1.0.2 05/07/93
|
|
*
|
|
* Authors: Ross Biro
|
|
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
|
|
* Alan Cox, <gw4pts@gw4pts.ampr.org>
|
|
*
|
|
* Changes:
|
|
* Mike McLagan : Routing by source
|
|
*/
|
|
#ifndef _IP_H
|
|
#define _IP_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/ip.h>
|
|
#include <linux/in.h>
|
|
#include <linux/skbuff.h>
|
|
#include <linux/jhash.h>
|
|
#include <linux/sockptr.h>
|
|
|
|
#include <net/inet_sock.h>
|
|
#include <net/route.h>
|
|
#include <net/snmp.h>
|
|
#include <net/flow.h>
|
|
#include <net/flow_dissector.h>
|
|
#include <net/netns/hash.h>
|
|
#ifndef __GENKSYMS__
|
|
#include <net/lwtunnel.h>
|
|
#endif
|
|
|
|
#define IPV4_MAX_PMTU 65535U /* RFC 2675, Section 5.1 */
|
|
#define IPV4_MIN_MTU 68 /* RFC 791 */
|
|
|
|
extern unsigned int sysctl_fib_sync_mem;
|
|
extern unsigned int sysctl_fib_sync_mem_min;
|
|
extern unsigned int sysctl_fib_sync_mem_max;
|
|
|
|
struct sock;
|
|
|
|
struct inet_skb_parm {
|
|
int iif;
|
|
struct ip_options opt; /* Compiled IP options */
|
|
u16 flags;
|
|
|
|
#define IPSKB_FORWARDED BIT(0)
|
|
#define IPSKB_XFRM_TUNNEL_SIZE BIT(1)
|
|
#define IPSKB_XFRM_TRANSFORMED BIT(2)
|
|
#define IPSKB_FRAG_COMPLETE BIT(3)
|
|
#define IPSKB_REROUTED BIT(4)
|
|
#define IPSKB_DOREDIRECT BIT(5)
|
|
#define IPSKB_FRAG_PMTU BIT(6)
|
|
#define IPSKB_L3SLAVE BIT(7)
|
|
#define IPSKB_MULTIPATH BIT(9)
|
|
|
|
u16 frag_max_size;
|
|
};
|
|
|
|
static inline bool ipv4_l3mdev_skb(u16 flags)
|
|
{
|
|
return !!(flags & IPSKB_L3SLAVE);
|
|
}
|
|
|
|
static inline unsigned int ip_hdrlen(const struct sk_buff *skb)
|
|
{
|
|
return ip_hdr(skb)->ihl * 4;
|
|
}
|
|
|
|
struct ipcm_cookie {
|
|
struct sockcm_cookie sockc;
|
|
__be32 addr;
|
|
int oif;
|
|
struct ip_options_rcu *opt;
|
|
__u8 protocol;
|
|
__u8 ttl;
|
|
__s16 tos;
|
|
char priority;
|
|
__u16 gso_size;
|
|
};
|
|
|
|
static inline void ipcm_init(struct ipcm_cookie *ipcm)
|
|
{
|
|
*ipcm = (struct ipcm_cookie) { .tos = -1 };
|
|
}
|
|
|
|
static inline void ipcm_init_sk(struct ipcm_cookie *ipcm,
|
|
const struct inet_sock *inet)
|
|
{
|
|
ipcm_init(ipcm);
|
|
|
|
ipcm->sockc.mark = inet->sk.sk_mark;
|
|
ipcm->sockc.tsflags = inet->sk.sk_tsflags;
|
|
ipcm->oif = inet->sk.sk_bound_dev_if;
|
|
ipcm->addr = inet->inet_saddr;
|
|
ipcm->protocol = inet->inet_num;
|
|
}
|
|
|
|
#define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb))
|
|
#define PKTINFO_SKB_CB(skb) ((struct in_pktinfo *)((skb)->cb))
|
|
|
|
/* return enslaved device index if relevant */
|
|
static inline int inet_sdif(struct sk_buff *skb)
|
|
{
|
|
#if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV)
|
|
if (skb && ipv4_l3mdev_skb(IPCB(skb)->flags))
|
|
return IPCB(skb)->iif;
|
|
#endif
|
|
return 0;
|
|
}
|
|
|
|
/* Special input handler for packets caught by router alert option.
|
|
They are selected only by protocol field, and then processed likely
|
|
local ones; but only if someone wants them! Otherwise, router
|
|
not running rsvpd will kill RSVP.
|
|
|
|
It is user level problem, what it will make with them.
|
|
I have no idea, how it will masquearde or NAT them (it is joke, joke :-)),
|
|
but receiver should be enough clever f.e. to forward mtrace requests,
|
|
sent to multicast group to reach destination designated router.
|
|
*/
|
|
|
|
struct ip_ra_chain {
|
|
struct ip_ra_chain __rcu *next;
|
|
struct sock *sk;
|
|
union {
|
|
void (*destructor)(struct sock *);
|
|
struct sock *saved_sk;
|
|
};
|
|
struct rcu_head rcu;
|
|
};
|
|
|
|
/* IP flags. */
|
|
#define IP_CE 0x8000 /* Flag: "Congestion" */
|
|
#define IP_DF 0x4000 /* Flag: "Don't Fragment" */
|
|
#define IP_MF 0x2000 /* Flag: "More Fragments" */
|
|
#define IP_OFFSET 0x1FFF /* "Fragment Offset" part */
|
|
|
|
#define IP_FRAG_TIME (30 * HZ) /* fragment lifetime */
|
|
|
|
struct msghdr;
|
|
struct net_device;
|
|
struct packet_type;
|
|
struct rtable;
|
|
struct sockaddr;
|
|
|
|
int igmp_mc_init(void);
|
|
|
|
/*
|
|
* Functions provided by ip.c
|
|
*/
|
|
|
|
int ip_build_and_send_pkt(struct sk_buff *skb, const struct sock *sk,
|
|
__be32 saddr, __be32 daddr,
|
|
struct ip_options_rcu *opt, u8 tos);
|
|
int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
|
|
struct net_device *orig_dev);
|
|
void ip_list_rcv(struct list_head *head, struct packet_type *pt,
|
|
struct net_device *orig_dev);
|
|
int ip_local_deliver(struct sk_buff *skb);
|
|
void ip_protocol_deliver_rcu(struct net *net, struct sk_buff *skb, int proto);
|
|
int ip_mr_input(struct sk_buff *skb);
|
|
int ip_output(struct net *net, struct sock *sk, struct sk_buff *skb);
|
|
int ip_mc_output(struct net *net, struct sock *sk, struct sk_buff *skb);
|
|
int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
|
|
int (*output)(struct net *, struct sock *, struct sk_buff *));
|
|
|
|
struct ip_fraglist_iter {
|
|
struct sk_buff *frag;
|
|
struct iphdr *iph;
|
|
int offset;
|
|
unsigned int hlen;
|
|
};
|
|
|
|
void ip_fraglist_init(struct sk_buff *skb, struct iphdr *iph,
|
|
unsigned int hlen, struct ip_fraglist_iter *iter);
|
|
void ip_fraglist_prepare(struct sk_buff *skb, struct ip_fraglist_iter *iter);
|
|
|
|
static inline struct sk_buff *ip_fraglist_next(struct ip_fraglist_iter *iter)
|
|
{
|
|
struct sk_buff *skb = iter->frag;
|
|
|
|
iter->frag = skb->next;
|
|
skb_mark_not_on_list(skb);
|
|
|
|
return skb;
|
|
}
|
|
|
|
struct ip_frag_state {
|
|
bool DF;
|
|
unsigned int hlen;
|
|
unsigned int ll_rs;
|
|
unsigned int mtu;
|
|
unsigned int left;
|
|
int offset;
|
|
int ptr;
|
|
__be16 not_last_frag;
|
|
};
|
|
|
|
void ip_frag_init(struct sk_buff *skb, unsigned int hlen, unsigned int ll_rs,
|
|
unsigned int mtu, bool DF, struct ip_frag_state *state);
|
|
struct sk_buff *ip_frag_next(struct sk_buff *skb,
|
|
struct ip_frag_state *state);
|
|
|
|
void ip_send_check(struct iphdr *ip);
|
|
int __ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb);
|
|
int ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb);
|
|
|
|
int __ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
|
|
__u8 tos);
|
|
void ip_init(void);
|
|
int ip_append_data(struct sock *sk, struct flowi4 *fl4,
|
|
int getfrag(void *from, char *to, int offset, int len,
|
|
int odd, struct sk_buff *skb),
|
|
void *from, int len, int protolen,
|
|
struct ipcm_cookie *ipc,
|
|
struct rtable **rt,
|
|
unsigned int flags);
|
|
int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd,
|
|
struct sk_buff *skb);
|
|
ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page,
|
|
int offset, size_t size, int flags);
|
|
struct sk_buff *__ip_make_skb(struct sock *sk, struct flowi4 *fl4,
|
|
struct sk_buff_head *queue,
|
|
struct inet_cork *cork);
|
|
int ip_send_skb(struct net *net, struct sk_buff *skb);
|
|
int ip_push_pending_frames(struct sock *sk, struct flowi4 *fl4);
|
|
void ip_flush_pending_frames(struct sock *sk);
|
|
struct sk_buff *ip_make_skb(struct sock *sk, struct flowi4 *fl4,
|
|
int getfrag(void *from, char *to, int offset,
|
|
int len, int odd, struct sk_buff *skb),
|
|
void *from, int length, int transhdrlen,
|
|
struct ipcm_cookie *ipc, struct rtable **rtp,
|
|
struct inet_cork *cork, unsigned int flags);
|
|
|
|
int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl);
|
|
|
|
static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4)
|
|
{
|
|
return __ip_make_skb(sk, fl4, &sk->sk_write_queue, &inet_sk(sk)->cork.base);
|
|
}
|
|
|
|
static inline __u8 get_rttos(struct ipcm_cookie* ipc, struct inet_sock *inet)
|
|
{
|
|
return (ipc->tos != -1) ? RT_TOS(ipc->tos) : RT_TOS(inet->tos);
|
|
}
|
|
|
|
static inline __u8 get_rtconn_flags(struct ipcm_cookie* ipc, struct sock* sk)
|
|
{
|
|
return (ipc->tos != -1) ? RT_CONN_FLAGS_TOS(sk, ipc->tos) : RT_CONN_FLAGS(sk);
|
|
}
|
|
|
|
/* datagram.c */
|
|
int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
|
|
int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
|
|
|
|
void ip4_datagram_release_cb(struct sock *sk);
|
|
|
|
struct ip_reply_arg {
|
|
struct kvec iov[1];
|
|
int flags;
|
|
__wsum csum;
|
|
int csumoffset; /* u16 offset of csum in iov[0].iov_base */
|
|
/* -1 if not needed */
|
|
int bound_dev_if;
|
|
u8 tos;
|
|
kuid_t uid;
|
|
};
|
|
|
|
#define IP_REPLY_ARG_NOSRCCHECK 1
|
|
|
|
static inline __u8 ip_reply_arg_flowi_flags(const struct ip_reply_arg *arg)
|
|
{
|
|
return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0;
|
|
}
|
|
|
|
void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb,
|
|
const struct ip_options *sopt,
|
|
__be32 daddr, __be32 saddr,
|
|
const struct ip_reply_arg *arg,
|
|
unsigned int len, u64 transmit_time);
|
|
|
|
#define IP_INC_STATS(net, field) SNMP_INC_STATS64((net)->mib.ip_statistics, field)
|
|
#define __IP_INC_STATS(net, field) __SNMP_INC_STATS64((net)->mib.ip_statistics, field)
|
|
#define IP_ADD_STATS(net, field, val) SNMP_ADD_STATS64((net)->mib.ip_statistics, field, val)
|
|
#define __IP_ADD_STATS(net, field, val) __SNMP_ADD_STATS64((net)->mib.ip_statistics, field, val)
|
|
#define IP_UPD_PO_STATS(net, field, val) SNMP_UPD_PO_STATS64((net)->mib.ip_statistics, field, val)
|
|
#define __IP_UPD_PO_STATS(net, field, val) __SNMP_UPD_PO_STATS64((net)->mib.ip_statistics, field, val)
|
|
#define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field)
|
|
#define __NET_INC_STATS(net, field) __SNMP_INC_STATS((net)->mib.net_statistics, field)
|
|
#define NET_ADD_STATS(net, field, adnd) SNMP_ADD_STATS((net)->mib.net_statistics, field, adnd)
|
|
#define __NET_ADD_STATS(net, field, adnd) __SNMP_ADD_STATS((net)->mib.net_statistics, field, adnd)
|
|
|
|
u64 snmp_get_cpu_field(void __percpu *mib, int cpu, int offct);
|
|
unsigned long snmp_fold_field(void __percpu *mib, int offt);
|
|
#if BITS_PER_LONG==32
|
|
u64 snmp_get_cpu_field64(void __percpu *mib, int cpu, int offct,
|
|
size_t syncp_offset);
|
|
u64 snmp_fold_field64(void __percpu *mib, int offt, size_t sync_off);
|
|
#else
|
|
static inline u64 snmp_get_cpu_field64(void __percpu *mib, int cpu, int offct,
|
|
size_t syncp_offset)
|
|
{
|
|
return snmp_get_cpu_field(mib, cpu, offct);
|
|
|
|
}
|
|
|
|
static inline u64 snmp_fold_field64(void __percpu *mib, int offt, size_t syncp_off)
|
|
{
|
|
return snmp_fold_field(mib, offt);
|
|
}
|
|
#endif
|
|
|
|
#define snmp_get_cpu_field64_batch(buff64, stats_list, mib_statistic, offset) \
|
|
{ \
|
|
int i, c; \
|
|
for_each_possible_cpu(c) { \
|
|
for (i = 0; stats_list[i].name; i++) \
|
|
buff64[i] += snmp_get_cpu_field64( \
|
|
mib_statistic, \
|
|
c, stats_list[i].entry, \
|
|
offset); \
|
|
} \
|
|
}
|
|
|
|
#define snmp_get_cpu_field_batch(buff, stats_list, mib_statistic) \
|
|
{ \
|
|
int i, c; \
|
|
for_each_possible_cpu(c) { \
|
|
for (i = 0; stats_list[i].name; i++) \
|
|
buff[i] += snmp_get_cpu_field( \
|
|
mib_statistic, \
|
|
c, stats_list[i].entry); \
|
|
} \
|
|
}
|
|
|
|
void inet_get_local_port_range(struct net *net, int *low, int *high);
|
|
|
|
#ifdef CONFIG_SYSCTL
|
|
static inline bool inet_is_local_reserved_port(struct net *net, unsigned short port)
|
|
{
|
|
if (!net->ipv4.sysctl_local_reserved_ports)
|
|
return false;
|
|
return test_bit(port, net->ipv4.sysctl_local_reserved_ports);
|
|
}
|
|
|
|
static inline bool inet_is_local_unbindable_port(struct net *net, unsigned short port)
|
|
{
|
|
if (!net->ipv4.sysctl_local_unbindable_ports)
|
|
return false;
|
|
return test_bit(port, net->ipv4.sysctl_local_unbindable_ports);
|
|
}
|
|
|
|
static inline bool sysctl_dev_name_is_allowed(const char *name)
|
|
{
|
|
return strcmp(name, "default") != 0 && strcmp(name, "all") != 0;
|
|
}
|
|
|
|
static inline bool inet_port_requires_bind_service(struct net *net, unsigned short port)
|
|
{
|
|
return port < READ_ONCE(net->ipv4.sysctl_ip_prot_sock);
|
|
}
|
|
|
|
#else
|
|
static inline bool inet_is_local_reserved_port(struct net *net, unsigned short port)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
static inline bool inet_is_local_unbindable_port(struct net *net, unsigned short port)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
static inline bool inet_port_requires_bind_service(struct net *net, unsigned short port)
|
|
{
|
|
return port < PROT_SOCK;
|
|
}
|
|
#endif
|
|
|
|
__be32 inet_current_timestamp(void);
|
|
|
|
/* From inetpeer.c */
|
|
extern int inet_peer_threshold;
|
|
extern int inet_peer_minttl;
|
|
extern int inet_peer_maxttl;
|
|
|
|
void ipfrag_init(void);
|
|
|
|
void ip_static_sysctl_init(void);
|
|
|
|
#define IP4_REPLY_MARK(net, mark) \
|
|
(READ_ONCE((net)->ipv4.sysctl_fwmark_reflect) ? (mark) : 0)
|
|
|
|
static inline bool ip_is_fragment(const struct iphdr *iph)
|
|
{
|
|
return (iph->frag_off & htons(IP_MF | IP_OFFSET)) != 0;
|
|
}
|
|
|
|
#ifdef CONFIG_INET
|
|
#include <net/dst.h>
|
|
|
|
/* The function in 2.2 was invalid, producing wrong result for
|
|
* check=0xFEFF. It was noticed by Arthur Skawina _year_ ago. --ANK(000625) */
|
|
static inline
|
|
int ip_decrease_ttl(struct iphdr *iph)
|
|
{
|
|
u32 check = (__force u32)iph->check;
|
|
check += (__force u32)htons(0x0100);
|
|
iph->check = (__force __sum16)(check + (check>=0xFFFF));
|
|
return --iph->ttl;
|
|
}
|
|
|
|
static inline int ip_mtu_locked(const struct dst_entry *dst)
|
|
{
|
|
const struct rtable *rt = (const struct rtable *)dst;
|
|
|
|
return rt->rt_mtu_locked || dst_metric_locked(dst, RTAX_MTU);
|
|
}
|
|
|
|
static inline
|
|
int ip_dont_fragment(const struct sock *sk, const struct dst_entry *dst)
|
|
{
|
|
u8 pmtudisc = READ_ONCE(inet_sk(sk)->pmtudisc);
|
|
|
|
return pmtudisc == IP_PMTUDISC_DO ||
|
|
(pmtudisc == IP_PMTUDISC_WANT &&
|
|
!ip_mtu_locked(dst));
|
|
}
|
|
|
|
static inline bool ip_sk_accept_pmtu(const struct sock *sk)
|
|
{
|
|
return inet_sk(sk)->pmtudisc != IP_PMTUDISC_INTERFACE &&
|
|
inet_sk(sk)->pmtudisc != IP_PMTUDISC_OMIT;
|
|
}
|
|
|
|
static inline bool ip_sk_use_pmtu(const struct sock *sk)
|
|
{
|
|
return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE;
|
|
}
|
|
|
|
static inline bool ip_sk_ignore_df(const struct sock *sk)
|
|
{
|
|
return inet_sk(sk)->pmtudisc < IP_PMTUDISC_DO ||
|
|
inet_sk(sk)->pmtudisc == IP_PMTUDISC_OMIT;
|
|
}
|
|
|
|
static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst,
|
|
bool forwarding)
|
|
{
|
|
struct net *net = dev_net(dst->dev);
|
|
unsigned int mtu;
|
|
|
|
if (READ_ONCE(net->ipv4.sysctl_ip_fwd_use_pmtu) ||
|
|
ip_mtu_locked(dst) ||
|
|
!forwarding)
|
|
return dst_mtu(dst);
|
|
|
|
/* 'forwarding = true' case should always honour route mtu */
|
|
mtu = dst_metric_raw(dst, RTAX_MTU);
|
|
if (!mtu)
|
|
mtu = min(READ_ONCE(dst->dev->mtu), IP_MAX_MTU);
|
|
|
|
return mtu - lwtunnel_headroom(dst->lwtstate, mtu);
|
|
}
|
|
|
|
static inline unsigned int ip_skb_dst_mtu(struct sock *sk,
|
|
const struct sk_buff *skb)
|
|
{
|
|
unsigned int mtu;
|
|
|
|
if (!sk || !sk_fullsock(sk) || ip_sk_use_pmtu(sk)) {
|
|
bool forwarding = IPCB(skb)->flags & IPSKB_FORWARDED;
|
|
|
|
return ip_dst_mtu_maybe_forward(skb_dst(skb), forwarding);
|
|
}
|
|
|
|
mtu = min(READ_ONCE(skb_dst(skb)->dev->mtu), IP_MAX_MTU);
|
|
return mtu - lwtunnel_headroom(skb_dst(skb)->lwtstate, mtu);
|
|
}
|
|
|
|
struct dst_metrics *ip_fib_metrics_init(struct net *net, struct nlattr *fc_mx,
|
|
int fc_mx_len,
|
|
struct netlink_ext_ack *extack);
|
|
static inline void ip_fib_metrics_put(struct dst_metrics *fib_metrics)
|
|
{
|
|
if (fib_metrics != &dst_default_metrics &&
|
|
refcount_dec_and_test(&fib_metrics->refcnt))
|
|
kfree(fib_metrics);
|
|
}
|
|
|
|
/* ipv4 and ipv6 both use refcounted metrics if it is not the default */
|
|
static inline
|
|
void ip_dst_init_metrics(struct dst_entry *dst, struct dst_metrics *fib_metrics)
|
|
{
|
|
dst_init_metrics(dst, fib_metrics->metrics, true);
|
|
|
|
if (fib_metrics != &dst_default_metrics) {
|
|
dst->_metrics |= DST_METRICS_REFCOUNTED;
|
|
refcount_inc(&fib_metrics->refcnt);
|
|
}
|
|
}
|
|
|
|
static inline
|
|
void ip_dst_metrics_put(struct dst_entry *dst)
|
|
{
|
|
struct dst_metrics *p = (struct dst_metrics *)DST_METRICS_PTR(dst);
|
|
|
|
if (p != &dst_default_metrics && refcount_dec_and_test(&p->refcnt))
|
|
kfree(p);
|
|
}
|
|
|
|
u32 ip_idents_reserve(u32 hash, int segs);
|
|
void __ip_select_ident(struct net *net, struct iphdr *iph, int segs);
|
|
|
|
static inline void ip_select_ident_segs(struct net *net, struct sk_buff *skb,
|
|
struct sock *sk, int segs)
|
|
{
|
|
struct iphdr *iph = ip_hdr(skb);
|
|
|
|
/* We had many attacks based on IPID, use the private
|
|
* generator as much as we can.
|
|
*/
|
|
if (sk && inet_sk(sk)->inet_daddr) {
|
|
iph->id = htons(inet_sk(sk)->inet_id);
|
|
inet_sk(sk)->inet_id += segs;
|
|
return;
|
|
}
|
|
if ((iph->frag_off & htons(IP_DF)) && !skb->ignore_df) {
|
|
iph->id = 0;
|
|
} else {
|
|
/* Unfortunately we need the big hammer to get a suitable IPID */
|
|
__ip_select_ident(net, iph, segs);
|
|
}
|
|
}
|
|
|
|
static inline void ip_select_ident(struct net *net, struct sk_buff *skb,
|
|
struct sock *sk)
|
|
{
|
|
ip_select_ident_segs(net, skb, sk, 1);
|
|
}
|
|
|
|
static inline __wsum inet_compute_pseudo(struct sk_buff *skb, int proto)
|
|
{
|
|
return csum_tcpudp_nofold(ip_hdr(skb)->saddr, ip_hdr(skb)->daddr,
|
|
skb->len, proto, 0);
|
|
}
|
|
|
|
/* copy IPv4 saddr & daddr to flow_keys, possibly using 64bit load/store
|
|
* Equivalent to : flow->v4addrs.src = iph->saddr;
|
|
* flow->v4addrs.dst = iph->daddr;
|
|
*/
|
|
static inline void iph_to_flow_copy_v4addrs(struct flow_keys *flow,
|
|
const struct iphdr *iph)
|
|
{
|
|
BUILD_BUG_ON(offsetof(typeof(flow->addrs), v4addrs.dst) !=
|
|
offsetof(typeof(flow->addrs), v4addrs.src) +
|
|
sizeof(flow->addrs.v4addrs.src));
|
|
memcpy(&flow->addrs.v4addrs, &iph->addrs, sizeof(flow->addrs.v4addrs));
|
|
flow->control.addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS;
|
|
}
|
|
|
|
static inline __wsum inet_gro_compute_pseudo(struct sk_buff *skb, int proto)
|
|
{
|
|
const struct iphdr *iph = skb_gro_network_header(skb);
|
|
|
|
return csum_tcpudp_nofold(iph->saddr, iph->daddr,
|
|
skb_gro_len(skb), proto, 0);
|
|
}
|
|
|
|
/*
|
|
* Map a multicast IP onto multicast MAC for type ethernet.
|
|
*/
|
|
|
|
static inline void ip_eth_mc_map(__be32 naddr, char *buf)
|
|
{
|
|
__u32 addr=ntohl(naddr);
|
|
buf[0]=0x01;
|
|
buf[1]=0x00;
|
|
buf[2]=0x5e;
|
|
buf[5]=addr&0xFF;
|
|
addr>>=8;
|
|
buf[4]=addr&0xFF;
|
|
addr>>=8;
|
|
buf[3]=addr&0x7F;
|
|
}
|
|
|
|
/*
|
|
* Map a multicast IP onto multicast MAC for type IP-over-InfiniBand.
|
|
* Leave P_Key as 0 to be filled in by driver.
|
|
*/
|
|
|
|
static inline void ip_ib_mc_map(__be32 naddr, const unsigned char *broadcast, char *buf)
|
|
{
|
|
__u32 addr;
|
|
unsigned char scope = broadcast[5] & 0xF;
|
|
|
|
buf[0] = 0; /* Reserved */
|
|
buf[1] = 0xff; /* Multicast QPN */
|
|
buf[2] = 0xff;
|
|
buf[3] = 0xff;
|
|
addr = ntohl(naddr);
|
|
buf[4] = 0xff;
|
|
buf[5] = 0x10 | scope; /* scope from broadcast address */
|
|
buf[6] = 0x40; /* IPv4 signature */
|
|
buf[7] = 0x1b;
|
|
buf[8] = broadcast[8]; /* P_Key */
|
|
buf[9] = broadcast[9];
|
|
buf[10] = 0;
|
|
buf[11] = 0;
|
|
buf[12] = 0;
|
|
buf[13] = 0;
|
|
buf[14] = 0;
|
|
buf[15] = 0;
|
|
buf[19] = addr & 0xff;
|
|
addr >>= 8;
|
|
buf[18] = addr & 0xff;
|
|
addr >>= 8;
|
|
buf[17] = addr & 0xff;
|
|
addr >>= 8;
|
|
buf[16] = addr & 0x0f;
|
|
}
|
|
|
|
static inline void ip_ipgre_mc_map(__be32 naddr, const unsigned char *broadcast, char *buf)
|
|
{
|
|
if ((broadcast[0] | broadcast[1] | broadcast[2] | broadcast[3]) != 0)
|
|
memcpy(buf, broadcast, 4);
|
|
else
|
|
memcpy(buf, &naddr, sizeof(naddr));
|
|
}
|
|
|
|
#if IS_ENABLED(CONFIG_IPV6)
|
|
#include <linux/ipv6.h>
|
|
#endif
|
|
|
|
static __inline__ void inet_reset_saddr(struct sock *sk)
|
|
{
|
|
inet_sk(sk)->inet_rcv_saddr = inet_sk(sk)->inet_saddr = 0;
|
|
#if IS_ENABLED(CONFIG_IPV6)
|
|
if (sk->sk_family == PF_INET6) {
|
|
struct ipv6_pinfo *np = inet6_sk(sk);
|
|
|
|
memset(&np->saddr, 0, sizeof(np->saddr));
|
|
memset(&sk->sk_v6_rcv_saddr, 0, sizeof(sk->sk_v6_rcv_saddr));
|
|
}
|
|
#endif
|
|
}
|
|
|
|
#endif
|
|
|
|
static inline unsigned int ipv4_addr_hash(__be32 ip)
|
|
{
|
|
return (__force unsigned int) ip;
|
|
}
|
|
|
|
static inline u32 ipv4_portaddr_hash(const struct net *net,
|
|
__be32 saddr,
|
|
unsigned int port)
|
|
{
|
|
return jhash_1word((__force u32)saddr, net_hash_mix(net)) ^ port;
|
|
}
|
|
|
|
bool ip_call_ra_chain(struct sk_buff *skb);
|
|
|
|
/*
|
|
* Functions provided by ip_fragment.c
|
|
*/
|
|
|
|
enum ip_defrag_users {
|
|
IP_DEFRAG_LOCAL_DELIVER,
|
|
IP_DEFRAG_CALL_RA_CHAIN,
|
|
IP_DEFRAG_CONNTRACK_IN,
|
|
__IP_DEFRAG_CONNTRACK_IN_END = IP_DEFRAG_CONNTRACK_IN + USHRT_MAX,
|
|
IP_DEFRAG_CONNTRACK_OUT,
|
|
__IP_DEFRAG_CONNTRACK_OUT_END = IP_DEFRAG_CONNTRACK_OUT + USHRT_MAX,
|
|
IP_DEFRAG_CONNTRACK_BRIDGE_IN,
|
|
__IP_DEFRAG_CONNTRACK_BRIDGE_IN = IP_DEFRAG_CONNTRACK_BRIDGE_IN + USHRT_MAX,
|
|
IP_DEFRAG_VS_IN,
|
|
IP_DEFRAG_VS_OUT,
|
|
IP_DEFRAG_VS_FWD,
|
|
IP_DEFRAG_AF_PACKET,
|
|
IP_DEFRAG_MACVLAN,
|
|
};
|
|
|
|
/* Return true if the value of 'user' is between 'lower_bond'
|
|
* and 'upper_bond' inclusively.
|
|
*/
|
|
static inline bool ip_defrag_user_in_between(u32 user,
|
|
enum ip_defrag_users lower_bond,
|
|
enum ip_defrag_users upper_bond)
|
|
{
|
|
return user >= lower_bond && user <= upper_bond;
|
|
}
|
|
|
|
int ip_defrag(struct net *net, struct sk_buff *skb, u32 user);
|
|
#ifdef CONFIG_INET
|
|
struct sk_buff *ip_check_defrag(struct net *net, struct sk_buff *skb, u32 user);
|
|
#else
|
|
static inline struct sk_buff *ip_check_defrag(struct net *net, struct sk_buff *skb, u32 user)
|
|
{
|
|
return skb;
|
|
}
|
|
#endif
|
|
|
|
/*
|
|
* Functions provided by ip_forward.c
|
|
*/
|
|
|
|
int ip_forward(struct sk_buff *skb);
|
|
|
|
/*
|
|
* Functions provided by ip_options.c
|
|
*/
|
|
|
|
void ip_options_build(struct sk_buff *skb, struct ip_options *opt,
|
|
__be32 daddr, struct rtable *rt, int is_frag);
|
|
|
|
int __ip_options_echo(struct net *net, struct ip_options *dopt,
|
|
struct sk_buff *skb, const struct ip_options *sopt);
|
|
static inline int ip_options_echo(struct net *net, struct ip_options *dopt,
|
|
struct sk_buff *skb)
|
|
{
|
|
return __ip_options_echo(net, dopt, skb, &IPCB(skb)->opt);
|
|
}
|
|
|
|
void ip_options_fragment(struct sk_buff *skb);
|
|
int __ip_options_compile(struct net *net, struct ip_options *opt,
|
|
struct sk_buff *skb, __be32 *info);
|
|
int ip_options_compile(struct net *net, struct ip_options *opt,
|
|
struct sk_buff *skb);
|
|
int ip_options_get(struct net *net, struct ip_options_rcu **optp,
|
|
sockptr_t data, int optlen);
|
|
void ip_options_undo(struct ip_options *opt);
|
|
void ip_forward_options(struct sk_buff *skb);
|
|
int ip_options_rcv_srr(struct sk_buff *skb, struct net_device *dev);
|
|
|
|
/*
|
|
* Functions provided by ip_sockglue.c
|
|
*/
|
|
|
|
void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb);
|
|
void ip_cmsg_recv_offset(struct msghdr *msg, struct sock *sk,
|
|
struct sk_buff *skb, int tlen, int offset);
|
|
int ip_cmsg_send(struct sock *sk, struct msghdr *msg,
|
|
struct ipcm_cookie *ipc, bool allow_ipv6);
|
|
int ip_setsockopt(struct sock *sk, int level, int optname, sockptr_t optval,
|
|
unsigned int optlen);
|
|
int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval,
|
|
int __user *optlen);
|
|
int ip_ra_control(struct sock *sk, unsigned char on,
|
|
void (*destructor)(struct sock *));
|
|
|
|
int ip_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len);
|
|
void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port,
|
|
u32 info, u8 *payload);
|
|
void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport,
|
|
u32 info);
|
|
|
|
static inline void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb)
|
|
{
|
|
ip_cmsg_recv_offset(msg, skb->sk, skb, 0, 0);
|
|
}
|
|
|
|
bool icmp_global_allow(void);
|
|
extern int sysctl_icmp_msgs_per_sec;
|
|
extern int sysctl_icmp_msgs_burst;
|
|
|
|
#ifdef CONFIG_PROC_FS
|
|
int ip_misc_proc_init(void);
|
|
#endif
|
|
|
|
int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto, u8 family,
|
|
struct netlink_ext_ack *extack);
|
|
|
|
static inline bool inetdev_valid_mtu(unsigned int mtu)
|
|
{
|
|
return likely(mtu >= IPV4_MIN_MTU);
|
|
}
|
|
|
|
void ip_sock_set_freebind(struct sock *sk);
|
|
int ip_sock_set_mtu_discover(struct sock *sk, int val);
|
|
void ip_sock_set_pktinfo(struct sock *sk);
|
|
void ip_sock_set_recverr(struct sock *sk);
|
|
void ip_sock_set_tos(struct sock *sk, int val);
|
|
|
|
#endif /* _IP_H */
|