90264576e2
* refs/heads/tmp-a483478: UPSTREAM: arm64: vdso: Build vDSO with -ffixed-x18 Revert "drm/dsi: Fix byte order of DCS set/get brightness" Reverting below patches from android-4.19-stable.125 Linux 4.19.125 rxrpc: Fix ack discard rxrpc: Trace discarded ACKs iio: adc: stm32-dfsdm: fix device used to request dma iio: adc: stm32-dfsdm: Use dma_request_chan() instead dma_request_slave_channel() iio: adc: stm32-adc: fix device used to request dma iio: adc: stm32-adc: Use dma_request_chan() instead dma_request_slave_channel() x86/unwind/orc: Fix unwind_get_return_address_ptr() for inactive tasks rxrpc: Fix a memory leak in rxkad_verify_response() rapidio: fix an error in get_user_pages_fast() error handling ipack: tpci200: fix error return code in tpci200_register() mei: release me_cl object reference misc: rtsx: Add short delay after exit from ASPM iio: dac: vf610: Fix an error handling path in 'vf610_dac_probe()' iio: sca3000: Remove an erroneous 'get_device()' staging: greybus: Fix uninitialized scalar variable staging: iio: ad2s1210: Fix SPI reading Revert "gfs2: Don't demote a glock until its revokes are written" brcmfmac: abort and release host after error tty: serial: qcom_geni_serial: Fix wrap around of TX buffer cxgb4/cxgb4vf: Fix mac_hlist initialization and free cxgb4: free mac_hlist properly net: bcmgenet: abort suspend on error net: bcmgenet: code movement Revert "net/ibmvnic: Fix EOI when running in XIVE mode" media: fdp1: Fix R-Car M3-N naming in debug message thunderbolt: Drop duplicated get_switch_at_route() staging: most: core: replace strcpy() by strscpy() libnvdimm/btt: Fix LBA masking during 'free list' population libnvdimm/btt: Remove unnecessary code in btt_freelist_init nfit: Add Hyper-V NVDIMM DSM command set to white list powerpc/64s: Disable STRICT_KERNEL_RWX powerpc: Remove STRICT_KERNEL_RWX incompatibility with RELOCATABLE drm/i915/gvt: Init DPLL/DDI vreg for virtual display instead of inheritance. dmaengine: owl: Use correct lock in owl_dma_get_pchan() dmaengine: tegra210-adma: Fix an error handling path in 'tegra_adma_probe()' apparmor: Fix aa_label refcnt leak in policy_update apparmor: fix potential label refcnt leak in aa_change_profile apparmor: Fix use-after-free in aa_audit_rule_init drm/etnaviv: fix perfmon domain interation ALSA: hda/realtek - Add more fixup entries for Clevo machines ALSA: hda/realtek - Fix silent output on Gigabyte X570 Aorus Xtreme ALSA: pcm: fix incorrect hw_base increase ALSA: iec1712: Initialize STDSP24 properly when using the model=staudio option padata: purge get_cpu and reorder_via_wq from padata_do_serial padata: initialize pd->cpu with effective cpumask padata: Replace delayed timer with immediate workqueue in padata_reorder ARM: futex: Address build warning platform/x86: asus-nb-wmi: Do not load on Asus T100TA and T200TA USB: core: Fix misleading driver bug report stmmac: fix pointer check after utilization in stmmac_interrupt ceph: fix double unlock in handle_cap_export() HID: quirks: Add HID_QUIRK_NO_INIT_REPORTS quirk for Dell K12A keyboard-dock gtp: set NLM_F_MULTI flag in gtp_genl_dump_pdp() x86/apic: Move TSC deadline timer debug printk HID: i2c-hid: reset Synaptics SYNA2393 on resume scsi: ibmvscsi: Fix WARN_ON during event pool release component: Silence bind error on -EPROBE_DEFER aquantia: Fix the media type of AQC100 ethernet controller in the driver vhost/vsock: fix packet delivery order to monitoring devices configfs: fix config_item refcnt leak in configfs_rmdir() scsi: qla2xxx: Delete all sessions before unregister local nvme port scsi: qla2xxx: Fix hang when issuing nvme disconnect-all in NPIV HID: alps: ALPS_1657 is too specific; use U1_UNICORN_LEGACY instead HID: alps: Add AUI1657 device ID HID: multitouch: add eGalaxTouch P80H84 support gcc-common.h: Update for GCC 10 ubi: Fix seq_file usage in detailed_erase_block_info debugfs file i2c: mux: demux-pinctrl: Fix an error handling path in 'i2c_demux_pinctrl_probe()' iommu/amd: Fix over-read of ACPI UID from IVRS table ubifs: remove broken lazytime support fix multiplication overflow in copy_fdtable() mtd: spinand: Propagate ECC information to the MTD structure ima: Fix return value of ima_write_policy() evm: Check also if *tfm is an error pointer in init_desc() ima: Set file->f_mode instead of file->f_flags in ima_calc_file_hash() riscv: set max_pfn to the PFN of the last page KVM: SVM: Fix potential memory leak in svm_cpu_init() i2c: dev: Fix the race between the release of i2c_dev and cdev ubsan: build ubsan.c more conservatively x86/uaccess, ubsan: Fix UBSAN vs. SMAP ANDROID: scsi: ufs: Handle clocks when lrbp fails ANDROID: fscrypt: handle direct I/O with IV_INO_LBLK_32 BACKPORT: FROMLIST: fscrypt: add support for IV_INO_LBLK_32 policies ANDROID: Update the ABI xml and qcom whitelist ANDROID: Fix build.config.gki-debug Linux 4.19.124 Makefile: disallow data races on gcc-10 as well KVM: x86: Fix off-by-one error in kvm_vcpu_ioctl_x86_setup_mce ARM: dts: r8a7740: Add missing extal2 to CPG node arm64: dts: renesas: r8a77980: Fix IPMMU VIP[01] nodes ARM: dts: r8a73a4: Add missing CMT1 interrupts arm64: dts: rockchip: Rename dwc3 device nodes on rk3399 to make dtc happy arm64: dts: rockchip: Replace RK805 PMIC node name with "pmic" on rk3328 boards clk: Unlink clock if failed to prepare or enable Revert "ALSA: hda/realtek: Fix pop noise on ALC225" usb: gadget: legacy: fix error return code in cdc_bind() usb: gadget: legacy: fix error return code in gncm_bind() usb: gadget: audio: Fix a missing error return value in audio_bind() usb: gadget: net2272: Fix a memory leak in an error handling path in 'net2272_plat_probe()' dwc3: Remove check for HWO flag in dwc3_gadget_ep_reclaim_trb_sg() clk: rockchip: fix incorrect configuration of rk3228 aclk_gpu* clocks exec: Move would_dump into flush_old_exec x86/unwind/orc: Fix error handling in __unwind_start() x86: Fix early boot crash on gcc-10, third try cifs: fix leaked reference on requeued write ARM: dts: imx27-phytec-phycard-s-rdk: Fix the I2C1 pinctrl entries ARM: dts: dra7: Fix bus_dma_limit for PCIe usb: xhci: Fix NULL pointer dereference when enqueuing trbs from urb sg list USB: gadget: fix illegal array access in binding with UDC usb: host: xhci-plat: keep runtime active when removing host usb: core: hub: limit HUB_QUIRK_DISABLE_AUTOSUSPEND to USB5534B ALSA: usb-audio: Add control message quirk delay for Kingston HyperX headset ALSA: rawmidi: Fix racy buffer resize under concurrent accesses ALSA: hda/realtek - Limit int mic boost for Thinkpad T530 gcc-10: avoid shadowing standard library 'free()' in crypto gcc-10: disable 'restrict' warning for now gcc-10: disable 'stringop-overflow' warning for now gcc-10: disable 'array-bounds' warning for now gcc-10: disable 'zero-length-bounds' warning for now Stop the ad-hoc games with -Wno-maybe-initialized kbuild: compute false-positive -Wmaybe-uninitialized cases in Kconfig gcc-10 warnings: fix low-hanging fruit pnp: Use list_for_each_entry() instead of open coding hwmon: (da9052) Synchronize access with mfd IB/mlx4: Test return value of calls to ib_get_cached_pkey netfilter: nft_set_rbtree: Introduce and use nft_rbtree_interval_start() arm64: fix the flush_icache_range arguments in machine_kexec netfilter: conntrack: avoid gcc-10 zero-length-bounds warning NFSv4: Fix fscache cookie aux_data to ensure change_attr is included nfs: fscache: use timespec64 in inode auxdata NFS: Fix fscache super_cookie index_key from changing after umount mmc: block: Fix request completion in the CQE timeout path mmc: core: Check request type before completing the request i40iw: Fix error handling in i40iw_manage_arp_cache() pinctrl: cherryview: Add missing spinlock usage in chv_gpio_irq_handler pinctrl: baytrail: Enable pin configuration setting for GPIO chip gfs2: Another gfs2_walk_metadata fix ALSA: hda/realtek - Fix S3 pop noise on Dell Wyse ipc/util.c: sysvipc_find_ipc() incorrectly updates position index drm/qxl: lost qxl_bo_kunmap_atomic_page in qxl_image_init_helper() ALSA: hda/hdmi: fix race in monitor detection during probe cpufreq: intel_pstate: Only mention the BIOS disabling turbo mode once dmaengine: mmp_tdma: Reset channel error on release dmaengine: pch_dma.c: Avoid data race between probe and irq handler riscv: fix vdso build with lld tcp: fix SO_RCVLOWAT hangs with fat skbs net: tcp: fix rx timestamp behavior for tcp_recvmsg netprio_cgroup: Fix unlimited memory leak of v2 cgroups net: ipv4: really enforce backoff for redirects net: dsa: loop: Add module soft dependency hinic: fix a bug of ndo_stop virtio_net: fix lockdep warning on 32 bit tcp: fix error recovery in tcp_zerocopy_receive() Revert "ipv6: add mtu lock check in __ip6_rt_update_pmtu" pppoe: only process PADT targeted at local interfaces net: phy: fix aneg restart in phy_ethtool_set_eee netlabel: cope with NULL catmap net: fix a potential recursive NETDEV_FEAT_CHANGE mmc: sdhci-acpi: Add SDHCI_QUIRK2_BROKEN_64_BIT_DMA for AMDI0040 scsi: sg: add sg_remove_request in sg_write virtio-blk: handle block_device_operations callbacks after hot unplug drop_monitor: work around gcc-10 stringop-overflow warning net: moxa: Fix a potential double 'free_irq()' net/sonic: Fix a resource leak in an error handling path in 'jazz_sonic_probe()' shmem: fix possible deadlocks on shmlock_user_lock net: dsa: Do not make user port errors fatal ANDROID: rtc: class: call hctosys in resource managed registration ANDROID: GKI: Update the ABI xml and whitelist ANDROID: power_supply: Add RTX power-supply property f2fs: flush dirty meta pages when flushing them f2fs: fix checkpoint=disable:%u%% f2fs: rework filename handling f2fs: split f2fs_d_compare() from f2fs_match_name() f2fs: don't leak filename in f2fs_try_convert_inline_dir() ANDROID: clang: update to 11.0.1 FROMLIST: x86_64: fix jiffies ODR violation ANDROID: arm64: vdso: Fix removing SCS flags ANDROID: GKI: Update the ABI xml and whitelist ANDROID: Incremental fs: wake up log pollers less often ANDROID: Incremental fs: Fix scheduling while atomic error ANDROID: Incremental fs: Avoid continually recalculating hashes ANDROID: export: Disable symbol trimming on modules ANDROID: GKI: Update the ABI xml and whitelist ANDROID: fscrypt: set dun_bytes more precisely ANDROID: dm-default-key: set dun_bytes more precisely ANDROID: block: backport the ability to specify max_dun_bytes ANDROID: Revert "ANDROID: GKI: gki_defconfig: CONFIG_DM_DEFAULT_KEY=m" Linux 4.19.123 ipc/mqueue.c: change __do_notify() to bypass check_kill_permission() scripts/decodecode: fix trapping instruction formatting objtool: Fix stack offset tracking for indirect CFAs netfilter: nf_osf: avoid passing pointer to local var netfilter: nat: never update the UDP checksum when it's 0 x86/unwind/orc: Fix premature unwind stoppage due to IRET frames x86/unwind/orc: Fix error path for bad ORC entry type x86/unwind/orc: Prevent unwinding before ORC initialization x86/unwind/orc: Don't skip the first frame for inactive tasks x86/entry/64: Fix unwind hints in rewind_stack_do_exit() x86/entry/64: Fix unwind hints in kernel exit path x86/entry/64: Fix unwind hints in register clearing code batman-adv: Fix refcnt leak in batadv_v_ogm_process batman-adv: Fix refcnt leak in batadv_store_throughput_override batman-adv: Fix refcnt leak in batadv_show_throughput_override batman-adv: fix batadv_nc_random_weight_tq KVM: VMX: Mark RCX, RDX and RSI as clobbered in vmx_vcpu_run()'s asm blob KVM: VMX: Explicitly reference RCX as the vmx_vcpu pointer in asm blobs coredump: fix crash when umh is disabled staging: gasket: Check the return value of gasket_get_bar_index() mm/page_alloc: fix watchdog soft lockups during set_zone_contiguous() arm64: hugetlb: avoid potential NULL dereference KVM: arm64: Fix 32bit PC wrap-around KVM: arm: vgic: Fix limit condition when writing to GICD_I[CS]ACTIVER tracing: Add a vmalloc_sync_mappings() for safe measure USB: serial: garmin_gps: add sanity checking for data length USB: uas: add quirk for LaCie 2Big Quadra HID: usbhid: Fix race between usbhid_close() and usbhid_stop() sctp: Fix bundling of SHUTDOWN with COOKIE-ACK HID: wacom: Read HID_DG_CONTACTMAX directly for non-generic devices net: stricter validation of untrusted gso packets bnxt_en: Fix VF anti-spoof filter setup. bnxt_en: Improve AER slot reset. net/mlx5: Fix command entry leak in Internal Error State net/mlx5: Fix forced completion access non initialized command entry bnxt_en: Fix VLAN acceleration handling in bnxt_fix_features(). tipc: fix partial topology connection closure sch_sfq: validate silly quantum values sch_choke: avoid potential panic in choke_reset() net: usb: qmi_wwan: add support for DW5816e net_sched: sch_skbprio: add message validation to skbprio_change() net/mlx4_core: Fix use of ENOSPC around mlx4_counter_alloc() net: macsec: preserve ingress frame ordering fq_codel: fix TCA_FQ_CODEL_DROP_BATCH_SIZE sanity checks dp83640: reverse arguments to list_add_tail vt: fix unicode console freeing with a common interface tracing/kprobes: Fix a double initialization typo USB: serial: qcserial: Add DW5816e support ANDROID: usb: gadget: Add missing inline qualifier to stub functions ANDROID: Drop ABI monitoring from KASAN build config ANDROID: Rename build.config.gki.arch_kasan ANDROID: GKI: Enable CONFIG_STATIC_USERMODEHELPER ANDROID: dm-default-key: Update key size for wrapped keys ANDROID: gki_defconfig: enable CONFIG_MMC_CRYPTO ANDROID: mmc: MMC crypto API ANDROID: GKI: Update the ABI xml and whitelist ANDROID: GKI: add missing exports for cam_smmu_api.ko Linux 4.19.122 drm/atomic: Take the atomic toys away from X cgroup, netclassid: remove double cond_resched mac80211: add ieee80211_is_any_nullfunc() platform/x86: GPD pocket fan: Fix error message when temp-limits are out of range ALSA: hda: Match both PCI ID and SSID for driver blacklist hexagon: define ioremap_uc hexagon: clean up ioremap mfd: intel-lpss: Use devm_ioremap_uc for MMIO lib: devres: add a helper function for ioremap_uc drm/amdgpu: Fix oops when pp_funcs is unset in ACPI event sctp: Fix SHUTDOWN CTSN Ack in the peer restart case net: systemport: suppress warnings on failed Rx SKB allocations net: bcmgenet: suppress warnings on failed Rx SKB allocations lib/mpi: Fix building for powerpc with clang scripts/config: allow colons in option strings for sed s390/ftrace: fix potential crashes when switching tracers cifs: protect updating server->dstaddr with a spinlock ASoC: rsnd: Fix "status check failed" spam for multi-SSI ASoC: rsnd: Don't treat master SSI in multi SSI setup as parent net: stmmac: Fix sub-second increment net: stmmac: fix enabling socfpga's ptp_ref_clock wimax/i2400m: Fix potential urb refcnt leak drm/amdgpu: Correctly initialize thermal controller for GPUs with Powerplay table v0 (e.g Hawaii) ASoC: codecs: hdac_hdmi: Fix incorrect use of list_for_each_entry ASoC: rsnd: Fix HDMI channel mapping for multi-SSI mode ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode usb: dwc3: gadget: Properly set maxpacket limit ASoC: sgtl5000: Fix VAG power-on handling selftests/ipc: Fix test failure seen after initial test run ASoC: topology: Check return value of pcm_new_ver powerpc/pci/of: Parse unassigned resources vhost: vsock: kick send_pkt worker once device is started ANDROID: GKI: fix build warning on 32bits due to ASoC msm change ANDROID: GKI: fix build error on 32bits due to ASoC msm change ANDROID: GKI: update abi definition due to FAIR_GROUP_SCHED removal ANDROID: GKI: Remove FAIR_GROUP_SCHED ANDROID: GKI: BULK update ABI XML representation and qcom whitelist ANDROID: build.config.gki.aarch64: Enable WHITELIST_STRICT_MODE ANDROID: GKI: Update the ABI xml and qcom whitelist ANDROID: remove unused variable ANDROID: Drop ABI monitoring from KASAN build config Linux 4.19.121 mmc: meson-mx-sdio: remove the broken ->card_busy() op mmc: meson-mx-sdio: Set MMC_CAP_WAIT_WHILE_BUSY mmc: sdhci-msm: Enable host capabilities pertains to R1b response mmc: sdhci-pci: Fix eMMC driver strength for BYT-based controllers mmc: sdhci-xenon: fix annoying 1.8V regulator warning mmc: cqhci: Avoid false "cqhci: CQE stuck on" by not open-coding timeout loop btrfs: transaction: Avoid deadlock due to bad initialization timing of fs_info::journal_info btrfs: fix partial loss of prealloc extent past i_size after fsync selinux: properly handle multiple messages in selinux_netlink_send() dmaengine: dmatest: Fix iteration non-stop logic nfs: Fix potential posix_acl refcnt leak in nfs3_set_acl ALSA: opti9xx: shut up gcc-10 range warning iommu/amd: Fix legacy interrupt remapping for x2APIC-enabled system scsi: target/iblock: fix WRITE SAME zeroing iommu/qcom: Fix local_base status check vfio/type1: Fix VA->PA translation for PFNMAP VMAs in vaddr_get_pfn() vfio: avoid possible overflow in vfio_iommu_type1_pin_pages RDMA/core: Fix race between destroy and release FD object RDMA/core: Prevent mixed use of FDs between shared ufiles RDMA/mlx4: Initialize ib_spec on the stack RDMA/mlx5: Set GRH fields in query QP on RoCE scsi: qla2xxx: check UNLOADING before posting async work scsi: qla2xxx: set UNLOADING before waiting for session deletion dm multipath: use updated MPATHF_QUEUE_IO on mapping for bio-based mpath dm writecache: fix data corruption when reloading the target dm verity fec: fix hash block number in verity_fec_decode PM: hibernate: Freeze kernel threads in software_resume() PM: ACPI: Output correct message on target power state ALSA: pcm: oss: Place the plugin buffer overflow checks correctly ALSA: hda/hdmi: fix without unlocked before return ALSA: usb-audio: Correct a typo of NuPrime DAC-10 USB ID ALSA: hda/realtek - Two front mics on a Lenovo ThinkCenter btrfs: fix block group leak when removing fails drm/qxl: qxl_release use after free drm/qxl: qxl_release leak in qxl_hw_surface_alloc() drm/qxl: qxl_release leak in qxl_draw_dirty_fb() drm/edid: Fix off-by-one in DispID DTD pixel clock ANDROID: GKI: Bulk update ABI XML representation ANDROID: GKI: Enable net testing options ANDROID: gki_defconfig: Enable CONFIG_REMOTEPROC ANDROID: Rename build.config.gki.arch_kasan ANDROID: GKI: Update ABI for IOMMU ANDROID: Incremental fs: Fix issues with very large files ANDROID: Correct build.config branch name ANDROID: GKI: Bulk update ABI XML representation and whitelist. UPSTREAM: vdso: Fix clocksource.h macro detection ANDROID: GKI: update abi definition due to added padding ANDROID: GKI: networking: add Android ABI padding to a lot of networking structures ANDROID: GKI: dma-mapping.h: add Android ABI padding to a structure ANDROID: GKI: ioport.h: add Android ABI padding to a structure ANDROID: GKI: iomap.h: add Android ABI padding to a structure ANDROID: GKI: genhd.h: add Android ABI padding to some structures ANDROID: GKI: hrtimer.h: add Android ABI padding to a structure ANDROID: GKI: ethtool.h: add Android ABI padding to a structure ANDROID: GKI: sched: add Android ABI padding to some structures ANDROID: GKI: kernfs.h: add Android ABI padding to some structures ANDROID: GKI: kobject.h: add Android ABI padding to some structures ANDROID: GKI: mm.h: add Android ABI padding to a structure ANDROID: GKI: mmu_notifier.h: add Android ABI padding to some structures ANDROID: GKI: pci: add Android ABI padding to some structures ANDROID: GKI: irqdomain.h: add Android ABI padding to a structure ANDROID: GKI: blk_types.h: add Android ABI padding to a structure ANDROID: GKI: scsi.h: add Android ABI padding to a structure ANDROID: GKI: quota.h: add Android ABI padding to some structures ANDROID: GKI: timer.h: add Android ABI padding to a structure ANDROID: GKI: user_namespace.h: add Android ABI padding to a structure FROMGIT: f2fs: fix missing check for f2fs_unlock_op Linux 4.19.120 propagate_one(): mnt_set_mountpoint() needs mount_lock ext4: check for non-zero journal inum in ext4_calculate_overhead qed: Fix use after free in qed_chain_free bpf, x86_32: Fix clobbering of dst for BPF_JSET hwmon: (jc42) Fix name to have no illegal characters ext4: convert BUG_ON's to WARN_ON's in mballoc.c ext4: increase wait time needed before reuse of deleted inode numbers ext4: use matching invalidatepage in ext4_writepage arm64: Delete the space separator in __emit_inst ALSA: hda: call runtime_allow() for all hda controllers xen/xenbus: ensure xenbus_map_ring_valloc() returns proper grant status objtool: Support Clang non-section symbols in ORC dump objtool: Fix CONFIG_UBSAN_TRAP unreachable warnings scsi: target: tcmu: reset_ring should reset TCMU_DEV_BIT_BROKEN scsi: target: fix PR IN / READ FULL STATUS for FC ALSA: hda: Explicitly permit using autosuspend if runtime PM is supported ALSA: hda: Keep the controller initialization even if no codecs found xfs: fix partially uninitialized structure in xfs_reflink_remap_extent x86: hyperv: report value of misc_features net: fec: set GPR bit on suspend by DT configuration. bpf, x86: Fix encoding for lower 8-bit registers in BPF_STX BPF_B xfs: clear PF_MEMALLOC before exiting xfsaild thread mm: shmem: disable interrupt when acquiring info->lock in userfaultfd_copy path bpf, x86_32: Fix incorrect encoding in BPF_LDX zero-extension perf/core: fix parent pid/tid in task exit events net/mlx5: Fix failing fw tracer allocation on s390 cpumap: Avoid warning when CONFIG_DEBUG_PER_CPU_MAPS is enabled ARM: dts: bcm283x: Disable dsi0 node PCI: Move Apex Edge TPU class quirk to fix BAR assignment PCI: Avoid ASMedia XHCI USB PME# from D0 defect svcrdma: Fix leak of svc_rdma_recv_ctxt objects svcrdma: Fix trace point use-after-free race xfs: acquire superblock freeze protection on eofblocks scans net/cxgb4: Check the return from t4_query_params properly rxrpc: Fix DATA Tx to disable nofrag for UDP on AF_INET6 socket i2c: altera: use proper variable to hold errno nfsd: memory corruption in nfsd4_lock() ASoC: wm8960: Fix wrong clock after suspend & resume ASoC: tas571x: disable regulators on failed probe ASoC: q6dsp6: q6afe-dai: add missing channels to MI2S DAIs iio:ad7797: Use correct attribute_group usb: gadget: udc: bdc: Remove unnecessary NULL checks in bdc_req_complete usb: dwc3: gadget: Do link recovery for SS and SSP binder: take read mode of mmap_sem in binder_alloc_free_page() include/uapi/linux/swab.h: fix userspace breakage, use __BITS_PER_LONG for swap mtd: cfi: fix deadloop in cfi_cmdset_0002.c do_write_buffer remoteproc: Fix wrong rvring index computation FROMLIST: PM / devfreq: Restart previous governor if new governor fails to start ANDROID: GKI: arm64: Enable GZIP and LZ4 kernel compression modes ANDROID: GKI: arm64: gki_defconfig: Set arm_smmu configuration ANDROID: GKI: iommu/arm-smmu: Modularize ARM SMMU driver ANDROID: GKI: iommu: Snapshot of vendor changes ANDROID: GKI: Additions to ARM SMMU register definitions ANDROID: GKI: iommu/io-pgtable-arm: LPAE related updates by vendor ANDROID: GKI: common: dma-mapping: make dma_common_contiguous_remap more robust ANDROID: GKI: dma-coherent: Expose device base address and size ANDROID: GKI: arm64: add support for NO_KERNEL_MAPPING and STRONGLY_ORDERED ANDROID: GKI: dma-mapping: Add dma_remap functions ANDROID: GKI: arm64: Support early fixup for CMA ANDROID: GKI: iommu: dma-mapping-fast: Fast ARMv7/v8 Long Descriptor Format ANDROID: GKI: arm64: dma-mapping: add support for IOMMU mapper ANDROID: GKI: add ARCH_NR_GPIO for ABI match ANDROID: GKI: kernel: Export symbol of `cpu_do_idle` ANDROID: GKI: kernel: Export symbols needed by msm_minidump.ko and minidump_log.ko (again) ANDROID: GKI: add missing exports for __flush_dcache_area ANDROID: GKI: arm64: Export caching APIs ANDROID: GKI: arm64: provide dma cache routines with same API as 32 bit ANDROID: gki_defconfig: add FORTIFY_SOURCE, remove SPMI_MSM_PMIC_ARB Revert "ANDROID: GKI: spmi: pmic-arb: don't enable SPMI_MSM_PMIC_ARB by default" ANDROID: GKI: update abi definitions after adding padding ANDROID: GKI: elevator: add Android ABI padding to some structures ANDROID: GKI: dentry: add Android ABI padding to some structures ANDROID: GKI: bio: add Android ABI padding to some structures ANDROID: GKI: scsi: add Android ABI padding to some structures ANDROID: GKI: ufs: add Android ABI padding to some structures ANDROID: GKI: workqueue.h: add Android ABI padding to some structures ANDROID: GKI: fs.h: add Android ABI padding to some structures ANDROID: GKI: USB: add Android ABI padding to some structures ANDROID: GKI: mm: add Android ABI padding to some structures ANDROID: GKI: mount.h: add Android ABI padding to some structures ANDROID: GKI: sched.h: add Android ABI padding to some structures ANDROID: GKI: sock.h: add Android ABI padding to some structures ANDROID: GKI: module.h: add Android ABI padding to some structures ANDROID: GKI: device.h: add Android ABI padding to some structures ANDROID: GKI: phy: add Android ABI padding to some structures ANDROID: GKI: add android_kabi.h ANDROID: ABI: update due to previous changes in the tree BACKPORT: sched/core: Fix reset-on-fork from RT with uclamp ANDROID: GKI: Add support for missing V4L2 symbols ANDROID: GKI: Bulk update ABI XML representation ANDROID: GKI: arm64: psci: Support for OS initiated scheme ANDROID: GKI: net: add counter for number of frames coalesced in GRO ANDROID: GKI: cfg80211: Include length of kek in rekey data BACKPORT: loop: change queue block size to match when using DIO ANDROID: Incremental fs: Add setattr call ANDROID: GKI: enable CONFIG_RTC_SYSTOHC ANDROID: GKI: ipv4: add vendor padding to __IPV4_DEVCONF_* enums Revert "ANDROID: GKI: ipv4: increase __IPV4_DEVCONF_MAX to 64" ANDROID: driver: gpu: drm: fix export symbol types ANDROID: SoC: core: fix export symbol type ANDROID: ufshcd-crypto: fix export symbol type ANDROID: GKI: drivers: mailbox: fix race resulting in multiple message submission ANDROID: GKI: arm64: gki_defconfig: Enable a few thermal configs Revert "ANDROID: GKI: add base.h include to match MODULE_VERSIONS" FROMLIST: thermal: Make cooling device trip point writable from sysfs ANDROID: GKI: drivers: thermal: cpu_cooling: Use CPU ID as cooling device ID ANDROID: GKI: PM / devfreq: Allow min freq to be 0 ANDROID: GKI: arm64: gki_defconfig: Enable REGULATOR_PROXY_CONSUMER ANDROID: GKI: Bulk Update ABI XML representation ANDROID: KASAN support for GKI remove CONFIG_CC_WERROR ANDROID: KASAN support for GKI ANDROID: virt_wifi: fix export symbol types ANDROID: vfs: fix export symbol type ANDROID: vfs: fix export symbol types ANDROID: fscrypt: fix export symbol type ANDROID: cfi: fix export symbol types ANDROID: bpf: fix export symbol type Linux 4.19.119 s390/mm: fix page table upgrade vs 2ndary address mode accesses xfs: Fix deadlock between AGI and AGF with RENAME_WHITEOUT serial: sh-sci: Make sure status register SCxSR is read in correct sequence xhci: prevent bus suspend if a roothub port detected a over-current condition usb: f_fs: Clear OS Extended descriptor counts to zero in ffs_data_reset() usb: dwc3: gadget: Fix request completion check UAS: fix deadlock in error handling and PM flushing work UAS: no use logging any details in case of ENODEV cdc-acm: introduce a cool down cdc-acm: close race betrween suspend() and acm_softint staging: vt6656: Power save stop wake_up_count wrap around. staging: vt6656: Fix pairwise key entry save. staging: vt6656: Fix drivers TBTT timing counter. staging: vt6656: Fix calling conditions of vnt_set_bss_mode staging: vt6656: Don't set RCR_MULTICAST or RCR_BROADCAST by default. vt: don't use kmalloc() for the unicode screen buffer vt: don't hardcode the mem allocation upper bound staging: comedi: Fix comedi_device refcnt leak in comedi_open staging: comedi: dt2815: fix writing hi byte of analog output powerpc/setup_64: Set cache-line-size based on cache-block-size ARM: imx: provide v7_cpu_resume() only on ARM_CPU_SUSPEND=y iwlwifi: mvm: beacon statistics shouldn't go backwards iwlwifi: pcie: actually release queue memory in TVQM ASoC: dapm: fixup dapm kcontrol widget audit: check the length of userspace generated audit records usb-storage: Add unusual_devs entry for JMicron JMS566 tty: rocket, avoid OOB access tty: hvc: fix buffer overflow during hvc_alloc(). KVM: VMX: Enable machine check support for 32bit targets KVM: Check validity of resolved slot when searching memslots KVM: s390: Return last valid slot if approx index is out-of-bounds tpm: ibmvtpm: retry on H_CLOSED in tpm_ibmvtpm_send() tpm/tpm_tis: Free IRQ if probing fails ALSA: usb-audio: Filter out unsupported sample rates on Focusrite devices ALSA: usb-audio: Fix usb audio refcnt leak when getting spdif ALSA: hda/realtek - Add new codec supported for ALC245 ALSA: hda/realtek - Fix unexpected init_amp override ALSA: usx2y: Fix potential NULL dereference tools/vm: fix cross-compile build mm/ksm: fix NULL pointer dereference when KSM zero page is enabled mm/hugetlb: fix a addressing exception caused by huge_pte_offset vmalloc: fix remap_vmalloc_range() bounds checks USB: hub: Fix handling of connect changes during sleep USB: core: Fix free-while-in-use bug in the USB S-Glibrary USB: early: Handle AMD's spec-compliant identifiers, too USB: Add USB_QUIRK_DELAY_CTRL_MSG and USB_QUIRK_DELAY_INIT for Corsair K70 RGB RAPIDFIRE USB: sisusbvga: Change port variable from signed to unsigned fs/namespace.c: fix mountpoint reference counter race iio: xilinx-xadc: Make sure not exceed maximum samplerate iio: xilinx-xadc: Fix sequencer configuration for aux channels in simultaneous mode iio: xilinx-xadc: Fix clearing interrupt when enabling trigger iio: xilinx-xadc: Fix ADC-B powerdown iio: adc: stm32-adc: fix sleep in atomic context iio: st_sensors: rely on odr mask to know if odr can be set iio: core: remove extra semi-colon from devm_iio_device_register() macro ALSA: usb-audio: Add connector notifier delegation ALSA: usb-audio: Add static mapping table for ALC1220-VB-based mobos ALSA: hda: Remove ASUS ROG Zenith from the blacklist KEYS: Avoid false positive ENOMEM error on key read mlxsw: Fix some IS_ERR() vs NULL bugs vrf: Check skb for XFRM_TRANSFORMED flag xfrm: Always set XFRM_TRANSFORMED in xfrm{4,6}_output_finish net: dsa: b53: b53_arl_rw_op() needs to select IVL or SVL net: dsa: b53: Rework ARL bin logic net: dsa: b53: Fix ARL register definitions net: dsa: b53: Lookup VID in ARL searches when VLAN is enabled vrf: Fix IPv6 with qdisc and xfrm team: fix hang in team_mode_get() tcp: cache line align MAX_TCP_HEADER sched: etf: do not assume all sockets are full blown net/x25: Fix x25_neigh refcnt leak when receiving frame net: stmmac: dwmac-meson8b: Add missing boundary to RGMII TX clock array net: netrom: Fix potential nr_neigh refcnt leak in nr_add_node net: bcmgenet: correct per TX/RX ring statistics macvlan: fix null dereference in macvlan_device_event() macsec: avoid to set wrong mtu ipv6: fix restrict IPV6_ADDRFORM operation cxgb4: fix large delays in PTP synchronization cxgb4: fix adapter crash due to wrong MC size x86/KVM: Clean up host's steal time structure x86/KVM: Make sure KVM_VCPU_FLUSH_TLB flag is not missed x86/kvm: Cache gfn to pfn translation x86/kvm: Introduce kvm_(un)map_gfn() KVM: Properly check if "page" is valid in kvm_vcpu_unmap kvm: fix compile on s390 part 2 kvm: fix compilation on s390 kvm: fix compilation on aarch64 KVM: Introduce a new guest mapping API KVM: nVMX: Always sync GUEST_BNDCFGS when it comes from vmcs01 KVM: VMX: Zero out *all* general purpose registers after VM-Exit f2fs: fix to avoid memory leakage in f2fs_listxattr blktrace: fix dereference after null check blktrace: Protect q->blk_trace with RCU net: ipv6_stub: use ip6_dst_lookup_flow instead of ip6_dst_lookup net: ipv6: add net argument to ip6_dst_lookup_flow PCI/ASPM: Allow re-enabling Clock PM scsi: smartpqi: fix call trace in device discovery virtio-blk: improve virtqueue error to BLK_STS tracing/selftests: Turn off timeout setting drm/amd/display: Not doing optimize bandwidth if flip pending. xhci: Ensure link state is U3 after setting USB_SS_PORT_LS_U3 ASoC: Intel: bytcr_rt5640: Add quirk for MPMAN MPWIN895CL tablet perf/core: Disable page faults when getting phys address pwm: bcm2835: Dynamically allocate base pwm: renesas-tpu: Fix late Runtime PM enablement Revert "powerpc/64: irq_work avoid interrupt when called with hardware irqs enabled" loop: Better discard support for block devices s390/cio: avoid duplicated 'ADD' uevents kconfig: qconf: Fix a few alignment issues ipc/util.c: sysvipc_find_ipc() should increase position index selftests: kmod: fix handling test numbers above 9 kernel/gcov/fs.c: gcov_seq_next() should increase position index nvme: fix deadlock caused by ANA update wrong locking ASoC: Intel: atom: Take the drv->lock mutex before calling sst_send_slot_map() scsi: iscsi: Report unbind session event when the target has been removed pwm: rcar: Fix late Runtime PM enablement ceph: don't skip updating wanted caps when cap is stale ceph: return ceph_mdsc_do_request() errors from __get_parent() scsi: lpfc: Fix crash in target side cable pulls hitting WAIT_FOR_UNREG scsi: lpfc: Fix kasan slab-out-of-bounds error in lpfc_unreg_login watchdog: reset last_hw_keepalive time at start arm64: Silence clang warning on mismatched value/register sizes arm64: compat: Workaround Neoverse-N1 #1542419 for compat user-space arm64: Fake the IminLine size on systems affected by Neoverse-N1 #1542419 arm64: errata: Hide CTR_EL0.DIC on systems affected by Neoverse-N1 #1542419 arm64: Add part number for Neoverse N1 vti4: removed duplicate log message. crypto: mxs-dcp - make symbols 'sha1_null_hash' and 'sha256_null_hash' static bpftool: Fix printing incorrect pointer in btf_dump_ptr drm/msm: Use the correct dma_sync calls harder ext4: fix extent_status fragmentation for plain files ANDROID: abi_gki_aarch64_cuttlefish_whitelist: remove stale symbols ANDROID: GKI: ipv4: increase __IPV4_DEVCONF_MAX to 64 ANDROID: GKI: power: add missing export for POWER_RESET_QCOM=m BACKPORT: cfg80211: Support key configuration for Beacon protection (BIGTK) BACKPORT: cfg80211: Enhance the AKM advertizement to support per interface. UPSTREAM: sysrq: Use panic() to force a crash ANDROID: GKI: kernel: sound: update codec options with block size ANDROID: add compat cross compiler ANDROID: x86/vdso: disable LTO only for VDSO BACKPORT: arm64: vdso32: Enable Clang Compilation UPSTREAM: arm64: compat: vdso: Expose BUILD_VDSO32 BACKPORT: lib/vdso: Enable common headers BACKPORT: arm: vdso: Enable arm to use common headers BACKPORT: x86/vdso: Enable x86 to use common headers BACKPORT: mips: vdso: Enable mips to use common headers UPSTREAM: arm64: vdso32: Include common headers in the vdso library UPSTREAM: arm64: vdso: Include common headers in the vdso library UPSTREAM: arm64: Introduce asm/vdso/processor.h BACKPORT: arm64: vdso32: Code clean up UPSTREAM: linux/elfnote.h: Replace elf.h with UAPI equivalent UPSTREAM: scripts: Fix the inclusion order in modpost UPSTREAM: common: Introduce processor.h UPSTREAM: linux/ktime.h: Extract common header for vDSO UPSTREAM: linux/jiffies.h: Extract common header for vDSO UPSTREAM: linux/time64.h: Extract common header for vDSO BACKPORT: linux/time32.h: Extract common header for vDSO BACKPORT: linux/time.h: Extract common header for vDSO UPSTREAM: linux/math64.h: Extract common header for vDSO BACKPORT: linux/clocksource.h: Extract common header for vDSO BACKPORT: mips: Introduce asm/vdso/clocksource.h BACKPORT: arm64: Introduce asm/vdso/clocksource.h BACKPORT: arm: Introduce asm/vdso/clocksource.h BACKPORT: x86: Introduce asm/vdso/clocksource.h UPSTREAM: linux/limits.h: Extract common header for vDSO BACKPORT: linux/kernel.h: split *_MAX and *_MIN macros into <linux/limits.h> BACKPORT: linux/bits.h: Extract common header for vDSO UPSTREAM: linux/const.h: Extract common header for vDSO BACKPORT: arm64: vdso: fix flip/flop vdso build bug UPSTREAM: lib/vdso: Allow the high resolution parts to be compiled out UPSTREAM: lib/vdso: Only read hrtimer_res when needed in __cvdso_clock_getres() UPSTREAM: lib/vdso: Mark do_hres() and do_coarse() as __always_inline UPSTREAM: lib/vdso: Avoid duplication in __cvdso_clock_getres() UPSTREAM: lib/vdso: Let do_coarse() return 0 to simplify the callsite UPSTREAM: lib/vdso: Remove checks on return value for 32 bit vDSO UPSTREAM: lib/vdso: Build 32 bit specific functions in the right context UPSTREAM: lib/vdso: Make __cvdso_clock_getres() static UPSTREAM: lib/vdso: Make clock_getres() POSIX compliant again UPSTREAM: lib/vdso/32: Provide legacy syscall fallbacks UPSTREAM: lib/vdso: Move fallback invocation to the callers UPSTREAM: lib/vdso/32: Remove inconsistent NULL pointer checks UPSTREAM: lib/vdso: Make delta calculation work correctly UPSTREAM: arm64: compat: Fix syscall number of compat_clock_getres BACKPORT: arm64: lse: Fix LSE atomics with LLVM UPSTREAM: mips: Fix gettimeofday() in the vdso library UPSTREAM: mips: vdso: Fix __arch_get_hw_counter() BACKPORT: arm64: Kconfig: Make CONFIG_COMPAT_VDSO a proper Kconfig option UPSTREAM: arm64: vdso32: Rename COMPATCC to CC_COMPAT UPSTREAM: arm64: vdso32: Pass '--target' option to clang via VDSO_CAFLAGS UPSTREAM: arm64: vdso32: Don't use KBUILD_CPPFLAGS unconditionally UPSTREAM: arm64: vdso32: Move definition of COMPATCC into vdso32/Makefile UPSTREAM: arm64: Default to building compat vDSO with clang when CONFIG_CC_IS_CLANG UPSTREAM: lib: vdso: Remove CROSS_COMPILE_COMPAT_VDSO UPSTREAM: arm64: vdso32: Remove jump label config option in Makefile UPSTREAM: arm64: vdso32: Detect binutils support for dmb ishld BACKPORT: arm64: vdso: Remove stale files from old assembly implementation UPSTREAM: arm64: vdso32: Fix broken compat vDSO build warnings UPSTREAM: mips: compat: vdso: Use legacy syscalls as fallback BACKPORT: arm64: Relax Documentation/arm64/tagged-pointers.rst BACKPORT: arm64: Add tagged-address-abi.rst to index.rst UPSTREAM: arm64: vdso: Fix Makefile regression UPSTREAM: mips: vdso: Fix flip/flop vdso building bug UPSTREAM: mips: vdso: Fix source path UPSTREAM: mips: Add clock_gettime64 entry point UPSTREAM: mips: Add clock_getres entry point BACKPORT: mips: Add support for generic vDSO BACKPORT: arm64: vdso: Explicitly add build-id option BACKPORT: arm64: vdso: use $(LD) instead of $(CC) to link VDSO BACKPORT: arm64: vdso: Cleanup Makefiles UPSTREAM: arm64: vdso: Fix population of AT_SYSINFO_EHDR for compat vdso UPSTREAM: arm64: vdso: Fix compilation with clang older than 8 UPSTREAM: arm64: compat: Fix __arch_get_hw_counter() implementation UPSTREAM: arm64: Fix __arch_get_hw_counter() implementation UPSTREAM: x86/vdso/32: Use 32bit syscall fallback UPSTREAM: x86/vdso: Fix flip/flop vdso build bug UPSTREAM: x86/vdso: Give the [ph]vclock_page declarations real types UPSTREAM: x86/vdso: Add clock_gettime64() entry point BACKPORT: x86/vdso: Add clock_getres() entry point BACKPORT: x86/vdso: Switch to generic vDSO implementation UPSTREAM: x86/segments: Introduce the 'CPUNODE' naming to better document the segment limit CPU/node NR trick UPSTREAM: x86/vdso: Initialize the CPU/node NR segment descriptor earlier UPSTREAM: x86/vdso: Introduce helper functions for CPU and node number UPSTREAM: x86/segments/64: Rename the GDT PER_CPU entry to CPU_NUMBER BACKPORT: arm64: vdso: Enable vDSO compat support UPSTREAM: arm64: compat: Get sigreturn trampolines from vDSO UPSTREAM: arm64: elf: VDSO code page discovery UPSTREAM: arm64: compat: VDSO setup for compat layer UPSTREAM: arm64: vdso: Refactor vDSO code BACKPORT: arm64: compat: Add vDSO UPSTREAM: arm64: compat: Generate asm offsets for signals UPSTREAM: arm64: compat: Expose signal related structures UPSTREAM: arm64: compat: Add missing syscall numbers BACKPORT: arm64: vdso: Substitute gettimeofday() with C implementation UPSTREAM: timekeeping: Provide a generic update_vsyscall() implementation UPSTREAM: lib/vdso: Add compat support UPSTREAM: lib/vdso: Provide generic VDSO implementation UPSTREAM: vdso: Define standardized vdso_datapage UPSTREAM: hrtimer: Split out hrtimer defines into separate header UPSTREAM: nds32: Fix vDSO clock_getres() UPSTREAM: arm64: compat: Reduce address limit for 64K pages BACKPORT: arm64: compat: Add KUSER_HELPERS config option UPSTREAM: arm64: compat: Refactor aarch32_alloc_vdso_pages() BACKPORT: arm64: compat: Split kuser32 UPSTREAM: arm64: compat: Alloc separate pages for vectors and sigpage ANDROID: GKI: Update ABI XML representation ANDROID: GKI: Enable GENERIC_IRQ_CHIP ANDROID: GKI: power_supply: Add FG_TYPE power-supply property ANDROID: GKI: mm: export mm_trace_rss_stat for modules to report RSS changes ANDROID: GKI: gki_defconfig: Enable CONFIG_LEDS_TRIGGER_TRANSIENT ANDROID: GKI: gki_defconfig: Enable CONFIG_CPU_FREQ_STAT ANDROID: GKI: arm64: gki_defconfig: Disable HW tracing features ANDROID: GKI: gki_defconfig: Enable CONFIG_I2C_CHARDEV ANDROID: Incremental fs: Use simple compression in log buffer ANDROID: GKI: usb: core: Add support to parse config summary capability descriptors ANDROID: GKI: Update ABI XML representation ANDROID: dm-bow: Fix not to skip trim at framented range ANDROID: Remove VLA from uid_sys_stats.c f2fs: fix missing check for f2fs_unlock_op ANDROID: fix wakeup reason findings UPSTREAM: cfg80211: fix and clean up cfg80211_gen_new_bssid() UPSTREAM: cfg80211: save multi-bssid properties UPSTREAM: cfg80211: make BSSID generation function inline UPSTREAM: cfg80211: parse multi-bssid only if HW supports it UPSTREAM: cfg80211: Move Multiple BSS info to struct cfg80211_bss to be visible UPSTREAM: cfg80211: Properly track transmitting and non-transmitting BSS UPSTREAM: cfg80211: use for_each_element() for multi-bssid parsing UPSTREAM: cfg80211: Parsing of Multiple BSSID information in scanning UPSTREAM: cfg80211/nl80211: Offload OWE processing to user space in AP mode ANDROID: GKI: cfg80211: Sync nl80211 commands/feature with upstream ANDROID: GKI: gki_defconfig: Enable FW_LOADER_USER_HELPER* ANDROID: GKI: arm64: gki_defconfig: Disable CONFIG_ARM64_TAGGED_ADDR_ABI ANDROID: GKI: gki_defconfig: CONFIG_CHR_DEV_SG=y ANDROID: GKI: gki_defconfig: CONFIG_DM_DEFAULT_KEY=m ANDROID: update the ABI xml representation ANDROID: init: GKI: enable hidden configs for GPU Linux 4.19.118 bpf: fix buggy r0 retval refinement for tracing helpers KEYS: Don't write out to userspace while holding key semaphore mtd: phram: fix a double free issue in error path mtd: lpddr: Fix a double free in probe() mtd: spinand: Explicitly use MTD_OPS_RAW to write the bad block marker to OOB locktorture: Print ratio of acquisitions, not failures tty: evh_bytechan: Fix out of bounds accesses iio: si1133: read 24-bit signed integer for measurement fbdev: potential information leak in do_fb_ioctl() net: dsa: bcm_sf2: Fix overflow checks f2fs: fix to wait all node page writeback iommu/amd: Fix the configuration of GCR3 table root pointer libnvdimm: Out of bounds read in __nd_ioctl() power: supply: axp288_fuel_gauge: Broaden vendor check for Intel Compute Sticks. ext2: fix debug reference to ext2_xattr_cache ext2: fix empty body warnings when -Wextra is used iommu/vt-d: Fix mm reference leak drm/vc4: Fix HDMI mode validation f2fs: fix NULL pointer dereference in f2fs_write_begin() NFS: Fix memory leaks in nfs_pageio_stop_mirroring() drm/amdkfd: kfree the wrong pointer x86: ACPI: fix CPU hotplug deadlock KVM: s390: vsie: Fix possible race when shadowing region 3 tables compiler.h: fix error in BUILD_BUG_ON() reporting percpu_counter: fix a data race at vm_committed_as include/linux/swapops.h: correct guards for non_swap_entry() cifs: Allocate encryption header through kmalloc um: ubd: Prevent buffer overrun on command completion ext4: do not commit super on read-only bdev s390/cpum_sf: Fix wrong page count in error message powerpc/maple: Fix declaration made after definition s390/cpuinfo: fix wrong output when CPU0 is offline NFS: direct.c: Fix memory leak of dreq when nfs_get_lock_context fails NFSv4/pnfs: Return valid stateids in nfs_layout_find_inode_by_stateid() rtc: 88pm860x: fix possible race condition soc: imx: gpc: fix power up sequencing clk: tegra: Fix Tegra PMC clock out parents power: supply: bq27xxx_battery: Silence deferred-probe error clk: at91: usb: continue if clk_hw_round_rate() return zero x86/Hyper-V: Report crash data in die() when panic_on_oops is set x86/Hyper-V: Report crash register data when sysctl_record_panic_msg is not set x86/Hyper-V: Trigger crash enlightenment only once during system crash. x86/Hyper-V: Free hv_panic_page when fail to register kmsg dump x86/Hyper-V: Unload vmbus channel in hv panic callback xsk: Add missing check on user supplied headroom size rbd: call rbd_dev_unprobe() after unwatching and flushing notifies rbd: avoid a deadlock on header_rwsem when flushing notifies video: fbdev: sis: Remove unnecessary parentheses and commented code lib/raid6: use vdupq_n_u8 to avoid endianness warnings x86/Hyper-V: Report crash register data or kmsg before running crash kernel of: overlay: kmemleak in dup_and_fixup_symbol_prop() of: unittest: kmemleak in of_unittest_overlay_high_level() of: unittest: kmemleak in of_unittest_platform_populate() of: unittest: kmemleak on changeset destroy ALSA: hda: Don't release card at firmware loading error irqchip/mbigen: Free msi_desc on device teardown netfilter: nf_tables: report EOPNOTSUPP on unsupported flags/object type ARM: dts: imx6: Use gpc for FEC interrupt controller to fix wake on LAN. arm, bpf: Fix bugs with ALU64 {RSH, ARSH} BPF_K shift by 0 watchdog: sp805: fix restart handler ext4: use non-movable memory for superblock readahead scsi: sg: add sg_remove_request in sg_common_write objtool: Fix switch table detection in .text.unlikely arm, bpf: Fix offset overflow for BPF_MEM BPF_DW ANDROID: GKI: Bulk update ABI report. ANDROID: GKI: qos: Register irq notify after adding the qos request ANDROID: GKI: Add dual role mode to usb_dr_modes array UPSTREAM: virtio-gpu api: comment feature flags ANDROID: arch:arm64: Increase kernel command line size ANDROID: GKI: Add special linux_banner_ptr for modules Revert "ANDROID: GKI: Make linux_banner a C pointer" ANDROID: GKI: PM / devfreq: Add new flag to do simple clock scaling ANDROID: GKI: Resolve ABI diff for struct snd_usb_audio ANDROID: GKI: Bulk update ABI ANDROID: GKI: Update the whitelist for qcom SoCs ANDROID: GKI: arm64: gki_defconfig: Set CONFIG_SCSI_UFSHCD=m ANDROID: GKI: scsi: add option to override the command timeout ANDROID: GKI: scsi: Adjust DBD setting in mode sense for caching mode page per LLD ANDROID: add ion_stat tracepoint to common kernel UPSTREAM: gpu/trace: add a gpu total memory usage tracepoint Linux 4.19.117 mm/vmalloc.c: move 'area->pages' after if statement wil6210: remove reset file from debugfs wil6210: make sure Rx ring sizes are correlated wil6210: add general initialization/size checks wil6210: ignore HALP ICR if already handled wil6210: check rx_buff_mgmt before accessing it x86/resctrl: Fix invalid attempt at removing the default resource group x86/resctrl: Preserve CDP enable over CPU hotplug x86/microcode/AMD: Increase microcode PATCH_MAX_SIZE scsi: target: fix hang when multiple threads try to destroy the same iscsi session scsi: target: remove boilerplate code kvm: x86: Host feature SSBD doesn't imply guest feature SPEC_CTRL_SSBD ext4: do not zeroout extents beyond i_disksize drm/amd/powerplay: force the trim of the mclk dpm_levels if OD is enabled usb: dwc3: gadget: Don't clear flags before transfer ended usb: dwc3: gadget: don't enable interrupt when disabling endpoint mac80211_hwsim: Use kstrndup() in place of kasprintf() btrfs: check commit root generation in should_ignore_root tracing: Fix the race between registering 'snapshot' event trigger and triggering 'snapshot' operation keys: Fix proc_keys_next to increase position index ALSA: usb-audio: Check mapping at creating connector controls, too ALSA: usb-audio: Don't create jack controls for PCM terminals ALSA: usb-audio: Don't override ignore_ctl_error value from the map ALSA: usb-audio: Filter error from connector kctl ops, too ASoC: Intel: mrfld: return error codes when an error occurs ASoC: Intel: mrfld: fix incorrect check on p->sink ext4: fix incorrect inodes per group in error message ext4: fix incorrect group count in ext4_fill_super error message pwm: pca9685: Fix PWM/GPIO inter-operation jbd2: improve comments about freeing data buffers whose page mapping is NULL scsi: ufs: Fix ufshcd_hold() caused scheduling while atomic ovl: fix value of i_ino for lower hardlink corner case net: dsa: mt7530: fix tagged frames pass-through in VLAN-unaware mode net: stmmac: dwmac-sunxi: Provide TX and RX fifo sizes net: revert default NAPI poll timeout to 2 jiffies net: qrtr: send msgs from local of same id as broadcast net: ipv6: do not consider routes via gateways for anycast address check net: ipv4: devinet: Fix crash when add/del multicast IP with autojoin hsr: check protocol version in hsr_newlink() amd-xgbe: Use __napi_schedule() in BH context ANDROID: GKI: drivers: of-thermal: Relate thermal zones using same sensor ANDROID: GKI: Bulk ABI update ANDROID: GKI: dma: Add set_dma_mask hook to struct dma_map_ops ANDROID: GKI: ABI update due to recent patches FROMLIST: drm/prime: add support for virtio exported objects FROMLIST: dma-buf: add support for virtio exported objects UPSTREAM: drm/virtio: module_param_named() requires linux/moduleparam.h UPSTREAM: drm/virtio: fix resource id creation race UPSTREAM: drm/virtio: make resource id workaround runtime switchable. BACKPORT: drm/virtio: Drop deprecated load/unload initialization ANDROID: GKI: Add DRM_TTM config to GKI ANDROID: Bulk update the ABI xml representation ANDROID: GKI: spmi: pmic-arb: don't enable SPMI_MSM_PMIC_ARB by default ANDROID: GKI: attribute page lock and waitqueue functions as sched ANDROID: GKI: extcon: Fix Add usage of blocking notifier chain ANDROID: GKI: USB: pd: Extcon fix for C current ANDROID: drm/dsi: Fix byte order of DCS set/get brightness ANDROID: GKI: mm: Export symbols to modularize CONFIG_MSM_DRM ANDROID: GKI: ALSA: compress: Add support to send codec specific data ANDROID: GKI: ALSA: Compress - dont use lock for all ioctls ANDROID: GKI: ASoC: msm: qdsp6v2: add support for AMR_WB_PLUS offload ANDROID: GKI: msm: dolby: MAT and THD audiocodec name modification ANDROID: GKI: asoc: msm: Add support for compressed perf mode ANDROID: GKI: msm: audio: support for gapless_pcm ANDROID: GKI: uapi: msm: dolby: Support for TrueHD and MAT decoders ANDROID: GKI: ASoC: msm: qdsp6v2: Add TrueHD HDMI compress pass-though ANDROID: GKI: ALSA: compress: Add APTX format support in ALSA ANDROID: GKI: msm: qdsp6v2: Add timestamp support for compress capture ANDROID: GKI: SoC: msm: Add support for meta data in compressed TX ANDROID: GKI: ALSA: compress: Add DSD format support for ALSA ANDROID: GKI: ASoC: msm: qdsp6v2: add support for ALAC and APE offload ANDROID: GKI: SoC: msm: Add compressed TX and passthrough support ANDROID: GKI: ASoC: msm: qdsp6v2: Add FLAC in compress offload path ANDROID: GKI: ASoC: msm: add support for different compressed formats ANDROID: GKI: ASoC: msm: Update the encode option and sample rate ANDROID: GKI: Enable CONFIG_SND_VERBOSE_PROCFS in gki_defconfig ANDROID: GKI: Add hidden CONFIG_SND_SOC_COMPRESS to gki_defconfig ANDROID: GKI: ALSA: pcm: add locks for accessing runtime resource ANDROID: GKI: Update ABI for DRM changes ANDROID: GKI: Add drm_dp_send_dpcd_{read,write} accessor functions ANDROID: GKI: drm: Add drm_dp_mst_get_max_sdp_streams_supported accessor function ANDROID: GKI: drm: Add drm_dp_mst_has_fec accessor function ANDROID: GKI: Add 'dsc_info' to struct drm_dp_mst_port ANDROID: GKI: usb: Add support to handle USB SMMU S1 address ANDROID: GKI: usb: Add helper APIs to return xhci phys addresses ANDROID: Add C protos for dma_buf/drm_prime get_uuid ANDROID: GKI: Make linux_banner a C pointer ANDROID: GKI: Add 'refresh_rate', 'id' to struct drm_panel_notifier ANDROID: GKI: Add 'i2c_mutex' to struct drm_dp_aux ANDROID: GKI: Add 'checksum' to struct drm_connector Revert "BACKPORT: drm: Add HDR source metadata property" Revert "BACKPORT: drm: Parse HDR metadata info from EDID" ANDROID: drm: Add DP colorspace property ANDROID: GKI: drm: Initialize display->hdmi when parsing vsdb ANDROID: drivers: gpu: drm: add support to batch commands ANDROID: ABI: update the qcom whitelist ANDROID: GKI: ARM64: smp: add vendor field pending_ipi ANDROID: gki_defconfig: enable msm serial early console ANDROID: serial: msm_geni_serial_console : Add Earlycon support ANDROID: GKI: serial: core: export uart_console_device f2fs: fix quota_sync failure due to f2fs_lock_op f2fs: support read iostat f2fs: Fix the accounting of dcc->undiscard_blks f2fs: fix to handle error path of f2fs_ra_meta_pages() f2fs: report the discard cmd errors properly f2fs: fix long latency due to discard during umount f2fs: add tracepoint for f2fs iostat f2fs: introduce sysfs/data_io_flag to attach REQ_META/FUA ANDROID: GKI: update abi definition due to previous changes in the tree Linux 4.19.116 efi/x86: Fix the deletion of variables in mixed mode mfd: dln2: Fix sanity checking for endpoints etnaviv: perfmon: fix total and idle HI cyleces readout misc: echo: Remove unnecessary parentheses and simplify check for zero powerpc/fsl_booke: Avoid creating duplicate tlb1 entry ftrace/kprobe: Show the maxactive number on kprobe_events drm: Remove PageReserved manipulation from drm_pci_alloc drm/dp_mst: Fix clearing payload state on topology disable Revert "drm/dp_mst: Remove VCPI while disabling topology mgr" crypto: ccree - only try to map auth tag if needed crypto: ccree - dec auth tag size from cryptlen map crypto: ccree - don't mangle the request assoclen crypto: ccree - zero out internal struct before use crypto: ccree - improve error handling crypto: caam - update xts sector size for large input length dm zoned: remove duplicate nr_rnd_zones increase in dmz_init_zone() btrfs: use nofs allocations for running delayed items powerpc: Make setjmp/longjmp signature standard powerpc: Add attributes for setjmp/longjmp scsi: mpt3sas: Fix kernel panic observed on soft HBA unplug powerpc/kprobes: Ignore traps that happened in real mode powerpc/xive: Use XIVE_BAD_IRQ instead of zero to catch non configured IPIs powerpc/hash64/devmap: Use H_PAGE_THP_HUGE when setting up huge devmap PTE entries powerpc/64/tm: Don't let userspace set regs->trap via sigreturn powerpc/powernv/idle: Restore AMR/UAMOR/AMOR after idle xen/blkfront: fix memory allocation flags in blkfront_setup_indirect() ipmi: fix hung processes in __get_guid() libata: Return correct status in sata_pmp_eh_recover_pm() when ATA_DFLAG_DETACH is set hfsplus: fix crash and filesystem corruption when deleting files cpufreq: powernv: Fix use-after-free kmod: make request_module() return an error when autoloading is disabled clk: ingenic/jz4770: Exit with error if CGU init failed Input: i8042 - add Acer Aspire 5738z to nomux list s390/diag: fix display of diagnose call statistics perf tools: Support Python 3.8+ in Makefile ocfs2: no need try to truncate file beyond i_size fs/filesystems.c: downgrade user-reachable WARN_ONCE() to pr_warn_once() ext4: fix a data race at inode->i_blocks NFS: Fix a page leak in nfs_destroy_unlinked_subrequests() powerpc/pseries: Avoid NULL pointer dereference when drmem is unavailable drm/etnaviv: rework perfmon query infrastructure rtc: omap: Use define directive for PIN_CONFIG_ACTIVE_HIGH selftests: vm: drop dependencies on page flags from mlock2 tests arm64: armv8_deprecated: Fix undef_hook mask for thumb setend scsi: zfcp: fix missing erp_lock in port recovery trigger for point-to-point dm verity fec: fix memory leak in verity_fec_dtr dm writecache: add cond_resched to avoid CPU hangs arm64: dts: allwinner: h6: Fix PMU compatible net: qualcomm: rmnet: Allow configuration updates to existing devices mm: Use fixed constant in page_frag_alloc instead of size + 1 tools: gpio: Fix out-of-tree build regression x86/speculation: Remove redundant arch_smt_update() invocation powerpc/pseries: Drop pointless static qualifier in vpa_debugfs_init() erofs: correct the remaining shrink objects crypto: mxs-dcp - fix scatterlist linearization for hash btrfs: fix missing semaphore unlock in btrfs_sync_file btrfs: fix missing file extent item for hole after ranged fsync btrfs: drop block from cache on error in relocation btrfs: set update the uuid generation as soon as possible Btrfs: fix crash during unmount due to race with delayed inode workers mtd: spinand: Do not erase the block before writing a bad block marker mtd: spinand: Stop using spinand->oobbuf for buffering bad block markers CIFS: Fix bug which the return value by asynchronous read is error KVM: VMX: fix crash cleanup when KVM wasn't used KVM: x86: Gracefully handle __vmalloc() failure during VM allocation KVM: VMX: Always VMCLEAR in-use VMCSes during crash with kexec support KVM: x86: Allocate new rmap and large page tracking when moving memslot KVM: s390: vsie: Fix delivery of addressing exceptions KVM: s390: vsie: Fix region 1 ASCE sanity shadow address checks KVM: nVMX: Properly handle userspace interrupt window request x86/entry/32: Add missing ASM_CLAC to general_protection entry signal: Extend exec_id to 64bits ath9k: Handle txpower changes even when TPC is disabled MIPS: OCTEON: irq: Fix potential NULL pointer dereference MIPS/tlbex: Fix LDDIR usage in setup_pw() for Loongson-3 pstore: pstore_ftrace_seq_next should increase position index irqchip/versatile-fpga: Apply clear-mask earlier KEYS: reaching the keys quotas correctly tpm: tpm2_bios_measurements_next should increase position index tpm: tpm1_bios_measurements_next should increase position index tpm: Don't make log failures fatal PCI: endpoint: Fix for concurrent memory allocation in OB address region PCI: Add boot interrupt quirk mechanism for Xeon chipsets PCI/ASPM: Clear the correct bits when enabling L1 substates PCI: pciehp: Fix indefinite wait on sysfs requests nvme: Treat discovery subsystems as unique subsystems nvme-fc: Revert "add module to ops template to allow module references" thermal: devfreq_cooling: inline all stubs for CONFIG_DEVFREQ_THERMAL=n acpi/x86: ignore unspecified bit positions in the ACPI global lock field media: ti-vpe: cal: fix disable_irqs to only the intended target ALSA: hda/realtek - Add quirk for MSI GL63 ALSA: hda/realtek - Remove now-unnecessary XPS 13 headphone noise fixups ALSA: hda/realtek - Set principled PC Beep configuration for ALC256 ALSA: doc: Document PC Beep Hidden Register on Realtek ALC256 ALSA: pcm: oss: Fix regression by buffer overflow fix ALSA: ice1724: Fix invalid access for enumerated ctl items ALSA: hda: Fix potential access overflow in beep helper ALSA: hda: Add driver blacklist ALSA: usb-audio: Add mixer workaround for TRX40 and co usb: gadget: composite: Inform controller driver of self-powered usb: gadget: f_fs: Fix use after free issue as part of queue failure ASoC: topology: use name_prefix for new kcontrol ASoC: dpcm: allow start or stop during pause for backend ASoC: dapm: connect virtual mux with default value ASoC: fix regwmask slub: improve bit diffusion for freelist ptr obfuscation uapi: rename ext2_swab() to swab() and share globally in swab.h IB/mlx5: Replace tunnel mpls capability bits for tunnel_offloads btrfs: track reloc roots based on their commit root bytenr btrfs: remove a BUG_ON() from merge_reloc_roots() btrfs: qgroup: ensure qgroup_rescan_running is only set when the worker is at least queued block, bfq: fix use-after-free in bfq_idle_slice_timer_body locking/lockdep: Avoid recursion in lockdep_count_{for,back}ward_deps() firmware: fix a double abort case with fw_load_sysfs_fallback md: check arrays is suspended in mddev_detach before call quiesce operations irqchip/gic-v4: Provide irq_retrigger to avoid circular locking dependency usb: dwc3: core: add support for disabling SS instances in park mode media: i2c: ov5695: Fix power on and off sequences block: Fix use-after-free issue accessing struct io_cq genirq/irqdomain: Check pointer in irq_domain_alloc_irqs_hierarchy() efi/x86: Ignore the memory attributes table on i386 x86/boot: Use unsigned comparison for addresses gfs2: Don't demote a glock until its revokes are written pstore/platform: fix potential mem leak if pstore_init_fs failed libata: Remove extra scsi_host_put() in ata_scsi_add_hosts() media: i2c: video-i2c: fix build errors due to 'imply hwmon' PCI/switchtec: Fix init_completion race condition with poll_wait() selftests/x86/ptrace_syscall_32: Fix no-vDSO segfault sched: Avoid scale real weight down to zero irqchip/versatile-fpga: Handle chained IRQs properly block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices x86: Don't let pgprot_modify() change the page encryption bit xhci: bail out early if driver can't accress host in resume null_blk: fix spurious IO errors after failed past-wp access null_blk: Handle null_add_dev() failures properly null_blk: Fix the null_add_dev() error path firmware: arm_sdei: fix double-lock on hibernate with shared events media: venus: hfi_parser: Ignore HEVC encoding for V1 cpufreq: imx6q: Fixes unwanted cpu overclocking on i.MX6ULL i2c: st: fix missing struct parameter description qlcnic: Fix bad kzalloc null test cxgb4/ptp: pass the sign of offset delta in FW CMD hinic: fix wrong para of wait_for_completion_timeout hinic: fix a bug of waitting for IO stopped net: vxge: fix wrong __VA_ARGS__ usage bus: sunxi-rsb: Return correct data when mixing 16-bit and 8-bit reads ARM: dts: sun8i-a83t-tbs-a711: HM5065 doesn't like such a high voltage ANDROID: build.config.allmodconfig: Re-enable XFS_FS FROMGIT: of: property: Add device link support for extcon ANDROID: GKI: arm64: gki_defconfig: enable CONFIG_MM_EVENT_STAT ANDROID: GKI: add fields from per-process mm event tracking feature ANDROID: GKI: fix ABI diffs caused by ION heap and pool vmstat additions UPSTREAM: GKI: panic/reboot: allow specifying reboot_mode for panic only ANDROID: GKI: of: property: Add device link support for phys property ANDROID: GKI: usb: phy: Fix ABI diff for usb_otg_state ANDROID: GKI: usb: phy: Fix ABI diff due to usb_phy.drive_dp_pulse ANDROID: GKI: usb: phy: Fix ABI diff for usb_phy_type and usb_phy.reset ANDROID: gki_defconfig: enable CONFIG_GPIO_SYSFS ANDROID: GKI: qcom: Fix compile issue when setting msm_lmh_dcvs as a module ANDROID: GKI: drivers: cpu_cooling: allow platform freq mitigation ANDROID: GKI: ASoC: Add locking in DAPM widget power update ANDROID: GKI: ASoC: jack: Fix buttons enum value ANDROID: GKI: ALSA: jack: Add support to report second microphone ANDROID: GKI: ALSA: jack: Update supported jack switch types ANDROID: GKI: ALSA: jack: update jack types ANDROID: GKI: Export symbols arm_cpuidle_suspend, cpuidle_dev and cpuidle_register_governor ANDROID: GKI: usb: hcd: Add USB atomic notifier callback for HC died error ANDROID: media: increase video max frame number BACKPORT: nvmem: core: add NVMEM_SYSFS Kconfig UPSTREAM: nvmem: add support for cell info UPSTREAM: nvmem: remove the global cell list UPSTREAM: nvmem: use kref UPSTREAM: nvmem: use list_for_each_entry_safe in nvmem_device_remove_all_cells() UPSTREAM: nvmem: provide nvmem_dev_name() ANDROID: GKI: Bulk ABI update ANDROID: GKI: cpuhotplug: adding hotplug enums for vendor code ANDROID: Incremental fs: Fix create_file performance ANDROID: build.config.common: Add BUILDTOOLS_PREBUILT_BIN UPSTREAM: kheaders: include only headers into kheaders_data.tar.xz UPSTREAM: kheaders: remove meaningless -R option of 'ls' ANDROID: GKI: of: platform: initialize of_reserved_mem ANDROID: driver: gpu: drm: add notifier for panel related events ANDROID: include: drm: support unicasting mipi cmds to dsi ctrls ANDROID: include: drm: increase DRM max property count to 64 BACKPORT: drm: Add HDMI colorspace property ANDROID: drm: edid: add support for additional CEA extension blocks BACKPORT: drm: Parse HDR metadata info from EDID BACKPORT: drm: Add HDR source metadata property BACKPORT: drm/dp_mst: Parse FEC capability on MST ports ANDROID: GKI: ABI update for DRM changes ANDROID: ABI: add missing elf variables to representation ANDROID: GKI: power_supply: Add PROP_MOISTURE_DETECTION_ENABLED ANDROID: include: drm: add the definitions for DP Link Compliance tests ANDROID: drivers: gpu: drm: fix bugs encountered while fuzzing FROMLIST: power_supply: Add additional health properties to the header UPSTREAM: power: supply: core: Update sysfs-class-power ABI document UPSTREAM: Merge remote-tracking branch 'aosp/upstream-f2fs-stable-linux-4.19.y' into android-4.19 (v5.7-rc1) ANDROID: drivers: gpu: drm: add support for secure framebuffer ANDROID: include: uapi: drm: add additional QCOM modifiers ANDROID: drm: dsi: add two DSI mode flags for BLLP ANDROID: include: uapi: drm: add additional drm mode flags UPSTREAM: drm: plug memory leak on drm_setup() failure UPSTREAM: drm: factor out drm_close_helper() function ANDROID: GKI: Bulk ABI update BACKPORT: nl80211: Add per peer statistics to compute FCS error rate ANDROID: GKI: sound: usb: Add snd_usb_enable_audio_stream/find_snd_usb_substream ANDROID: GKI: add dma-buf includes ANDROID: GKI: sched: struct fields for Per-Sched-domain over utilization ANDROID: GKI: Add vendor fields to root_domain ANDROID: gki_defconfig: Enable CONFIG_IRQ_TIME_ACCOUNTING ANDROID: fix allmodconfig build to use the right toolchain ANDROID: fix allmodconfig build to use the right toolchain ANDROID: GKI: Update ABI Revert "UPSTREAM: mm, page_alloc: spread allocations across zones before introducing fragmentation" Revert "UPSTREAM: mm: use alloc_flags to record if kswapd can wake" Revert "BACKPORT: mm: move zone watermark accesses behind an accessor" Revert "BACKPORT: mm: reclaim small amounts of memory when an external fragmentation event occurs" Revert "BACKPORT: mm, compaction: be selective about what pageblocks to clear skip hints" ANDROID: GKI: panic: add vendor callback function in panic() UPSTREAM: GKI: thermal: make device_register's type argument const ANDROID: GKI: add base.h include to match MODULE_VERSIONS ANDROID: update the ABI based on the new whitelist ANDROID: GKI: fdt: export symbols required by modules ANDROID: GKI: drivers: of: Add APIs to find DDR device rank, HBB ANDROID: GKI: security: Add mmap export symbols for modules ANDROID: GKI: arch: add stub symbols for boot_reason and cold_boot ANDROID: GKI: USB: Fix ABI diff for struct usb_bus ANDROID: GKI: USB: Resolve ABI diff for usb_gadget and usb_gadget_ops ANDROID: GKI: add hidden V4L2_MEM2MEM_DEV ANDROID: GKI: enable VIDEO_V4L2_SUBDEV_API ANDROID: GKI: export symbols from abi_gki_aarch64_qcom_whitelist ANDROID: Update the whitelist for qcom SoCs ANDROID: Incremental fs: Fix compound page usercopy crash ANDROID: Incremental fs: Clean up incfs_test build process ANDROID: Incremental fs: make remount log buffer change atomic ANDROID: Incremental fs: Optimize get_filled_block ANDROID: Incremental fs: Fix mislabeled __user ptrs ANDROID: Incremental fs: Use 64-bit int for file_size when writing hash blocks Linux 4.19.115 drm/msm: Use the correct dma_sync calls in msm_gem drm_dp_mst_topology: fix broken drm_dp_sideband_parse_remote_dpcd_read() usb: dwc3: don't set gadget->is_otg flag rpmsg: glink: Remove chunk size word align warning arm64: Fix size of __early_cpu_boot_status drm/msm: stop abusing dma_map/unmap for cache clk: qcom: rcg: Return failure for RCG update fbcon: fix null-ptr-deref in fbcon_switch RDMA/cm: Update num_paths in cma_resolve_iboe_route error flow Bluetooth: RFCOMM: fix ODEBUG bug in rfcomm_dev_ioctl RDMA/cma: Teach lockdep about the order of rtnl and lock RDMA/ucma: Put a lock around every call to the rdma_cm layer ceph: canonicalize server path in place ceph: remove the extra slashes in the server path IB/hfi1: Fix memory leaks in sysfs registration and unregistration IB/hfi1: Call kobject_put() when kobject_init_and_add() fails ASoC: jz4740-i2s: Fix divider written at incorrect offset in register hwrng: imx-rngc - fix an error path tools/accounting/getdelays.c: fix netlink attribute length usb: dwc3: gadget: Wrap around when skip TRBs random: always use batched entropy for get_random_u{32,64} mlxsw: spectrum_flower: Do not stop at FLOW_ACTION_VLAN_MANGLE slcan: Don't transmit uninitialized stack data in padding net: stmmac: dwmac1000: fix out-of-bounds mac address reg setting net: phy: micrel: kszphy_resume(): add delay after genphy_resume() before accessing PHY registers net: dsa: bcm_sf2: Ensure correct sub-node is parsed net: dsa: bcm_sf2: Do not register slave MDIO bus with OF ipv6: don't auto-add link-local address to lag ports mm: mempolicy: require at least one nodeid for MPOL_PREFERRED include/linux/notifier.h: SRCU: fix ctags bitops: protect variables in set_mask_bits() macro padata: always acquire cpu_hotplug_lock before pinst->lock net: Fix Tx hash bound checking rxrpc: Fix sendmsg(MSG_WAITALL) handling ALSA: hda/ca0132 - Add Recon3Di quirk to handle integrated sound on EVGA X99 Classified motherboard power: supply: axp288_charger: Add special handling for HP Pavilion x2 10 extcon: axp288: Add wakeup support mei: me: add cedar fork device ids coresight: do not use the BIT() macro in the UAPI header misc: pci_endpoint_test: Avoid using module parameter to determine irqtype misc: pci_endpoint_test: Fix to support > 10 pci-endpoint-test devices misc: rtsx: set correct pcr_ops for rts522A media: rc: IR signal for Panasonic air conditioner too long drm/etnaviv: replace MMU flush marker with flush sequence tools/power turbostat: Fix missing SYS_LPI counter on some Chromebooks tools/power turbostat: Fix gcc build warnings drm/amdgpu: fix typo for vcn1 idle check initramfs: restore default compression behavior drm/bochs: downgrade pci_request_region failure from error to warning drm/amd/display: Add link_rate quirk for Apple 15" MBP 2017 nvme-rdma: Avoid double freeing of async event data sctp: fix possibly using a bad saddr with a given dst sctp: fix refcount bug in sctp_wfree net, ip_tunnel: fix interface lookup with no key ipv4: fix a RCU-list lock in fib_triestat_seq_show ANDROID: GKI: export symbols required by SPECTRA_CAMERA ANDROID: GKI: ARM/ARM64: Introduce arch_read_hardware_id ANDROID: GKI: drivers: base: soc: export symbols for socinfo ANDROID: GKI: Update ABI ANDROID: GKI: ASoC: msm: fix integer overflow for long duration offload playback ANDROID: GKI: Bulk ABI update Revert "ANDROID: GKI: mm: add struct/enum fields for SPECULATIVE_PAGE_FAULTS" ANDROID: GKI: Revert "arm64: kill flush_cache_all()" ANDROID: GKI: Revert "arm64: Remove unused macros from assembler.h" ANDROID: GKI: kernel/dma, mm/cma: Export symbols needed by vendor modules ANDROID: GKI: mm: Export symbols __next_zones_zonelist and zone_watermark_ok_safe ANDROID: GKI: mm/memblock: export memblock_overlaps_memory ANDROID: GKI: net, skbuff: export symbols needed by vendor drivers ANDROID: GKI: Add stub __cpu_isolated_mask symbol ANDROID: GKI: sched: stub sched_isolate symbols ANDROID: GKI: export saved_command_line ANDROID: GKI: Update ABI ANDROID: GKI: ASoC: core: Update ALSA core to issue restart in underrun. ANDROID: GKI: SoC: pcm: Add a restart callback field to struct snd_pcm_ops ANDROID: GKI: SoC: pcm: Add fields to struct snd_pcm_ops and struct snd_soc_component_driver ANDROID: GKI: ASoC: core: Add compat_ioctl callback to struct snd_pcm_ops ANDROID: GKI: ALSA: core: modify, rename and export create_subdir API ANDROID: GKI: usb: Add helper API to issue stop endpoint command ANDROID: GKI: Thermal: thermal_zone_get_cdev_by_name added ANDROID: GKI: add missing exports for CONFIG_ARM_SMMU=m ANDROID: power: wakeup_reason: wake reason enhancements BACKPORT: FROMGIT: kbuild: mkcompile_h: Include $LD version in /proc/version ANDROID: GKI: kernel: Export symbols needed by msm_minidump.ko and minidump_log.ko ubifs: wire up FS_IOC_GET_ENCRYPTION_NONCE f2fs: wire up FS_IOC_GET_ENCRYPTION_NONCE ext4: wire up FS_IOC_GET_ENCRYPTION_NONCE fscrypt: add FS_IOC_GET_ENCRYPTION_NONCE ioctl ANDROID: Bulk update the ABI xml ANDROID: gki_defconfig: add CONFIG_IPV6_SUBTREES ANDROID: GKI: arm64: reserve space in cpu_hwcaps and cpu_hwcap_keys arrays ANDROID: GKI: of: reserved_mem: Fix kmemleak crash on no-map region ANDROID: GKI: sched: add task boost vendor fields to task_struct ANDROID: GKI: mm: add rss counter for unreclaimable pages ANDROID: GKI: irqdomain: add bus token DOMAIN_BUS_WAKEUP ANDROID: GKI: arm64: fault: do_tlb_conf_fault_cb register fault callback ANDROID: GKI: QoS: Enhance framework to support cpu/irq specific QoS requests ANDROID: GKI: Bulk ABI update ANDROID: GKI: PM/devfreq: Do not switch governors from sysfs when device is suspended ANDROID: GKI: PM / devfreq: Fix race condition between suspend/resume and governor_store ANDROID: GKI: PM / devfreq: Introduce a sysfs lock ANDROID: GKI: regmap: irq: Add support to clear ack registers ANDROID: GKI: Remove SCHED_AUTOGROUP ANDROID: ignore compiler tag __must_check for GENKSYMS ANDROID: GKI: Bulk update ABI ANDROID: GKI: Fix ABI diff for struct thermal_cooling_device_ops ANDROID: GKI: ASoC: soc-core: export function to find components ANDROID: GKI: thermal: thermal_sys: Add configurable thermal trip points. ANDROID: fscrypt: fall back to filesystem-layer crypto when needed ANDROID: block: require drivers to declare supported crypto key type(s) ANDROID: block: make blk_crypto_start_using_mode() properly check for support ANDROID: GKI: power: supply: format regression ANDROID: GKI: kobject: increase number of kobject uevent pointers to 64 ANDROID: GKI: drivers: video: backlight: Fix ABI diff for struct backlight_device ANDROID: GKI: usb: xhci: Add support for secondary interrupters ANDROID: GKI: usb: host: xhci: Add support for usb core indexing ANDROID: gki_defconfig: enable USB_XHCI_HCD ANDROID: gki_defconfig: enable CONFIG_BRIDGE ANDROID: GKI: Update ABI report ANDROID: GKI: arm64: smp: Add set_update_ipi_history_callback ANDROID: kbuild: ensure __cfi_check is correctly aligned f2fs: keep inline_data when compression conversion f2fs: fix to disable compression on directory f2fs: add missing CONFIG_F2FS_FS_COMPRESSION f2fs: switch discard_policy.timeout to bool type f2fs: fix to verify tpage before releasing in f2fs_free_dic() f2fs: show compression in statx f2fs: clean up dic->tpages assignment f2fs: compress: support zstd compress algorithm f2fs: compress: add .{init,destroy}_decompress_ctx callback f2fs: compress: fix to call missing destroy_compress_ctx() f2fs: change default compression algorithm f2fs: clean up {cic,dic}.ref handling f2fs: fix to use f2fs_readpage_limit() in f2fs_read_multi_pages() f2fs: xattr.h: Make stub helpers inline f2fs: fix to avoid double unlock f2fs: fix potential .flags overflow on 32bit architecture f2fs: fix NULL pointer dereference in f2fs_verity_work() f2fs: fix to clear PG_error if fsverity failed f2fs: don't call fscrypt_get_encryption_info() explicitly in f2fs_tmpfile() f2fs: don't trigger data flush in foreground operation f2fs: fix NULL pointer dereference in f2fs_write_begin() f2fs: clean up f2fs_may_encrypt() f2fs: fix to avoid potential deadlock f2fs: don't change inode status under page lock f2fs: fix potential deadlock on compressed quota file f2fs: delete DIO read lock f2fs: don't mark compressed inode dirty during f2fs_iget() f2fs: fix to account compressed blocks in f2fs_compressed_blocks() f2fs: xattr.h: Replace zero-length array with flexible-array member f2fs: fix to update f2fs_super_block fields under sb_lock f2fs: Add a new CP flag to help fsck fix resize SPO issues f2fs: Fix mount failure due to SPO after a successful online resize FS f2fs: use kmem_cache pool during inline xattr lookups f2fs: skip migration only when BG_GC is called f2fs: fix to show tracepoint correctly f2fs: avoid __GFP_NOFAIL in f2fs_bio_alloc f2fs: introduce F2FS_IOC_GET_COMPRESS_BLOCKS f2fs: fix to avoid triggering IO in write path f2fs: add prefix for f2fs slab cache name f2fs: introduce DEFAULT_IO_TIMEOUT f2fs: skip GC when section is full f2fs: add migration count iff migration happens f2fs: clean up bggc mount option f2fs: clean up lfs/adaptive mount option f2fs: fix to show norecovery mount option f2fs: clean up parameter of macro XATTR_SIZE() f2fs: clean up codes with {f2fs_,}data_blkaddr() f2fs: show mounted time f2fs: Use scnprintf() for avoiding potential buffer overflow f2fs: allow to clear F2FS_COMPR_FL flag f2fs: fix to check dirty pages during compressed inode conversion f2fs: fix to account compressed inode correctly f2fs: fix wrong check on F2FS_IOC_FSSETXATTR f2fs: fix to avoid use-after-free in f2fs_write_multi_pages() f2fs: fix to avoid using uninitialized variable f2fs: fix inconsistent comments f2fs: remove i_sem lock coverage in f2fs_setxattr() f2fs: cover last_disk_size update with spinlock f2fs: fix to check i_compr_blocks correctly FROMLIST: kmod: make request_module() return an error when autoloading is disabled ANDROID: GKI: Update ABI report ANDROID: GKI: ARM64: dma-mapping: export symbol arch_setup_dma_ops ANDROID: GKI: ARM: dma-mapping: export symbol arch_setup_dma_ops ANDROID: GKI: ASoC: dapm: Avoid static route b/w cpu and codec dai ANDROID: GKI: ASoC: pcm: Add support for hostless playback/capture ANDROID: GKI: ASoC: core - add hostless DAI support ANDROID: GKI: drivers: thermal: Resolve ABI diff for struct thermal_zone_device_ops ANDROID: GKI: drivers: thermal: Add support for getting trip temperature ANDROID: GKI: Add functions of_thermal_handle_trip/of_thermal_handle_trip_temp ANDROID: GKI: drivers: thermal: Add post suspend evaluate flag to thermal zone devicetree UPSTREAM: loop: Only freeze block queue when needed. UPSTREAM: loop: Only change blocksize when needed. ANDROID: Fix wq fp check for CFI builds ANDROID: GKI: update abi definition after CONFIG_DEBUG_LIST was enabled ANDROID: gki_defconfig: enable CONFIG_DEBUG_LIST ANDROID: GKI: Update ABI definition ANDROID: GKI: remove condition causing sk_buff struct ABI differences ANDROID: GKI: Export symbol arch_timer_mem_get_cval ANDROID: GKI: pwm: core: Add option to config PWM duty/period with u64 data length ANDROID: Update ABI whitelist for qcom SoCs ANDROID: Incremental fs: Fix remount ANDROID: Incremental fs: Protect get_fill_block, and add a field ANDROID: Incremental fs: Fix crash polling 0 size read_log ANDROID: Incremental fs: get_filled_blocks: better index_out ANDROID: GKI: of: property: Add device links support for "qcom,wrapper-dev" ANDROID: GKI: update abi definitions due to recent changes ANDROID: GKI: clk: Initialize in stack clk_init_data to 0 in all drivers ANDROID: GKI: drivers: clksource: Add API to return cval ANDROID: GKI: clk: Add support for voltage voting ANDROID: GKI: kernel: Export task and IRQ affinity symbols ANDROID: GKI: regulator: core: Add support for regulator providers with sync state ANDROID: GKI: regulator: Call proxy-consumer functions for each regulator registered ANDROID: GKI: regulator: Add proxy consumer driver ANDROID: GKI: regulator: core: allow long device tree supply regulator property names ANDROID: GKI: Revert "regulator: Enable supply regulator if child rail is enabled." ANDROID: GKI: regulator: Remove redundant set_mode call in drms_uA_update ANDROID: GKI: net: Add the get current NAPI context API ANDROID: GKI: remove DRM_KMS_CMA_HELPER from GKI configuration ANDROID: GKI: edac: Fix ABI diffs in edac_device_ctl_info struct ANDROID: GKI: pwm: Add different PWM output types support UPSTREAM: cfg80211: Authentication offload to user space in AP mode Linux 4.19.114 arm64: dts: ls1046ardb: set RGMII interfaces to RGMII_ID mode arm64: dts: ls1043a-rdb: correct RGMII delay mode to rgmii-id ARM: dts: N900: fix onenand timings ARM: dts: imx6: phycore-som: fix arm and soc minimum voltage ARM: bcm2835-rpi-zero-w: Add missing pinctrl name ARM: dts: oxnas: Fix clear-mask property perf map: Fix off by one in strncpy() size argument arm64: alternative: fix build with clang integrated assembler net: ks8851-ml: Fix IO operations, again gpiolib: acpi: Add quirk to ignore EC wakeups on HP x2 10 CHT + AXP288 model bpf: Explicitly memset some bpf info structures declared on the stack bpf: Explicitly memset the bpf_attr structure platform/x86: pmc_atom: Add Lex 2I385SW to critclk_systems DMI table vt: vt_ioctl: fix use-after-free in vt_in_use() vt: vt_ioctl: fix VT_DISALLOCATE freeing in-use virtual console vt: vt_ioctl: remove unnecessary console allocation checks vt: switch vt_dont_switch to bool vt: ioctl, switch VT_IS_IN_USE and VT_BUSY to inlines vt: selection, introduce vc_is_sel mac80211: fix authentication with iwlwifi/mvm mac80211: Check port authorization in the ieee80211_tx_dequeue() case media: xirlink_cit: add missing descriptor sanity checks media: stv06xx: add missing descriptor sanity checks media: dib0700: fix rc endpoint lookup media: ov519: add missing endpoint sanity checks libfs: fix infoleak in simple_attr_read() ahci: Add Intel Comet Lake H RAID PCI ID staging: wlan-ng: fix use-after-free Read in hfa384x_usbin_callback staging: wlan-ng: fix ODEBUG bug in prism2sta_disconnect_usb staging: rtl8188eu: Add ASUS USB-N10 Nano B1 to device table media: usbtv: fix control-message timeouts media: flexcop-usb: fix endpoint sanity check usb: musb: fix crash with highmen PIO and usbmon USB: serial: io_edgeport: fix slab-out-of-bounds read in edge_interrupt_callback USB: cdc-acm: restore capability check order USB: serial: option: add Wistron Neweb D19Q1 USB: serial: option: add BroadMobi BM806U USB: serial: option: add support for ASKEY WWHC050 mac80211: set IEEE80211_TX_CTRL_PORT_CTRL_PROTO for nl80211 TX mac80211: add option for setting control flags Revert "r8169: check that Realtek PHY driver module is loaded" vti6: Fix memory leak of skb if input policy check fails bpf/btf: Fix BTF verification of enum members in struct/union netfilter: nft_fwd_netdev: validate family and chain type netfilter: flowtable: reload ip{v6}h in nf_flow_tuple_ip{v6} afs: Fix some tracing details xfrm: policy: Fix doulbe free in xfrm_policy_timer xfrm: add the missing verify_sec_ctx_len check in xfrm_add_acquire xfrm: fix uctx len check in verify_sec_ctx_len RDMA/mlx5: Block delay drop to unprivileged users vti[6]: fix packet tx through bpf_redirect() in XinY cases xfrm: handle NETDEV_UNREGISTER for xfrm device genirq: Fix reference leaks on irq affinity notifiers RDMA/core: Ensure security pkey modify is not lost gpiolib: acpi: Add quirk to ignore EC wakeups on HP x2 10 BYT + AXP288 model gpiolib: acpi: Rework honor_wakeup option into an ignore_wake option gpiolib: acpi: Correct comment for HP x2 10 honor_wakeup quirk mac80211: mark station unauthorized before key removal nl80211: fix NL80211_ATTR_CHANNEL_WIDTH attribute type scsi: sd: Fix optimal I/O size for devices that change reported values scripts/dtc: Remove redundant YYLOC global declaration tools: Let O= makes handle a relative path with -C option perf probe: Do not depend on dwfl_module_addrsym() ARM: dts: omap5: Add bus_dma_limit for L3 bus ARM: dts: dra7: Add bus_dma_limit for L3 bus ceph: check POOL_FLAG_FULL/NEARFULL in addition to OSDMAP_FULL/NEARFULL Input: avoid BIT() macro usage in the serio.h UAPI header Input: synaptics - enable RMI on HP Envy 13-ad105ng Input: raydium_i2c_ts - fix error codes in raydium_i2c_boot_trigger() i2c: hix5hd2: add missed clk_disable_unprepare in remove ftrace/x86: Anotate text_mutex split between ftrace_arch_code_modify_post_process() and ftrace_arch_code_modify_prepare() sxgbe: Fix off by one in samsung driver strncpy size arg dpaa_eth: Remove unnecessary boolean expression in dpaa_get_headroom mac80211: Do not send mesh HWMP PREQ if HWMP is disabled scsi: ipr: Fix softlockup when rescanning devices in petitboot s390/qeth: handle error when backing RX buffer fsl/fman: detect FMan erratum A050385 arm64: dts: ls1043a: FMan erratum A050385 dt-bindings: net: FMan erratum A050385 cgroup1: don't call release_agent when it is "" drivers/of/of_mdio.c:fix of_mdiobus_register() cpupower: avoid multiple definition with gcc -fno-common nfs: add minor version to nfs_server_key for fscache cgroup-v1: cgroup_pidlist_next should update position index hsr: set .netnsok flag hsr: add restart routine into hsr_get_node_list() hsr: use rcu_read_lock() in hsr_get_node_{list/status}() vxlan: check return value of gro_cells_init() tcp: repair: fix TCP_QUEUE_SEQ implementation r8169: re-enable MSI on RTL8168c net: phy: mdio-mux-bcm-iproc: check clk_prepare_enable() return value net: dsa: mt7530: Change the LINK bit to reflect the link status net: ip_gre: Accept IFLA_INFO_DATA-less configuration net: ip_gre: Separate ERSPAN newlink / changelink callbacks bnxt_en: Reset rings if ring reservation fails during open() bnxt_en: fix memory leaks in bnxt_dcbnl_ieee_getets() slcan: not call free_netdev before rtnl_unlock in slcan_open NFC: fdp: Fix a signedness bug in fdp_nci_send_patch() net: stmmac: dwmac-rk: fix error path in rk_gmac_probe net_sched: keep alloc_hash updated after hash allocation net_sched: cls_route: remove the right filter from hashtable net: qmi_wwan: add support for ASKEY WWHC050 net/packet: tpacket_rcv: avoid a producer race condition net: mvneta: Fix the case where the last poll did not process all rx net: dsa: Fix duplicate frames flooded by learning net: cbs: Fix software cbs to consider packet sending time mlxsw: spectrum_mr: Fix list iteration in error path macsec: restrict to ethernet devices hsr: fix general protection fault in hsr_addr_is_self() geneve: move debug check after netdev unregister Revert "drm/dp_mst: Skip validating ports during destruction, just ref" mmc: sdhci-tegra: Fix busy detection by enabling MMC_CAP_NEED_RSP_BUSY mmc: sdhci-omap: Fix busy detection by enabling MMC_CAP_NEED_RSP_BUSY mmc: core: Respect MMC_CAP_NEED_RSP_BUSY for eMMC sleep command mmc: core: Respect MMC_CAP_NEED_RSP_BUSY for erase/trim/discard mmc: core: Allow host controllers to require R1B for CMD6 f2fs: fix to avoid potential deadlock f2fs: add missing function name in kernel message f2fs: recycle unused compress_data.chksum feild f2fs: fix to avoid NULL pointer dereference f2fs: fix leaking uninitialized memory in compressed clusters f2fs: fix the panic in do_checkpoint() f2fs: fix to wait all node page writeback mm/swapfile.c: move inode_lock out of claim_swapfile fscrypt: don't evict dirty inodes after removing key Conflicts: Documentation/arm64/silicon-errata.txt Documentation/devicetree/bindings Documentation/devicetree/bindings/net/fsl-fman.txt arch/arm/kernel/setup.c arch/arm/kernel/smp.c arch/arm/mm/dma-mapping.c arch/arm64/Kconfig arch/arm64/Makefile arch/arm64/include/asm/cpucaps.h arch/arm64/include/asm/cputype.h arch/arm64/include/asm/proc-fns.h arch/arm64/include/asm/traps.h arch/arm64/kernel/arm64ksyms.c arch/arm64/kernel/cpu_errata.c arch/arm64/kernel/setup.c arch/arm64/kernel/smp.c arch/arm64/mm/dma-mapping.c arch/arm64/mm/fault.c arch/arm64/mm/proc.S drivers/base/power/wakeup.c drivers/clk/clk.c drivers/clk/qcom/clk-rcg2.c drivers/clocksource/arm_arch_timer.c drivers/devfreq/devfreq.c drivers/devfreq/governor_simpleondemand.c drivers/dma-buf/dma-buf.c drivers/extcon/extcon.c drivers/gpu/Makefile drivers/gpu/drm/drm_connector.c drivers/gpu/drm/drm_dp_mst_topology.c drivers/gpu/drm/drm_edid.c drivers/gpu/drm/drm_file.c drivers/gpu/drm/drm_panel.c drivers/gpu/drm/drm_property.c drivers/iommu/Kconfig drivers/iommu/Makefile drivers/iommu/arm-smmu.c drivers/iommu/dma-iommu.c drivers/iommu/dma-mapping-fast.c drivers/iommu/io-pgtable-arm.c drivers/iommu/io-pgtable-fast.c drivers/iommu/io-pgtable.c drivers/iommu/iommu.c drivers/irqchip/irq-gic-v3.c drivers/media/v4l2-core/v4l2-ioctl.c drivers/mmc/core/Kconfig drivers/mmc/core/block.c drivers/mmc/core/queue.c drivers/mmc/host/cqhci.c drivers/mmc/host/sdhci-msm.c drivers/net/wireless/ath/wil6210/interrupt.c drivers/net/wireless/ath/wil6210/main.c drivers/net/wireless/ath/wil6210/wil6210.h drivers/net/wireless/ath/wil6210/wmi.c drivers/nvmem/core.c drivers/nvmem/nvmem-sysfs.c drivers/of/fdt.c drivers/power/supply/power_supply_sysfs.c drivers/pwm/sysfs.c drivers/regulator/core.c drivers/scsi/sd.c drivers/scsi/ufs/ufshcd.c drivers/tty/serial/Kconfig drivers/tty/serial/Makefile drivers/usb/common/common.c fs/crypto/crypto.c fs/f2fs/checkpoint.c fs/f2fs/f2fs.h include/drm/drm_connector.h include/drm/drm_dp_mst_helper.h include/drm/drm_panel.h include/linux/clk-provider.h include/linux/dma-buf.h include/linux/dma-mapping-fast.h include/linux/dma-mapping.h include/linux/extcon.h include/linux/io-pgtable.h include/linux/iommu.h include/linux/kobject.h include/linux/mm.h include/linux/mm_types.h include/linux/mmc/host.h include/linux/netdevice.h include/linux/power_supply.h include/linux/pwm.h include/linux/regulator/driver.h include/linux/thermal.h include/linux/vm_event_item.h include/net/cfg80211.h include/scsi/scsi_device.h include/sound/pcm.h include/sound/soc.h include/uapi/drm/drm_mode.h include/uapi/linux/coresight-stm.h include/uapi/linux/ip.h include/uapi/linux/nl80211.h include/uapi/linux/videodev2.h include/uapi/sound/compress_offload.h kernel/dma/coherent.c kernel/dma/mapping.c kernel/panic.c kernel/power/qos.c kernel/sched/sched.h mm/Kconfig mm/filemap.c mm/swapfile.c mm/vmalloc.c mm/vmstat.c net/qrtr/qrtr.c net/wireless/nl80211.c net/wireless/scan.c sound/core/compress_offload.c sound/soc/soc-core.c sound/usb/card.c sound/usb/pcm.c sound/usb/pcm.h sound/usb/usbaudio.h Fixed build errors: drivers/base/power/main.c drivers/thermal/thermal_core.c drivers/cpuidle/lpm-levels.c include/soc/qcom/lpm_levels.h Change-Id: Idf25b239f53681bdfa2ef371a91720fadf1a3f01 Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
3503 lines
85 KiB
C
3503 lines
85 KiB
C
/*
|
|
* linux/fs/namespace.c
|
|
*
|
|
* (C) Copyright Al Viro 2000, 2001
|
|
* Released under GPL v2.
|
|
*
|
|
* Based on code from fs/super.c, copyright Linus Torvalds and others.
|
|
* Heavily rewritten.
|
|
*/
|
|
|
|
#include <linux/syscalls.h>
|
|
#include <linux/export.h>
|
|
#include <linux/capability.h>
|
|
#include <linux/mnt_namespace.h>
|
|
#include <linux/user_namespace.h>
|
|
#include <linux/namei.h>
|
|
#include <linux/security.h>
|
|
#include <linux/cred.h>
|
|
#include <linux/idr.h>
|
|
#include <linux/init.h> /* init_rootfs */
|
|
#include <linux/fs_struct.h> /* get_fs_root et.al. */
|
|
#include <linux/fsnotify.h> /* fsnotify_vfsmount_delete */
|
|
#include <linux/uaccess.h>
|
|
#include <linux/proc_ns.h>
|
|
#include <linux/magic.h>
|
|
#include <linux/bootmem.h>
|
|
#include <linux/task_work.h>
|
|
#include <linux/sched/task.h>
|
|
|
|
#include "pnode.h"
|
|
#include "internal.h"
|
|
|
|
/* Maximum number of mounts in a mount namespace */
|
|
unsigned int sysctl_mount_max __read_mostly = 100000;
|
|
|
|
static unsigned int m_hash_mask __read_mostly;
|
|
static unsigned int m_hash_shift __read_mostly;
|
|
static unsigned int mp_hash_mask __read_mostly;
|
|
static unsigned int mp_hash_shift __read_mostly;
|
|
|
|
static __initdata unsigned long mhash_entries;
|
|
static int __init set_mhash_entries(char *str)
|
|
{
|
|
if (!str)
|
|
return 0;
|
|
mhash_entries = simple_strtoul(str, &str, 0);
|
|
return 1;
|
|
}
|
|
__setup("mhash_entries=", set_mhash_entries);
|
|
|
|
static __initdata unsigned long mphash_entries;
|
|
static int __init set_mphash_entries(char *str)
|
|
{
|
|
if (!str)
|
|
return 0;
|
|
mphash_entries = simple_strtoul(str, &str, 0);
|
|
return 1;
|
|
}
|
|
__setup("mphash_entries=", set_mphash_entries);
|
|
|
|
static u64 event;
|
|
static DEFINE_IDA(mnt_id_ida);
|
|
static DEFINE_IDA(mnt_group_ida);
|
|
|
|
static struct hlist_head *mount_hashtable __read_mostly;
|
|
static struct hlist_head *mountpoint_hashtable __read_mostly;
|
|
static struct kmem_cache *mnt_cache __read_mostly;
|
|
static DECLARE_RWSEM(namespace_sem);
|
|
|
|
/* /sys/fs */
|
|
struct kobject *fs_kobj;
|
|
EXPORT_SYMBOL_GPL(fs_kobj);
|
|
|
|
/*
|
|
* vfsmount lock may be taken for read to prevent changes to the
|
|
* vfsmount hash, ie. during mountpoint lookups or walking back
|
|
* up the tree.
|
|
*
|
|
* It should be taken for write in all cases where the vfsmount
|
|
* tree or hash is modified or when a vfsmount structure is modified.
|
|
*/
|
|
__cacheline_aligned_in_smp DEFINE_SEQLOCK(mount_lock);
|
|
|
|
static inline struct hlist_head *m_hash(struct vfsmount *mnt, struct dentry *dentry)
|
|
{
|
|
unsigned long tmp = ((unsigned long)mnt / L1_CACHE_BYTES);
|
|
tmp += ((unsigned long)dentry / L1_CACHE_BYTES);
|
|
tmp = tmp + (tmp >> m_hash_shift);
|
|
return &mount_hashtable[tmp & m_hash_mask];
|
|
}
|
|
|
|
static inline struct hlist_head *mp_hash(struct dentry *dentry)
|
|
{
|
|
unsigned long tmp = ((unsigned long)dentry / L1_CACHE_BYTES);
|
|
tmp = tmp + (tmp >> mp_hash_shift);
|
|
return &mountpoint_hashtable[tmp & mp_hash_mask];
|
|
}
|
|
|
|
static int mnt_alloc_id(struct mount *mnt)
|
|
{
|
|
int res = ida_alloc(&mnt_id_ida, GFP_KERNEL);
|
|
|
|
if (res < 0)
|
|
return res;
|
|
mnt->mnt_id = res;
|
|
return 0;
|
|
}
|
|
|
|
static void mnt_free_id(struct mount *mnt)
|
|
{
|
|
ida_free(&mnt_id_ida, mnt->mnt_id);
|
|
}
|
|
|
|
/*
|
|
* Allocate a new peer group ID
|
|
*/
|
|
static int mnt_alloc_group_id(struct mount *mnt)
|
|
{
|
|
int res = ida_alloc_min(&mnt_group_ida, 1, GFP_KERNEL);
|
|
|
|
if (res < 0)
|
|
return res;
|
|
mnt->mnt_group_id = res;
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* Release a peer group ID
|
|
*/
|
|
void mnt_release_group_id(struct mount *mnt)
|
|
{
|
|
ida_free(&mnt_group_ida, mnt->mnt_group_id);
|
|
mnt->mnt_group_id = 0;
|
|
}
|
|
|
|
/*
|
|
* vfsmount lock must be held for read
|
|
*/
|
|
static inline void mnt_add_count(struct mount *mnt, int n)
|
|
{
|
|
#ifdef CONFIG_SMP
|
|
this_cpu_add(mnt->mnt_pcp->mnt_count, n);
|
|
#else
|
|
preempt_disable();
|
|
mnt->mnt_count += n;
|
|
preempt_enable();
|
|
#endif
|
|
}
|
|
|
|
/*
|
|
* vfsmount lock must be held for write
|
|
*/
|
|
unsigned int mnt_get_count(struct mount *mnt)
|
|
{
|
|
#ifdef CONFIG_SMP
|
|
unsigned int count = 0;
|
|
int cpu;
|
|
|
|
for_each_possible_cpu(cpu) {
|
|
count += per_cpu_ptr(mnt->mnt_pcp, cpu)->mnt_count;
|
|
}
|
|
|
|
return count;
|
|
#else
|
|
return mnt->mnt_count;
|
|
#endif
|
|
}
|
|
|
|
static void drop_mountpoint(struct fs_pin *p)
|
|
{
|
|
struct mount *m = container_of(p, struct mount, mnt_umount);
|
|
dput(m->mnt_ex_mountpoint);
|
|
pin_remove(p);
|
|
mntput(&m->mnt);
|
|
}
|
|
|
|
static struct mount *alloc_vfsmnt(const char *name)
|
|
{
|
|
struct mount *mnt = kmem_cache_zalloc(mnt_cache, GFP_KERNEL);
|
|
if (mnt) {
|
|
int err;
|
|
|
|
err = mnt_alloc_id(mnt);
|
|
if (err)
|
|
goto out_free_cache;
|
|
|
|
if (name) {
|
|
mnt->mnt_devname = kstrdup_const(name, GFP_KERNEL);
|
|
if (!mnt->mnt_devname)
|
|
goto out_free_id;
|
|
}
|
|
|
|
#ifdef CONFIG_SMP
|
|
mnt->mnt_pcp = alloc_percpu(struct mnt_pcp);
|
|
if (!mnt->mnt_pcp)
|
|
goto out_free_devname;
|
|
|
|
this_cpu_add(mnt->mnt_pcp->mnt_count, 1);
|
|
#else
|
|
mnt->mnt_count = 1;
|
|
mnt->mnt_writers = 0;
|
|
#endif
|
|
mnt->mnt.data = NULL;
|
|
|
|
INIT_HLIST_NODE(&mnt->mnt_hash);
|
|
INIT_LIST_HEAD(&mnt->mnt_child);
|
|
INIT_LIST_HEAD(&mnt->mnt_mounts);
|
|
INIT_LIST_HEAD(&mnt->mnt_list);
|
|
INIT_LIST_HEAD(&mnt->mnt_expire);
|
|
INIT_LIST_HEAD(&mnt->mnt_share);
|
|
INIT_LIST_HEAD(&mnt->mnt_slave_list);
|
|
INIT_LIST_HEAD(&mnt->mnt_slave);
|
|
INIT_HLIST_NODE(&mnt->mnt_mp_list);
|
|
INIT_LIST_HEAD(&mnt->mnt_umounting);
|
|
init_fs_pin(&mnt->mnt_umount, drop_mountpoint);
|
|
}
|
|
return mnt;
|
|
|
|
#ifdef CONFIG_SMP
|
|
out_free_devname:
|
|
kfree_const(mnt->mnt_devname);
|
|
#endif
|
|
out_free_id:
|
|
mnt_free_id(mnt);
|
|
out_free_cache:
|
|
kmem_cache_free(mnt_cache, mnt);
|
|
return NULL;
|
|
}
|
|
|
|
/*
|
|
* Most r/o checks on a fs are for operations that take
|
|
* discrete amounts of time, like a write() or unlink().
|
|
* We must keep track of when those operations start
|
|
* (for permission checks) and when they end, so that
|
|
* we can determine when writes are able to occur to
|
|
* a filesystem.
|
|
*/
|
|
/*
|
|
* __mnt_is_readonly: check whether a mount is read-only
|
|
* @mnt: the mount to check for its write status
|
|
*
|
|
* This shouldn't be used directly ouside of the VFS.
|
|
* It does not guarantee that the filesystem will stay
|
|
* r/w, just that it is right *now*. This can not and
|
|
* should not be used in place of IS_RDONLY(inode).
|
|
* mnt_want/drop_write() will _keep_ the filesystem
|
|
* r/w.
|
|
*/
|
|
int __mnt_is_readonly(struct vfsmount *mnt)
|
|
{
|
|
if (mnt->mnt_flags & MNT_READONLY)
|
|
return 1;
|
|
if (sb_rdonly(mnt->mnt_sb))
|
|
return 1;
|
|
return 0;
|
|
}
|
|
EXPORT_SYMBOL_GPL(__mnt_is_readonly);
|
|
|
|
static inline void mnt_inc_writers(struct mount *mnt)
|
|
{
|
|
#ifdef CONFIG_SMP
|
|
this_cpu_inc(mnt->mnt_pcp->mnt_writers);
|
|
#else
|
|
mnt->mnt_writers++;
|
|
#endif
|
|
}
|
|
|
|
static inline void mnt_dec_writers(struct mount *mnt)
|
|
{
|
|
#ifdef CONFIG_SMP
|
|
this_cpu_dec(mnt->mnt_pcp->mnt_writers);
|
|
#else
|
|
mnt->mnt_writers--;
|
|
#endif
|
|
}
|
|
|
|
static unsigned int mnt_get_writers(struct mount *mnt)
|
|
{
|
|
#ifdef CONFIG_SMP
|
|
unsigned int count = 0;
|
|
int cpu;
|
|
|
|
for_each_possible_cpu(cpu) {
|
|
count += per_cpu_ptr(mnt->mnt_pcp, cpu)->mnt_writers;
|
|
}
|
|
|
|
return count;
|
|
#else
|
|
return mnt->mnt_writers;
|
|
#endif
|
|
}
|
|
|
|
static int mnt_is_readonly(struct vfsmount *mnt)
|
|
{
|
|
if (mnt->mnt_sb->s_readonly_remount)
|
|
return 1;
|
|
/* Order wrt setting s_flags/s_readonly_remount in do_remount() */
|
|
smp_rmb();
|
|
return __mnt_is_readonly(mnt);
|
|
}
|
|
|
|
/*
|
|
* Most r/o & frozen checks on a fs are for operations that take discrete
|
|
* amounts of time, like a write() or unlink(). We must keep track of when
|
|
* those operations start (for permission checks) and when they end, so that we
|
|
* can determine when writes are able to occur to a filesystem.
|
|
*/
|
|
/**
|
|
* __mnt_want_write - get write access to a mount without freeze protection
|
|
* @m: the mount on which to take a write
|
|
*
|
|
* This tells the low-level filesystem that a write is about to be performed to
|
|
* it, and makes sure that writes are allowed (mnt it read-write) before
|
|
* returning success. This operation does not protect against filesystem being
|
|
* frozen. When the write operation is finished, __mnt_drop_write() must be
|
|
* called. This is effectively a refcount.
|
|
*/
|
|
int __mnt_want_write(struct vfsmount *m)
|
|
{
|
|
struct mount *mnt = real_mount(m);
|
|
int ret = 0;
|
|
|
|
preempt_disable();
|
|
mnt_inc_writers(mnt);
|
|
/*
|
|
* The store to mnt_inc_writers must be visible before we pass
|
|
* MNT_WRITE_HOLD loop below, so that the slowpath can see our
|
|
* incremented count after it has set MNT_WRITE_HOLD.
|
|
*/
|
|
smp_mb();
|
|
while (READ_ONCE(mnt->mnt.mnt_flags) & MNT_WRITE_HOLD)
|
|
cpu_relax();
|
|
/*
|
|
* After the slowpath clears MNT_WRITE_HOLD, mnt_is_readonly will
|
|
* be set to match its requirements. So we must not load that until
|
|
* MNT_WRITE_HOLD is cleared.
|
|
*/
|
|
smp_rmb();
|
|
if (mnt_is_readonly(m)) {
|
|
mnt_dec_writers(mnt);
|
|
ret = -EROFS;
|
|
}
|
|
preempt_enable();
|
|
|
|
return ret;
|
|
}
|
|
|
|
/**
|
|
* mnt_want_write - get write access to a mount
|
|
* @m: the mount on which to take a write
|
|
*
|
|
* This tells the low-level filesystem that a write is about to be performed to
|
|
* it, and makes sure that writes are allowed (mount is read-write, filesystem
|
|
* is not frozen) before returning success. When the write operation is
|
|
* finished, mnt_drop_write() must be called. This is effectively a refcount.
|
|
*/
|
|
int mnt_want_write(struct vfsmount *m)
|
|
{
|
|
int ret;
|
|
|
|
sb_start_write(m->mnt_sb);
|
|
ret = __mnt_want_write(m);
|
|
if (ret)
|
|
sb_end_write(m->mnt_sb);
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL_GPL(mnt_want_write);
|
|
|
|
/**
|
|
* mnt_clone_write - get write access to a mount
|
|
* @mnt: the mount on which to take a write
|
|
*
|
|
* This is effectively like mnt_want_write, except
|
|
* it must only be used to take an extra write reference
|
|
* on a mountpoint that we already know has a write reference
|
|
* on it. This allows some optimisation.
|
|
*
|
|
* After finished, mnt_drop_write must be called as usual to
|
|
* drop the reference.
|
|
*/
|
|
int mnt_clone_write(struct vfsmount *mnt)
|
|
{
|
|
/* superblock may be r/o */
|
|
if (__mnt_is_readonly(mnt))
|
|
return -EROFS;
|
|
preempt_disable();
|
|
mnt_inc_writers(real_mount(mnt));
|
|
preempt_enable();
|
|
return 0;
|
|
}
|
|
EXPORT_SYMBOL_GPL(mnt_clone_write);
|
|
|
|
/**
|
|
* __mnt_want_write_file - get write access to a file's mount
|
|
* @file: the file who's mount on which to take a write
|
|
*
|
|
* This is like __mnt_want_write, but it takes a file and can
|
|
* do some optimisations if the file is open for write already
|
|
*/
|
|
int __mnt_want_write_file(struct file *file)
|
|
{
|
|
if (!(file->f_mode & FMODE_WRITER))
|
|
return __mnt_want_write(file->f_path.mnt);
|
|
else
|
|
return mnt_clone_write(file->f_path.mnt);
|
|
}
|
|
|
|
/**
|
|
* mnt_want_write_file - get write access to a file's mount
|
|
* @file: the file who's mount on which to take a write
|
|
*
|
|
* This is like mnt_want_write, but it takes a file and can
|
|
* do some optimisations if the file is open for write already
|
|
*/
|
|
int mnt_want_write_file(struct file *file)
|
|
{
|
|
int ret;
|
|
|
|
sb_start_write(file_inode(file)->i_sb);
|
|
ret = __mnt_want_write_file(file);
|
|
if (ret)
|
|
sb_end_write(file_inode(file)->i_sb);
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL_GPL(mnt_want_write_file);
|
|
|
|
/**
|
|
* __mnt_drop_write - give up write access to a mount
|
|
* @mnt: the mount on which to give up write access
|
|
*
|
|
* Tells the low-level filesystem that we are done
|
|
* performing writes to it. Must be matched with
|
|
* __mnt_want_write() call above.
|
|
*/
|
|
void __mnt_drop_write(struct vfsmount *mnt)
|
|
{
|
|
preempt_disable();
|
|
mnt_dec_writers(real_mount(mnt));
|
|
preempt_enable();
|
|
}
|
|
|
|
/**
|
|
* mnt_drop_write - give up write access to a mount
|
|
* @mnt: the mount on which to give up write access
|
|
*
|
|
* Tells the low-level filesystem that we are done performing writes to it and
|
|
* also allows filesystem to be frozen again. Must be matched with
|
|
* mnt_want_write() call above.
|
|
*/
|
|
void mnt_drop_write(struct vfsmount *mnt)
|
|
{
|
|
__mnt_drop_write(mnt);
|
|
sb_end_write(mnt->mnt_sb);
|
|
}
|
|
EXPORT_SYMBOL_GPL(mnt_drop_write);
|
|
|
|
void __mnt_drop_write_file(struct file *file)
|
|
{
|
|
__mnt_drop_write(file->f_path.mnt);
|
|
}
|
|
|
|
void mnt_drop_write_file(struct file *file)
|
|
{
|
|
__mnt_drop_write_file(file);
|
|
sb_end_write(file_inode(file)->i_sb);
|
|
}
|
|
EXPORT_SYMBOL(mnt_drop_write_file);
|
|
|
|
static int mnt_make_readonly(struct mount *mnt)
|
|
{
|
|
int ret = 0;
|
|
|
|
lock_mount_hash();
|
|
mnt->mnt.mnt_flags |= MNT_WRITE_HOLD;
|
|
/*
|
|
* After storing MNT_WRITE_HOLD, we'll read the counters. This store
|
|
* should be visible before we do.
|
|
*/
|
|
smp_mb();
|
|
|
|
/*
|
|
* With writers on hold, if this value is zero, then there are
|
|
* definitely no active writers (although held writers may subsequently
|
|
* increment the count, they'll have to wait, and decrement it after
|
|
* seeing MNT_READONLY).
|
|
*
|
|
* It is OK to have counter incremented on one CPU and decremented on
|
|
* another: the sum will add up correctly. The danger would be when we
|
|
* sum up each counter, if we read a counter before it is incremented,
|
|
* but then read another CPU's count which it has been subsequently
|
|
* decremented from -- we would see more decrements than we should.
|
|
* MNT_WRITE_HOLD protects against this scenario, because
|
|
* mnt_want_write first increments count, then smp_mb, then spins on
|
|
* MNT_WRITE_HOLD, so it can't be decremented by another CPU while
|
|
* we're counting up here.
|
|
*/
|
|
if (mnt_get_writers(mnt) > 0)
|
|
ret = -EBUSY;
|
|
else
|
|
mnt->mnt.mnt_flags |= MNT_READONLY;
|
|
/*
|
|
* MNT_READONLY must become visible before ~MNT_WRITE_HOLD, so writers
|
|
* that become unheld will see MNT_READONLY.
|
|
*/
|
|
smp_wmb();
|
|
mnt->mnt.mnt_flags &= ~MNT_WRITE_HOLD;
|
|
unlock_mount_hash();
|
|
return ret;
|
|
}
|
|
|
|
static void __mnt_unmake_readonly(struct mount *mnt)
|
|
{
|
|
lock_mount_hash();
|
|
mnt->mnt.mnt_flags &= ~MNT_READONLY;
|
|
unlock_mount_hash();
|
|
}
|
|
|
|
int sb_prepare_remount_readonly(struct super_block *sb)
|
|
{
|
|
struct mount *mnt;
|
|
int err = 0;
|
|
|
|
/* Racy optimization. Recheck the counter under MNT_WRITE_HOLD */
|
|
if (atomic_long_read(&sb->s_remove_count))
|
|
return -EBUSY;
|
|
|
|
lock_mount_hash();
|
|
list_for_each_entry(mnt, &sb->s_mounts, mnt_instance) {
|
|
if (!(mnt->mnt.mnt_flags & MNT_READONLY)) {
|
|
mnt->mnt.mnt_flags |= MNT_WRITE_HOLD;
|
|
smp_mb();
|
|
if (mnt_get_writers(mnt) > 0) {
|
|
err = -EBUSY;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (!err && atomic_long_read(&sb->s_remove_count))
|
|
err = -EBUSY;
|
|
|
|
if (!err) {
|
|
sb->s_readonly_remount = 1;
|
|
smp_wmb();
|
|
}
|
|
list_for_each_entry(mnt, &sb->s_mounts, mnt_instance) {
|
|
if (mnt->mnt.mnt_flags & MNT_WRITE_HOLD)
|
|
mnt->mnt.mnt_flags &= ~MNT_WRITE_HOLD;
|
|
}
|
|
unlock_mount_hash();
|
|
|
|
return err;
|
|
}
|
|
|
|
static void free_vfsmnt(struct mount *mnt)
|
|
{
|
|
kfree(mnt->mnt.data);
|
|
kfree_const(mnt->mnt_devname);
|
|
#ifdef CONFIG_SMP
|
|
free_percpu(mnt->mnt_pcp);
|
|
#endif
|
|
kmem_cache_free(mnt_cache, mnt);
|
|
}
|
|
|
|
static void delayed_free_vfsmnt(struct rcu_head *head)
|
|
{
|
|
free_vfsmnt(container_of(head, struct mount, mnt_rcu));
|
|
}
|
|
|
|
/* call under rcu_read_lock */
|
|
int __legitimize_mnt(struct vfsmount *bastard, unsigned seq)
|
|
{
|
|
struct mount *mnt;
|
|
if (read_seqretry(&mount_lock, seq))
|
|
return 1;
|
|
if (bastard == NULL)
|
|
return 0;
|
|
mnt = real_mount(bastard);
|
|
mnt_add_count(mnt, 1);
|
|
smp_mb(); // see mntput_no_expire()
|
|
if (likely(!read_seqretry(&mount_lock, seq)))
|
|
return 0;
|
|
if (bastard->mnt_flags & MNT_SYNC_UMOUNT) {
|
|
mnt_add_count(mnt, -1);
|
|
return 1;
|
|
}
|
|
lock_mount_hash();
|
|
if (unlikely(bastard->mnt_flags & MNT_DOOMED)) {
|
|
mnt_add_count(mnt, -1);
|
|
unlock_mount_hash();
|
|
return 1;
|
|
}
|
|
unlock_mount_hash();
|
|
/* caller will mntput() */
|
|
return -1;
|
|
}
|
|
|
|
/* call under rcu_read_lock */
|
|
bool legitimize_mnt(struct vfsmount *bastard, unsigned seq)
|
|
{
|
|
int res = __legitimize_mnt(bastard, seq);
|
|
if (likely(!res))
|
|
return true;
|
|
if (unlikely(res < 0)) {
|
|
rcu_read_unlock();
|
|
mntput(bastard);
|
|
rcu_read_lock();
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/*
|
|
* find the first mount at @dentry on vfsmount @mnt.
|
|
* call under rcu_read_lock()
|
|
*/
|
|
struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry)
|
|
{
|
|
struct hlist_head *head = m_hash(mnt, dentry);
|
|
struct mount *p;
|
|
|
|
hlist_for_each_entry_rcu(p, head, mnt_hash)
|
|
if (&p->mnt_parent->mnt == mnt && p->mnt_mountpoint == dentry)
|
|
return p;
|
|
return NULL;
|
|
}
|
|
|
|
/*
|
|
* lookup_mnt - Return the first child mount mounted at path
|
|
*
|
|
* "First" means first mounted chronologically. If you create the
|
|
* following mounts:
|
|
*
|
|
* mount /dev/sda1 /mnt
|
|
* mount /dev/sda2 /mnt
|
|
* mount /dev/sda3 /mnt
|
|
*
|
|
* Then lookup_mnt() on the base /mnt dentry in the root mount will
|
|
* return successively the root dentry and vfsmount of /dev/sda1, then
|
|
* /dev/sda2, then /dev/sda3, then NULL.
|
|
*
|
|
* lookup_mnt takes a reference to the found vfsmount.
|
|
*/
|
|
struct vfsmount *lookup_mnt(const struct path *path)
|
|
{
|
|
struct mount *child_mnt;
|
|
struct vfsmount *m;
|
|
unsigned seq;
|
|
|
|
rcu_read_lock();
|
|
do {
|
|
seq = read_seqbegin(&mount_lock);
|
|
child_mnt = __lookup_mnt(path->mnt, path->dentry);
|
|
m = child_mnt ? &child_mnt->mnt : NULL;
|
|
} while (!legitimize_mnt(m, seq));
|
|
rcu_read_unlock();
|
|
return m;
|
|
}
|
|
|
|
/*
|
|
* __is_local_mountpoint - Test to see if dentry is a mountpoint in the
|
|
* current mount namespace.
|
|
*
|
|
* The common case is dentries are not mountpoints at all and that
|
|
* test is handled inline. For the slow case when we are actually
|
|
* dealing with a mountpoint of some kind, walk through all of the
|
|
* mounts in the current mount namespace and test to see if the dentry
|
|
* is a mountpoint.
|
|
*
|
|
* The mount_hashtable is not usable in the context because we
|
|
* need to identify all mounts that may be in the current mount
|
|
* namespace not just a mount that happens to have some specified
|
|
* parent mount.
|
|
*/
|
|
bool __is_local_mountpoint(struct dentry *dentry)
|
|
{
|
|
struct mnt_namespace *ns = current->nsproxy->mnt_ns;
|
|
struct mount *mnt;
|
|
bool is_covered = false;
|
|
|
|
if (!d_mountpoint(dentry))
|
|
goto out;
|
|
|
|
down_read(&namespace_sem);
|
|
list_for_each_entry(mnt, &ns->list, mnt_list) {
|
|
is_covered = (mnt->mnt_mountpoint == dentry);
|
|
if (is_covered)
|
|
break;
|
|
}
|
|
up_read(&namespace_sem);
|
|
out:
|
|
return is_covered;
|
|
}
|
|
|
|
static struct mountpoint *lookup_mountpoint(struct dentry *dentry)
|
|
{
|
|
struct hlist_head *chain = mp_hash(dentry);
|
|
struct mountpoint *mp;
|
|
|
|
hlist_for_each_entry(mp, chain, m_hash) {
|
|
if (mp->m_dentry == dentry) {
|
|
mp->m_count++;
|
|
return mp;
|
|
}
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
static struct mountpoint *get_mountpoint(struct dentry *dentry)
|
|
{
|
|
struct mountpoint *mp, *new = NULL;
|
|
int ret;
|
|
|
|
if (d_mountpoint(dentry)) {
|
|
/* might be worth a WARN_ON() */
|
|
if (d_unlinked(dentry))
|
|
return ERR_PTR(-ENOENT);
|
|
mountpoint:
|
|
read_seqlock_excl(&mount_lock);
|
|
mp = lookup_mountpoint(dentry);
|
|
read_sequnlock_excl(&mount_lock);
|
|
if (mp)
|
|
goto done;
|
|
}
|
|
|
|
if (!new)
|
|
new = kmalloc(sizeof(struct mountpoint), GFP_KERNEL);
|
|
if (!new)
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
|
|
/* Exactly one processes may set d_mounted */
|
|
ret = d_set_mounted(dentry);
|
|
|
|
/* Someone else set d_mounted? */
|
|
if (ret == -EBUSY)
|
|
goto mountpoint;
|
|
|
|
/* The dentry is not available as a mountpoint? */
|
|
mp = ERR_PTR(ret);
|
|
if (ret)
|
|
goto done;
|
|
|
|
/* Add the new mountpoint to the hash table */
|
|
read_seqlock_excl(&mount_lock);
|
|
new->m_dentry = dentry;
|
|
new->m_count = 1;
|
|
hlist_add_head(&new->m_hash, mp_hash(dentry));
|
|
INIT_HLIST_HEAD(&new->m_list);
|
|
read_sequnlock_excl(&mount_lock);
|
|
|
|
mp = new;
|
|
new = NULL;
|
|
done:
|
|
kfree(new);
|
|
return mp;
|
|
}
|
|
|
|
static void put_mountpoint(struct mountpoint *mp)
|
|
{
|
|
if (!--mp->m_count) {
|
|
struct dentry *dentry = mp->m_dentry;
|
|
BUG_ON(!hlist_empty(&mp->m_list));
|
|
spin_lock(&dentry->d_lock);
|
|
dentry->d_flags &= ~DCACHE_MOUNTED;
|
|
spin_unlock(&dentry->d_lock);
|
|
hlist_del(&mp->m_hash);
|
|
kfree(mp);
|
|
}
|
|
}
|
|
|
|
static inline int check_mnt(struct mount *mnt)
|
|
{
|
|
return mnt->mnt_ns == current->nsproxy->mnt_ns;
|
|
}
|
|
|
|
/*
|
|
* vfsmount lock must be held for write
|
|
*/
|
|
static void touch_mnt_namespace(struct mnt_namespace *ns)
|
|
{
|
|
if (ns) {
|
|
ns->event = ++event;
|
|
wake_up_interruptible(&ns->poll);
|
|
}
|
|
}
|
|
|
|
/*
|
|
* vfsmount lock must be held for write
|
|
*/
|
|
static void __touch_mnt_namespace(struct mnt_namespace *ns)
|
|
{
|
|
if (ns && ns->event != event) {
|
|
ns->event = event;
|
|
wake_up_interruptible(&ns->poll);
|
|
}
|
|
}
|
|
|
|
/*
|
|
* vfsmount lock must be held for write
|
|
*/
|
|
static void unhash_mnt(struct mount *mnt)
|
|
{
|
|
mnt->mnt_parent = mnt;
|
|
mnt->mnt_mountpoint = mnt->mnt.mnt_root;
|
|
list_del_init(&mnt->mnt_child);
|
|
hlist_del_init_rcu(&mnt->mnt_hash);
|
|
hlist_del_init(&mnt->mnt_mp_list);
|
|
put_mountpoint(mnt->mnt_mp);
|
|
mnt->mnt_mp = NULL;
|
|
}
|
|
|
|
/*
|
|
* vfsmount lock must be held for write
|
|
*/
|
|
static void detach_mnt(struct mount *mnt, struct path *old_path)
|
|
{
|
|
old_path->dentry = mnt->mnt_mountpoint;
|
|
old_path->mnt = &mnt->mnt_parent->mnt;
|
|
unhash_mnt(mnt);
|
|
}
|
|
|
|
/*
|
|
* vfsmount lock must be held for write
|
|
*/
|
|
static void umount_mnt(struct mount *mnt)
|
|
{
|
|
/* old mountpoint will be dropped when we can do that */
|
|
mnt->mnt_ex_mountpoint = mnt->mnt_mountpoint;
|
|
unhash_mnt(mnt);
|
|
}
|
|
|
|
/*
|
|
* vfsmount lock must be held for write
|
|
*/
|
|
void mnt_set_mountpoint(struct mount *mnt,
|
|
struct mountpoint *mp,
|
|
struct mount *child_mnt)
|
|
{
|
|
mp->m_count++;
|
|
mnt_add_count(mnt, 1); /* essentially, that's mntget */
|
|
child_mnt->mnt_mountpoint = dget(mp->m_dentry);
|
|
child_mnt->mnt_parent = mnt;
|
|
child_mnt->mnt_mp = mp;
|
|
hlist_add_head(&child_mnt->mnt_mp_list, &mp->m_list);
|
|
}
|
|
|
|
static void __attach_mnt(struct mount *mnt, struct mount *parent)
|
|
{
|
|
hlist_add_head_rcu(&mnt->mnt_hash,
|
|
m_hash(&parent->mnt, mnt->mnt_mountpoint));
|
|
list_add_tail(&mnt->mnt_child, &parent->mnt_mounts);
|
|
}
|
|
|
|
/*
|
|
* vfsmount lock must be held for write
|
|
*/
|
|
static void attach_mnt(struct mount *mnt,
|
|
struct mount *parent,
|
|
struct mountpoint *mp)
|
|
{
|
|
mnt_set_mountpoint(parent, mp, mnt);
|
|
__attach_mnt(mnt, parent);
|
|
}
|
|
|
|
void mnt_change_mountpoint(struct mount *parent, struct mountpoint *mp, struct mount *mnt)
|
|
{
|
|
struct mountpoint *old_mp = mnt->mnt_mp;
|
|
struct dentry *old_mountpoint = mnt->mnt_mountpoint;
|
|
struct mount *old_parent = mnt->mnt_parent;
|
|
|
|
list_del_init(&mnt->mnt_child);
|
|
hlist_del_init(&mnt->mnt_mp_list);
|
|
hlist_del_init_rcu(&mnt->mnt_hash);
|
|
|
|
attach_mnt(mnt, parent, mp);
|
|
|
|
put_mountpoint(old_mp);
|
|
|
|
/*
|
|
* Safely avoid even the suggestion this code might sleep or
|
|
* lock the mount hash by taking advantage of the knowledge that
|
|
* mnt_change_mountpoint will not release the final reference
|
|
* to a mountpoint.
|
|
*
|
|
* During mounting, the mount passed in as the parent mount will
|
|
* continue to use the old mountpoint and during unmounting, the
|
|
* old mountpoint will continue to exist until namespace_unlock,
|
|
* which happens well after mnt_change_mountpoint.
|
|
*/
|
|
spin_lock(&old_mountpoint->d_lock);
|
|
old_mountpoint->d_lockref.count--;
|
|
spin_unlock(&old_mountpoint->d_lock);
|
|
|
|
mnt_add_count(old_parent, -1);
|
|
}
|
|
|
|
/*
|
|
* vfsmount lock must be held for write
|
|
*/
|
|
static void commit_tree(struct mount *mnt)
|
|
{
|
|
struct mount *parent = mnt->mnt_parent;
|
|
struct mount *m;
|
|
LIST_HEAD(head);
|
|
struct mnt_namespace *n = parent->mnt_ns;
|
|
|
|
BUG_ON(parent == mnt);
|
|
|
|
list_add_tail(&head, &mnt->mnt_list);
|
|
list_for_each_entry(m, &head, mnt_list)
|
|
m->mnt_ns = n;
|
|
|
|
list_splice(&head, n->list.prev);
|
|
|
|
n->mounts += n->pending_mounts;
|
|
n->pending_mounts = 0;
|
|
|
|
__attach_mnt(mnt, parent);
|
|
touch_mnt_namespace(n);
|
|
}
|
|
|
|
static struct mount *next_mnt(struct mount *p, struct mount *root)
|
|
{
|
|
struct list_head *next = p->mnt_mounts.next;
|
|
if (next == &p->mnt_mounts) {
|
|
while (1) {
|
|
if (p == root)
|
|
return NULL;
|
|
next = p->mnt_child.next;
|
|
if (next != &p->mnt_parent->mnt_mounts)
|
|
break;
|
|
p = p->mnt_parent;
|
|
}
|
|
}
|
|
return list_entry(next, struct mount, mnt_child);
|
|
}
|
|
|
|
static struct mount *skip_mnt_tree(struct mount *p)
|
|
{
|
|
struct list_head *prev = p->mnt_mounts.prev;
|
|
while (prev != &p->mnt_mounts) {
|
|
p = list_entry(prev, struct mount, mnt_child);
|
|
prev = p->mnt_mounts.prev;
|
|
}
|
|
return p;
|
|
}
|
|
|
|
struct vfsmount *
|
|
vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void *data)
|
|
{
|
|
struct mount *mnt;
|
|
struct dentry *root;
|
|
|
|
if (!type)
|
|
return ERR_PTR(-ENODEV);
|
|
|
|
mnt = alloc_vfsmnt(name);
|
|
if (!mnt)
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
if (type->alloc_mnt_data) {
|
|
mnt->mnt.data = type->alloc_mnt_data();
|
|
if (!mnt->mnt.data) {
|
|
mnt_free_id(mnt);
|
|
free_vfsmnt(mnt);
|
|
return ERR_PTR(-ENOMEM);
|
|
}
|
|
}
|
|
if (flags & SB_KERNMOUNT)
|
|
mnt->mnt.mnt_flags = MNT_INTERNAL;
|
|
|
|
root = mount_fs(type, flags, name, &mnt->mnt, data);
|
|
if (IS_ERR(root)) {
|
|
mnt_free_id(mnt);
|
|
free_vfsmnt(mnt);
|
|
return ERR_CAST(root);
|
|
}
|
|
|
|
mnt->mnt.mnt_root = root;
|
|
mnt->mnt.mnt_sb = root->d_sb;
|
|
mnt->mnt_mountpoint = mnt->mnt.mnt_root;
|
|
mnt->mnt_parent = mnt;
|
|
lock_mount_hash();
|
|
list_add_tail(&mnt->mnt_instance, &root->d_sb->s_mounts);
|
|
unlock_mount_hash();
|
|
return &mnt->mnt;
|
|
}
|
|
EXPORT_SYMBOL_GPL(vfs_kern_mount);
|
|
|
|
struct vfsmount *
|
|
vfs_submount(const struct dentry *mountpoint, struct file_system_type *type,
|
|
const char *name, void *data)
|
|
{
|
|
/* Until it is worked out how to pass the user namespace
|
|
* through from the parent mount to the submount don't support
|
|
* unprivileged mounts with submounts.
|
|
*/
|
|
if (mountpoint->d_sb->s_user_ns != &init_user_ns)
|
|
return ERR_PTR(-EPERM);
|
|
|
|
return vfs_kern_mount(type, SB_SUBMOUNT, name, data);
|
|
}
|
|
EXPORT_SYMBOL_GPL(vfs_submount);
|
|
|
|
static struct mount *clone_mnt(struct mount *old, struct dentry *root,
|
|
int flag)
|
|
{
|
|
struct super_block *sb = old->mnt.mnt_sb;
|
|
struct mount *mnt;
|
|
int err;
|
|
|
|
mnt = alloc_vfsmnt(old->mnt_devname);
|
|
if (!mnt)
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
if (sb->s_op->clone_mnt_data) {
|
|
mnt->mnt.data = sb->s_op->clone_mnt_data(old->mnt.data);
|
|
if (!mnt->mnt.data) {
|
|
err = -ENOMEM;
|
|
goto out_free;
|
|
}
|
|
}
|
|
|
|
if (flag & (CL_SLAVE | CL_PRIVATE | CL_SHARED_TO_SLAVE))
|
|
mnt->mnt_group_id = 0; /* not a peer of original */
|
|
else
|
|
mnt->mnt_group_id = old->mnt_group_id;
|
|
|
|
if ((flag & CL_MAKE_SHARED) && !mnt->mnt_group_id) {
|
|
err = mnt_alloc_group_id(mnt);
|
|
if (err)
|
|
goto out_free;
|
|
}
|
|
|
|
mnt->mnt.mnt_flags = old->mnt.mnt_flags;
|
|
mnt->mnt.mnt_flags &= ~(MNT_WRITE_HOLD|MNT_MARKED|MNT_INTERNAL);
|
|
/* Don't allow unprivileged users to change mount flags */
|
|
if (flag & CL_UNPRIVILEGED) {
|
|
mnt->mnt.mnt_flags |= MNT_LOCK_ATIME;
|
|
|
|
if (mnt->mnt.mnt_flags & MNT_READONLY)
|
|
mnt->mnt.mnt_flags |= MNT_LOCK_READONLY;
|
|
|
|
if (mnt->mnt.mnt_flags & MNT_NODEV)
|
|
mnt->mnt.mnt_flags |= MNT_LOCK_NODEV;
|
|
|
|
if (mnt->mnt.mnt_flags & MNT_NOSUID)
|
|
mnt->mnt.mnt_flags |= MNT_LOCK_NOSUID;
|
|
|
|
if (mnt->mnt.mnt_flags & MNT_NOEXEC)
|
|
mnt->mnt.mnt_flags |= MNT_LOCK_NOEXEC;
|
|
}
|
|
|
|
/* Don't allow unprivileged users to reveal what is under a mount */
|
|
if ((flag & CL_UNPRIVILEGED) &&
|
|
(!(flag & CL_EXPIRE) || list_empty(&old->mnt_expire)))
|
|
mnt->mnt.mnt_flags |= MNT_LOCKED;
|
|
|
|
atomic_inc(&sb->s_active);
|
|
mnt->mnt.mnt_sb = sb;
|
|
mnt->mnt.mnt_root = dget(root);
|
|
mnt->mnt_mountpoint = mnt->mnt.mnt_root;
|
|
mnt->mnt_parent = mnt;
|
|
lock_mount_hash();
|
|
list_add_tail(&mnt->mnt_instance, &sb->s_mounts);
|
|
unlock_mount_hash();
|
|
|
|
if ((flag & CL_SLAVE) ||
|
|
((flag & CL_SHARED_TO_SLAVE) && IS_MNT_SHARED(old))) {
|
|
list_add(&mnt->mnt_slave, &old->mnt_slave_list);
|
|
mnt->mnt_master = old;
|
|
CLEAR_MNT_SHARED(mnt);
|
|
} else if (!(flag & CL_PRIVATE)) {
|
|
if ((flag & CL_MAKE_SHARED) || IS_MNT_SHARED(old))
|
|
list_add(&mnt->mnt_share, &old->mnt_share);
|
|
if (IS_MNT_SLAVE(old))
|
|
list_add(&mnt->mnt_slave, &old->mnt_slave);
|
|
mnt->mnt_master = old->mnt_master;
|
|
} else {
|
|
CLEAR_MNT_SHARED(mnt);
|
|
}
|
|
if (flag & CL_MAKE_SHARED)
|
|
set_mnt_shared(mnt);
|
|
|
|
/* stick the duplicate mount on the same expiry list
|
|
* as the original if that was on one */
|
|
if (flag & CL_EXPIRE) {
|
|
if (!list_empty(&old->mnt_expire))
|
|
list_add(&mnt->mnt_expire, &old->mnt_expire);
|
|
}
|
|
|
|
return mnt;
|
|
|
|
out_free:
|
|
mnt_free_id(mnt);
|
|
free_vfsmnt(mnt);
|
|
return ERR_PTR(err);
|
|
}
|
|
|
|
static void cleanup_mnt(struct mount *mnt)
|
|
{
|
|
/*
|
|
* This probably indicates that somebody messed
|
|
* up a mnt_want/drop_write() pair. If this
|
|
* happens, the filesystem was probably unable
|
|
* to make r/w->r/o transitions.
|
|
*/
|
|
/*
|
|
* The locking used to deal with mnt_count decrement provides barriers,
|
|
* so mnt_get_writers() below is safe.
|
|
*/
|
|
WARN_ON(mnt_get_writers(mnt));
|
|
if (unlikely(mnt->mnt_pins.first))
|
|
mnt_pin_kill(mnt);
|
|
fsnotify_vfsmount_delete(&mnt->mnt);
|
|
dput(mnt->mnt.mnt_root);
|
|
deactivate_super(mnt->mnt.mnt_sb);
|
|
mnt_free_id(mnt);
|
|
call_rcu(&mnt->mnt_rcu, delayed_free_vfsmnt);
|
|
}
|
|
|
|
static void __cleanup_mnt(struct rcu_head *head)
|
|
{
|
|
cleanup_mnt(container_of(head, struct mount, mnt_rcu));
|
|
}
|
|
|
|
static LLIST_HEAD(delayed_mntput_list);
|
|
static void delayed_mntput(struct work_struct *unused)
|
|
{
|
|
struct llist_node *node = llist_del_all(&delayed_mntput_list);
|
|
struct mount *m, *t;
|
|
|
|
llist_for_each_entry_safe(m, t, node, mnt_llist)
|
|
cleanup_mnt(m);
|
|
}
|
|
static DECLARE_DELAYED_WORK(delayed_mntput_work, delayed_mntput);
|
|
|
|
static void mntput_no_expire(struct mount *mnt)
|
|
{
|
|
rcu_read_lock();
|
|
if (likely(READ_ONCE(mnt->mnt_ns))) {
|
|
/*
|
|
* Since we don't do lock_mount_hash() here,
|
|
* ->mnt_ns can change under us. However, if it's
|
|
* non-NULL, then there's a reference that won't
|
|
* be dropped until after an RCU delay done after
|
|
* turning ->mnt_ns NULL. So if we observe it
|
|
* non-NULL under rcu_read_lock(), the reference
|
|
* we are dropping is not the final one.
|
|
*/
|
|
mnt_add_count(mnt, -1);
|
|
rcu_read_unlock();
|
|
return;
|
|
}
|
|
lock_mount_hash();
|
|
/*
|
|
* make sure that if __legitimize_mnt() has not seen us grab
|
|
* mount_lock, we'll see their refcount increment here.
|
|
*/
|
|
smp_mb();
|
|
mnt_add_count(mnt, -1);
|
|
if (mnt_get_count(mnt)) {
|
|
rcu_read_unlock();
|
|
unlock_mount_hash();
|
|
return;
|
|
}
|
|
if (unlikely(mnt->mnt.mnt_flags & MNT_DOOMED)) {
|
|
rcu_read_unlock();
|
|
unlock_mount_hash();
|
|
return;
|
|
}
|
|
mnt->mnt.mnt_flags |= MNT_DOOMED;
|
|
rcu_read_unlock();
|
|
|
|
list_del(&mnt->mnt_instance);
|
|
|
|
if (unlikely(!list_empty(&mnt->mnt_mounts))) {
|
|
struct mount *p, *tmp;
|
|
list_for_each_entry_safe(p, tmp, &mnt->mnt_mounts, mnt_child) {
|
|
umount_mnt(p);
|
|
}
|
|
}
|
|
unlock_mount_hash();
|
|
|
|
if (likely(!(mnt->mnt.mnt_flags & MNT_INTERNAL))) {
|
|
struct task_struct *task = current;
|
|
if (likely(!(task->flags & PF_KTHREAD))) {
|
|
init_task_work(&mnt->mnt_rcu, __cleanup_mnt);
|
|
if (!task_work_add(task, &mnt->mnt_rcu, true))
|
|
return;
|
|
}
|
|
if (llist_add(&mnt->mnt_llist, &delayed_mntput_list))
|
|
schedule_delayed_work(&delayed_mntput_work, 1);
|
|
return;
|
|
}
|
|
cleanup_mnt(mnt);
|
|
}
|
|
|
|
void mntput(struct vfsmount *mnt)
|
|
{
|
|
if (mnt) {
|
|
struct mount *m = real_mount(mnt);
|
|
/* avoid cacheline pingpong, hope gcc doesn't get "smart" */
|
|
if (unlikely(m->mnt_expiry_mark))
|
|
m->mnt_expiry_mark = 0;
|
|
mntput_no_expire(m);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(mntput);
|
|
|
|
struct vfsmount *mntget(struct vfsmount *mnt)
|
|
{
|
|
if (mnt)
|
|
mnt_add_count(real_mount(mnt), 1);
|
|
return mnt;
|
|
}
|
|
EXPORT_SYMBOL(mntget);
|
|
|
|
/* path_is_mountpoint() - Check if path is a mount in the current
|
|
* namespace.
|
|
*
|
|
* d_mountpoint() can only be used reliably to establish if a dentry is
|
|
* not mounted in any namespace and that common case is handled inline.
|
|
* d_mountpoint() isn't aware of the possibility there may be multiple
|
|
* mounts using a given dentry in a different namespace. This function
|
|
* checks if the passed in path is a mountpoint rather than the dentry
|
|
* alone.
|
|
*/
|
|
bool path_is_mountpoint(const struct path *path)
|
|
{
|
|
unsigned seq;
|
|
bool res;
|
|
|
|
if (!d_mountpoint(path->dentry))
|
|
return false;
|
|
|
|
rcu_read_lock();
|
|
do {
|
|
seq = read_seqbegin(&mount_lock);
|
|
res = __path_is_mountpoint(path);
|
|
} while (read_seqretry(&mount_lock, seq));
|
|
rcu_read_unlock();
|
|
|
|
return res;
|
|
}
|
|
EXPORT_SYMBOL(path_is_mountpoint);
|
|
|
|
struct vfsmount *mnt_clone_internal(const struct path *path)
|
|
{
|
|
struct mount *p;
|
|
p = clone_mnt(real_mount(path->mnt), path->dentry, CL_PRIVATE);
|
|
if (IS_ERR(p))
|
|
return ERR_CAST(p);
|
|
p->mnt.mnt_flags |= MNT_INTERNAL;
|
|
return &p->mnt;
|
|
}
|
|
|
|
#ifdef CONFIG_PROC_FS
|
|
/* iterator; we want it to have access to namespace_sem, thus here... */
|
|
static void *m_start(struct seq_file *m, loff_t *pos)
|
|
{
|
|
struct proc_mounts *p = m->private;
|
|
|
|
down_read(&namespace_sem);
|
|
if (p->cached_event == p->ns->event) {
|
|
void *v = p->cached_mount;
|
|
if (*pos == p->cached_index)
|
|
return v;
|
|
if (*pos == p->cached_index + 1) {
|
|
v = seq_list_next(v, &p->ns->list, &p->cached_index);
|
|
return p->cached_mount = v;
|
|
}
|
|
}
|
|
|
|
p->cached_event = p->ns->event;
|
|
p->cached_mount = seq_list_start(&p->ns->list, *pos);
|
|
p->cached_index = *pos;
|
|
return p->cached_mount;
|
|
}
|
|
|
|
static void *m_next(struct seq_file *m, void *v, loff_t *pos)
|
|
{
|
|
struct proc_mounts *p = m->private;
|
|
|
|
p->cached_mount = seq_list_next(v, &p->ns->list, pos);
|
|
p->cached_index = *pos;
|
|
return p->cached_mount;
|
|
}
|
|
|
|
static void m_stop(struct seq_file *m, void *v)
|
|
{
|
|
up_read(&namespace_sem);
|
|
}
|
|
|
|
static int m_show(struct seq_file *m, void *v)
|
|
{
|
|
struct proc_mounts *p = m->private;
|
|
struct mount *r = list_entry(v, struct mount, mnt_list);
|
|
return p->show(m, &r->mnt);
|
|
}
|
|
|
|
const struct seq_operations mounts_op = {
|
|
.start = m_start,
|
|
.next = m_next,
|
|
.stop = m_stop,
|
|
.show = m_show,
|
|
};
|
|
#endif /* CONFIG_PROC_FS */
|
|
|
|
/**
|
|
* may_umount_tree - check if a mount tree is busy
|
|
* @mnt: root of mount tree
|
|
*
|
|
* This is called to check if a tree of mounts has any
|
|
* open files, pwds, chroots or sub mounts that are
|
|
* busy.
|
|
*/
|
|
int may_umount_tree(struct vfsmount *m)
|
|
{
|
|
struct mount *mnt = real_mount(m);
|
|
int actual_refs = 0;
|
|
int minimum_refs = 0;
|
|
struct mount *p;
|
|
BUG_ON(!m);
|
|
|
|
/* write lock needed for mnt_get_count */
|
|
lock_mount_hash();
|
|
for (p = mnt; p; p = next_mnt(p, mnt)) {
|
|
actual_refs += mnt_get_count(p);
|
|
minimum_refs += 2;
|
|
}
|
|
unlock_mount_hash();
|
|
|
|
if (actual_refs > minimum_refs)
|
|
return 0;
|
|
|
|
return 1;
|
|
}
|
|
|
|
EXPORT_SYMBOL(may_umount_tree);
|
|
|
|
/**
|
|
* may_umount - check if a mount point is busy
|
|
* @mnt: root of mount
|
|
*
|
|
* This is called to check if a mount point has any
|
|
* open files, pwds, chroots or sub mounts. If the
|
|
* mount has sub mounts this will return busy
|
|
* regardless of whether the sub mounts are busy.
|
|
*
|
|
* Doesn't take quota and stuff into account. IOW, in some cases it will
|
|
* give false negatives. The main reason why it's here is that we need
|
|
* a non-destructive way to look for easily umountable filesystems.
|
|
*/
|
|
int may_umount(struct vfsmount *mnt)
|
|
{
|
|
int ret = 1;
|
|
down_read(&namespace_sem);
|
|
lock_mount_hash();
|
|
if (propagate_mount_busy(real_mount(mnt), 2))
|
|
ret = 0;
|
|
unlock_mount_hash();
|
|
up_read(&namespace_sem);
|
|
return ret;
|
|
}
|
|
|
|
EXPORT_SYMBOL(may_umount);
|
|
|
|
static HLIST_HEAD(unmounted); /* protected by namespace_sem */
|
|
|
|
static void namespace_unlock(void)
|
|
{
|
|
struct hlist_head head;
|
|
|
|
hlist_move_list(&unmounted, &head);
|
|
|
|
up_write(&namespace_sem);
|
|
|
|
if (likely(hlist_empty(&head)))
|
|
return;
|
|
|
|
synchronize_rcu();
|
|
|
|
group_pin_kill(&head);
|
|
}
|
|
|
|
static inline void namespace_lock(void)
|
|
{
|
|
down_write(&namespace_sem);
|
|
}
|
|
|
|
enum umount_tree_flags {
|
|
UMOUNT_SYNC = 1,
|
|
UMOUNT_PROPAGATE = 2,
|
|
UMOUNT_CONNECTED = 4,
|
|
};
|
|
|
|
static bool disconnect_mount(struct mount *mnt, enum umount_tree_flags how)
|
|
{
|
|
/* Leaving mounts connected is only valid for lazy umounts */
|
|
if (how & UMOUNT_SYNC)
|
|
return true;
|
|
|
|
/* A mount without a parent has nothing to be connected to */
|
|
if (!mnt_has_parent(mnt))
|
|
return true;
|
|
|
|
/* Because the reference counting rules change when mounts are
|
|
* unmounted and connected, umounted mounts may not be
|
|
* connected to mounted mounts.
|
|
*/
|
|
if (!(mnt->mnt_parent->mnt.mnt_flags & MNT_UMOUNT))
|
|
return true;
|
|
|
|
/* Has it been requested that the mount remain connected? */
|
|
if (how & UMOUNT_CONNECTED)
|
|
return false;
|
|
|
|
/* Is the mount locked such that it needs to remain connected? */
|
|
if (IS_MNT_LOCKED(mnt))
|
|
return false;
|
|
|
|
/* By default disconnect the mount */
|
|
return true;
|
|
}
|
|
|
|
/*
|
|
* mount_lock must be held
|
|
* namespace_sem must be held for write
|
|
*/
|
|
static void umount_tree(struct mount *mnt, enum umount_tree_flags how)
|
|
{
|
|
LIST_HEAD(tmp_list);
|
|
struct mount *p;
|
|
|
|
if (how & UMOUNT_PROPAGATE)
|
|
propagate_mount_unlock(mnt);
|
|
|
|
/* Gather the mounts to umount */
|
|
for (p = mnt; p; p = next_mnt(p, mnt)) {
|
|
p->mnt.mnt_flags |= MNT_UMOUNT;
|
|
list_move(&p->mnt_list, &tmp_list);
|
|
}
|
|
|
|
/* Hide the mounts from mnt_mounts */
|
|
list_for_each_entry(p, &tmp_list, mnt_list) {
|
|
list_del_init(&p->mnt_child);
|
|
}
|
|
|
|
/* Add propogated mounts to the tmp_list */
|
|
if (how & UMOUNT_PROPAGATE)
|
|
propagate_umount(&tmp_list);
|
|
|
|
while (!list_empty(&tmp_list)) {
|
|
struct mnt_namespace *ns;
|
|
bool disconnect;
|
|
p = list_first_entry(&tmp_list, struct mount, mnt_list);
|
|
list_del_init(&p->mnt_expire);
|
|
list_del_init(&p->mnt_list);
|
|
ns = p->mnt_ns;
|
|
if (ns) {
|
|
ns->mounts--;
|
|
__touch_mnt_namespace(ns);
|
|
}
|
|
p->mnt_ns = NULL;
|
|
if (how & UMOUNT_SYNC)
|
|
p->mnt.mnt_flags |= MNT_SYNC_UMOUNT;
|
|
|
|
disconnect = disconnect_mount(p, how);
|
|
|
|
pin_insert_group(&p->mnt_umount, &p->mnt_parent->mnt,
|
|
disconnect ? &unmounted : NULL);
|
|
if (mnt_has_parent(p)) {
|
|
mnt_add_count(p->mnt_parent, -1);
|
|
if (!disconnect) {
|
|
/* Don't forget about p */
|
|
list_add_tail(&p->mnt_child, &p->mnt_parent->mnt_mounts);
|
|
} else {
|
|
umount_mnt(p);
|
|
}
|
|
}
|
|
change_mnt_propagation(p, MS_PRIVATE);
|
|
}
|
|
}
|
|
|
|
static void shrink_submounts(struct mount *mnt);
|
|
|
|
static int do_umount(struct mount *mnt, int flags)
|
|
{
|
|
struct super_block *sb = mnt->mnt.mnt_sb;
|
|
int retval;
|
|
|
|
retval = security_sb_umount(&mnt->mnt, flags);
|
|
if (retval)
|
|
return retval;
|
|
|
|
/*
|
|
* Allow userspace to request a mountpoint be expired rather than
|
|
* unmounting unconditionally. Unmount only happens if:
|
|
* (1) the mark is already set (the mark is cleared by mntput())
|
|
* (2) the usage count == 1 [parent vfsmount] + 1 [sys_umount]
|
|
*/
|
|
if (flags & MNT_EXPIRE) {
|
|
if (&mnt->mnt == current->fs->root.mnt ||
|
|
flags & (MNT_FORCE | MNT_DETACH))
|
|
return -EINVAL;
|
|
|
|
/*
|
|
* probably don't strictly need the lock here if we examined
|
|
* all race cases, but it's a slowpath.
|
|
*/
|
|
lock_mount_hash();
|
|
if (mnt_get_count(mnt) != 2) {
|
|
unlock_mount_hash();
|
|
return -EBUSY;
|
|
}
|
|
unlock_mount_hash();
|
|
|
|
if (!xchg(&mnt->mnt_expiry_mark, 1))
|
|
return -EAGAIN;
|
|
}
|
|
|
|
/*
|
|
* If we may have to abort operations to get out of this
|
|
* mount, and they will themselves hold resources we must
|
|
* allow the fs to do things. In the Unix tradition of
|
|
* 'Gee thats tricky lets do it in userspace' the umount_begin
|
|
* might fail to complete on the first run through as other tasks
|
|
* must return, and the like. Thats for the mount program to worry
|
|
* about for the moment.
|
|
*/
|
|
|
|
if (flags & MNT_FORCE && sb->s_op->umount_begin) {
|
|
sb->s_op->umount_begin(sb);
|
|
}
|
|
|
|
/*
|
|
* No sense to grab the lock for this test, but test itself looks
|
|
* somewhat bogus. Suggestions for better replacement?
|
|
* Ho-hum... In principle, we might treat that as umount + switch
|
|
* to rootfs. GC would eventually take care of the old vfsmount.
|
|
* Actually it makes sense, especially if rootfs would contain a
|
|
* /reboot - static binary that would close all descriptors and
|
|
* call reboot(9). Then init(8) could umount root and exec /reboot.
|
|
*/
|
|
if (&mnt->mnt == current->fs->root.mnt && !(flags & MNT_DETACH)) {
|
|
/*
|
|
* Special case for "unmounting" root ...
|
|
* we just try to remount it readonly.
|
|
*/
|
|
if (!ns_capable(sb->s_user_ns, CAP_SYS_ADMIN))
|
|
return -EPERM;
|
|
down_write(&sb->s_umount);
|
|
if (!sb_rdonly(sb))
|
|
retval = do_remount_sb(sb, SB_RDONLY, NULL, 0);
|
|
up_write(&sb->s_umount);
|
|
return retval;
|
|
}
|
|
|
|
namespace_lock();
|
|
lock_mount_hash();
|
|
|
|
/* Recheck MNT_LOCKED with the locks held */
|
|
retval = -EINVAL;
|
|
if (mnt->mnt.mnt_flags & MNT_LOCKED)
|
|
goto out;
|
|
|
|
event++;
|
|
if (flags & MNT_DETACH) {
|
|
if (!list_empty(&mnt->mnt_list))
|
|
umount_tree(mnt, UMOUNT_PROPAGATE);
|
|
retval = 0;
|
|
} else {
|
|
shrink_submounts(mnt);
|
|
retval = -EBUSY;
|
|
if (!propagate_mount_busy(mnt, 2)) {
|
|
if (!list_empty(&mnt->mnt_list))
|
|
umount_tree(mnt, UMOUNT_PROPAGATE|UMOUNT_SYNC);
|
|
retval = 0;
|
|
}
|
|
}
|
|
out:
|
|
unlock_mount_hash();
|
|
namespace_unlock();
|
|
return retval;
|
|
}
|
|
|
|
/*
|
|
* __detach_mounts - lazily unmount all mounts on the specified dentry
|
|
*
|
|
* During unlink, rmdir, and d_drop it is possible to loose the path
|
|
* to an existing mountpoint, and wind up leaking the mount.
|
|
* detach_mounts allows lazily unmounting those mounts instead of
|
|
* leaking them.
|
|
*
|
|
* The caller may hold dentry->d_inode->i_mutex.
|
|
*/
|
|
void __detach_mounts(struct dentry *dentry)
|
|
{
|
|
struct mountpoint *mp;
|
|
struct mount *mnt;
|
|
|
|
namespace_lock();
|
|
lock_mount_hash();
|
|
mp = lookup_mountpoint(dentry);
|
|
if (IS_ERR_OR_NULL(mp))
|
|
goto out_unlock;
|
|
|
|
event++;
|
|
while (!hlist_empty(&mp->m_list)) {
|
|
mnt = hlist_entry(mp->m_list.first, struct mount, mnt_mp_list);
|
|
if (mnt->mnt.mnt_flags & MNT_UMOUNT) {
|
|
hlist_add_head(&mnt->mnt_umount.s_list, &unmounted);
|
|
umount_mnt(mnt);
|
|
}
|
|
else umount_tree(mnt, UMOUNT_CONNECTED);
|
|
}
|
|
put_mountpoint(mp);
|
|
out_unlock:
|
|
unlock_mount_hash();
|
|
namespace_unlock();
|
|
}
|
|
|
|
/*
|
|
* Is the caller allowed to modify his namespace?
|
|
*/
|
|
static inline bool may_mount(void)
|
|
{
|
|
return ns_capable(current->nsproxy->mnt_ns->user_ns, CAP_SYS_ADMIN);
|
|
}
|
|
|
|
static inline bool may_mandlock(void)
|
|
{
|
|
#ifndef CONFIG_MANDATORY_FILE_LOCKING
|
|
return false;
|
|
#endif
|
|
return capable(CAP_SYS_ADMIN);
|
|
}
|
|
|
|
/*
|
|
* Now umount can handle mount points as well as block devices.
|
|
* This is important for filesystems which use unnamed block devices.
|
|
*
|
|
* We now support a flag for forced unmount like the other 'big iron'
|
|
* unixes. Our API is identical to OSF/1 to avoid making a mess of AMD
|
|
*/
|
|
|
|
int ksys_umount(char __user *name, int flags)
|
|
{
|
|
struct path path;
|
|
struct mount *mnt;
|
|
int retval;
|
|
int lookup_flags = 0;
|
|
|
|
if (flags & ~(MNT_FORCE | MNT_DETACH | MNT_EXPIRE | UMOUNT_NOFOLLOW))
|
|
return -EINVAL;
|
|
|
|
if (!may_mount())
|
|
return -EPERM;
|
|
|
|
if (!(flags & UMOUNT_NOFOLLOW))
|
|
lookup_flags |= LOOKUP_FOLLOW;
|
|
|
|
retval = user_path_mountpoint_at(AT_FDCWD, name, lookup_flags, &path);
|
|
if (retval)
|
|
goto out;
|
|
mnt = real_mount(path.mnt);
|
|
retval = -EINVAL;
|
|
if (path.dentry != path.mnt->mnt_root)
|
|
goto dput_and_out;
|
|
if (!check_mnt(mnt))
|
|
goto dput_and_out;
|
|
if (mnt->mnt.mnt_flags & MNT_LOCKED) /* Check optimistically */
|
|
goto dput_and_out;
|
|
retval = -EPERM;
|
|
if (flags & MNT_FORCE && !capable(CAP_SYS_ADMIN))
|
|
goto dput_and_out;
|
|
|
|
retval = do_umount(mnt, flags);
|
|
dput_and_out:
|
|
/* we mustn't call path_put() as that would clear mnt_expiry_mark */
|
|
dput(path.dentry);
|
|
mntput_no_expire(mnt);
|
|
|
|
out:
|
|
return retval;
|
|
}
|
|
|
|
SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
|
|
{
|
|
return ksys_umount(name, flags);
|
|
}
|
|
|
|
#ifdef __ARCH_WANT_SYS_OLDUMOUNT
|
|
|
|
/*
|
|
* The 2.0 compatible umount. No flags.
|
|
*/
|
|
SYSCALL_DEFINE1(oldumount, char __user *, name)
|
|
{
|
|
return ksys_umount(name, 0);
|
|
}
|
|
|
|
#endif
|
|
|
|
static bool is_mnt_ns_file(struct dentry *dentry)
|
|
{
|
|
/* Is this a proxy for a mount namespace? */
|
|
return dentry->d_op == &ns_dentry_operations &&
|
|
dentry->d_fsdata == &mntns_operations;
|
|
}
|
|
|
|
struct mnt_namespace *to_mnt_ns(struct ns_common *ns)
|
|
{
|
|
return container_of(ns, struct mnt_namespace, ns);
|
|
}
|
|
|
|
static bool mnt_ns_loop(struct dentry *dentry)
|
|
{
|
|
/* Could bind mounting the mount namespace inode cause a
|
|
* mount namespace loop?
|
|
*/
|
|
struct mnt_namespace *mnt_ns;
|
|
if (!is_mnt_ns_file(dentry))
|
|
return false;
|
|
|
|
mnt_ns = to_mnt_ns(get_proc_ns(dentry->d_inode));
|
|
return current->nsproxy->mnt_ns->seq >= mnt_ns->seq;
|
|
}
|
|
|
|
struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
|
|
int flag)
|
|
{
|
|
struct mount *res, *p, *q, *r, *parent;
|
|
|
|
if (!(flag & CL_COPY_UNBINDABLE) && IS_MNT_UNBINDABLE(mnt))
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
if (!(flag & CL_COPY_MNT_NS_FILE) && is_mnt_ns_file(dentry))
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
res = q = clone_mnt(mnt, dentry, flag);
|
|
if (IS_ERR(q))
|
|
return q;
|
|
|
|
q->mnt_mountpoint = mnt->mnt_mountpoint;
|
|
|
|
p = mnt;
|
|
list_for_each_entry(r, &mnt->mnt_mounts, mnt_child) {
|
|
struct mount *s;
|
|
if (!is_subdir(r->mnt_mountpoint, dentry))
|
|
continue;
|
|
|
|
for (s = r; s; s = next_mnt(s, r)) {
|
|
if (!(flag & CL_COPY_UNBINDABLE) &&
|
|
IS_MNT_UNBINDABLE(s)) {
|
|
if (s->mnt.mnt_flags & MNT_LOCKED) {
|
|
/* Both unbindable and locked. */
|
|
q = ERR_PTR(-EPERM);
|
|
goto out;
|
|
} else {
|
|
s = skip_mnt_tree(s);
|
|
continue;
|
|
}
|
|
}
|
|
if (!(flag & CL_COPY_MNT_NS_FILE) &&
|
|
is_mnt_ns_file(s->mnt.mnt_root)) {
|
|
s = skip_mnt_tree(s);
|
|
continue;
|
|
}
|
|
while (p != s->mnt_parent) {
|
|
p = p->mnt_parent;
|
|
q = q->mnt_parent;
|
|
}
|
|
p = s;
|
|
parent = q;
|
|
q = clone_mnt(p, p->mnt.mnt_root, flag);
|
|
if (IS_ERR(q))
|
|
goto out;
|
|
lock_mount_hash();
|
|
list_add_tail(&q->mnt_list, &res->mnt_list);
|
|
attach_mnt(q, parent, p->mnt_mp);
|
|
unlock_mount_hash();
|
|
}
|
|
}
|
|
return res;
|
|
out:
|
|
if (res) {
|
|
lock_mount_hash();
|
|
umount_tree(res, UMOUNT_SYNC);
|
|
unlock_mount_hash();
|
|
}
|
|
return q;
|
|
}
|
|
|
|
/* Caller should check returned pointer for errors */
|
|
|
|
struct vfsmount *collect_mounts(const struct path *path)
|
|
{
|
|
struct mount *tree;
|
|
namespace_lock();
|
|
if (!check_mnt(real_mount(path->mnt)))
|
|
tree = ERR_PTR(-EINVAL);
|
|
else
|
|
tree = copy_tree(real_mount(path->mnt), path->dentry,
|
|
CL_COPY_ALL | CL_PRIVATE);
|
|
namespace_unlock();
|
|
if (IS_ERR(tree))
|
|
return ERR_CAST(tree);
|
|
return &tree->mnt;
|
|
}
|
|
|
|
void drop_collected_mounts(struct vfsmount *mnt)
|
|
{
|
|
namespace_lock();
|
|
lock_mount_hash();
|
|
umount_tree(real_mount(mnt), 0);
|
|
unlock_mount_hash();
|
|
namespace_unlock();
|
|
}
|
|
|
|
/**
|
|
* clone_private_mount - create a private clone of a path
|
|
*
|
|
* This creates a new vfsmount, which will be the clone of @path. The new will
|
|
* not be attached anywhere in the namespace and will be private (i.e. changes
|
|
* to the originating mount won't be propagated into this).
|
|
*
|
|
* Release with mntput().
|
|
*/
|
|
struct vfsmount *clone_private_mount(const struct path *path)
|
|
{
|
|
struct mount *old_mnt = real_mount(path->mnt);
|
|
struct mount *new_mnt;
|
|
|
|
if (IS_MNT_UNBINDABLE(old_mnt))
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
new_mnt = clone_mnt(old_mnt, path->dentry, CL_PRIVATE);
|
|
if (IS_ERR(new_mnt))
|
|
return ERR_CAST(new_mnt);
|
|
|
|
return &new_mnt->mnt;
|
|
}
|
|
EXPORT_SYMBOL_GPL(clone_private_mount);
|
|
|
|
int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
|
|
struct vfsmount *root)
|
|
{
|
|
struct mount *mnt;
|
|
int res = f(root, arg);
|
|
if (res)
|
|
return res;
|
|
list_for_each_entry(mnt, &real_mount(root)->mnt_list, mnt_list) {
|
|
res = f(&mnt->mnt, arg);
|
|
if (res)
|
|
return res;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
static void cleanup_group_ids(struct mount *mnt, struct mount *end)
|
|
{
|
|
struct mount *p;
|
|
|
|
for (p = mnt; p != end; p = next_mnt(p, mnt)) {
|
|
if (p->mnt_group_id && !IS_MNT_SHARED(p))
|
|
mnt_release_group_id(p);
|
|
}
|
|
}
|
|
|
|
static int invent_group_ids(struct mount *mnt, bool recurse)
|
|
{
|
|
struct mount *p;
|
|
|
|
for (p = mnt; p; p = recurse ? next_mnt(p, mnt) : NULL) {
|
|
if (!p->mnt_group_id && !IS_MNT_SHARED(p)) {
|
|
int err = mnt_alloc_group_id(p);
|
|
if (err) {
|
|
cleanup_group_ids(mnt, p);
|
|
return err;
|
|
}
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
int count_mounts(struct mnt_namespace *ns, struct mount *mnt)
|
|
{
|
|
unsigned int max = READ_ONCE(sysctl_mount_max);
|
|
unsigned int mounts = 0, old, pending, sum;
|
|
struct mount *p;
|
|
|
|
for (p = mnt; p; p = next_mnt(p, mnt))
|
|
mounts++;
|
|
|
|
old = ns->mounts;
|
|
pending = ns->pending_mounts;
|
|
sum = old + pending;
|
|
if ((old > sum) ||
|
|
(pending > sum) ||
|
|
(max < sum) ||
|
|
(mounts > (max - sum)))
|
|
return -ENOSPC;
|
|
|
|
ns->pending_mounts = pending + mounts;
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* @source_mnt : mount tree to be attached
|
|
* @nd : place the mount tree @source_mnt is attached
|
|
* @parent_nd : if non-null, detach the source_mnt from its parent and
|
|
* store the parent mount and mountpoint dentry.
|
|
* (done when source_mnt is moved)
|
|
*
|
|
* NOTE: in the table below explains the semantics when a source mount
|
|
* of a given type is attached to a destination mount of a given type.
|
|
* ---------------------------------------------------------------------------
|
|
* | BIND MOUNT OPERATION |
|
|
* |**************************************************************************
|
|
* | source-->| shared | private | slave | unbindable |
|
|
* | dest | | | | |
|
|
* | | | | | | |
|
|
* | v | | | | |
|
|
* |**************************************************************************
|
|
* | shared | shared (++) | shared (+) | shared(+++)| invalid |
|
|
* | | | | | |
|
|
* |non-shared| shared (+) | private | slave (*) | invalid |
|
|
* ***************************************************************************
|
|
* A bind operation clones the source mount and mounts the clone on the
|
|
* destination mount.
|
|
*
|
|
* (++) the cloned mount is propagated to all the mounts in the propagation
|
|
* tree of the destination mount and the cloned mount is added to
|
|
* the peer group of the source mount.
|
|
* (+) the cloned mount is created under the destination mount and is marked
|
|
* as shared. The cloned mount is added to the peer group of the source
|
|
* mount.
|
|
* (+++) the mount is propagated to all the mounts in the propagation tree
|
|
* of the destination mount and the cloned mount is made slave
|
|
* of the same master as that of the source mount. The cloned mount
|
|
* is marked as 'shared and slave'.
|
|
* (*) the cloned mount is made a slave of the same master as that of the
|
|
* source mount.
|
|
*
|
|
* ---------------------------------------------------------------------------
|
|
* | MOVE MOUNT OPERATION |
|
|
* |**************************************************************************
|
|
* | source-->| shared | private | slave | unbindable |
|
|
* | dest | | | | |
|
|
* | | | | | | |
|
|
* | v | | | | |
|
|
* |**************************************************************************
|
|
* | shared | shared (+) | shared (+) | shared(+++) | invalid |
|
|
* | | | | | |
|
|
* |non-shared| shared (+*) | private | slave (*) | unbindable |
|
|
* ***************************************************************************
|
|
*
|
|
* (+) the mount is moved to the destination. And is then propagated to
|
|
* all the mounts in the propagation tree of the destination mount.
|
|
* (+*) the mount is moved to the destination.
|
|
* (+++) the mount is moved to the destination and is then propagated to
|
|
* all the mounts belonging to the destination mount's propagation tree.
|
|
* the mount is marked as 'shared and slave'.
|
|
* (*) the mount continues to be a slave at the new location.
|
|
*
|
|
* if the source mount is a tree, the operations explained above is
|
|
* applied to each mount in the tree.
|
|
* Must be called without spinlocks held, since this function can sleep
|
|
* in allocations.
|
|
*/
|
|
static int attach_recursive_mnt(struct mount *source_mnt,
|
|
struct mount *dest_mnt,
|
|
struct mountpoint *dest_mp,
|
|
struct path *parent_path)
|
|
{
|
|
HLIST_HEAD(tree_list);
|
|
struct mnt_namespace *ns = dest_mnt->mnt_ns;
|
|
struct mountpoint *smp;
|
|
struct mount *child, *p;
|
|
struct hlist_node *n;
|
|
int err;
|
|
|
|
/* Preallocate a mountpoint in case the new mounts need
|
|
* to be tucked under other mounts.
|
|
*/
|
|
smp = get_mountpoint(source_mnt->mnt.mnt_root);
|
|
if (IS_ERR(smp))
|
|
return PTR_ERR(smp);
|
|
|
|
/* Is there space to add these mounts to the mount namespace? */
|
|
if (!parent_path) {
|
|
err = count_mounts(ns, source_mnt);
|
|
if (err)
|
|
goto out;
|
|
}
|
|
|
|
if (IS_MNT_SHARED(dest_mnt)) {
|
|
err = invent_group_ids(source_mnt, true);
|
|
if (err)
|
|
goto out;
|
|
err = propagate_mnt(dest_mnt, dest_mp, source_mnt, &tree_list);
|
|
lock_mount_hash();
|
|
if (err)
|
|
goto out_cleanup_ids;
|
|
for (p = source_mnt; p; p = next_mnt(p, source_mnt))
|
|
set_mnt_shared(p);
|
|
} else {
|
|
lock_mount_hash();
|
|
}
|
|
if (parent_path) {
|
|
detach_mnt(source_mnt, parent_path);
|
|
attach_mnt(source_mnt, dest_mnt, dest_mp);
|
|
touch_mnt_namespace(source_mnt->mnt_ns);
|
|
} else {
|
|
mnt_set_mountpoint(dest_mnt, dest_mp, source_mnt);
|
|
commit_tree(source_mnt);
|
|
}
|
|
|
|
hlist_for_each_entry_safe(child, n, &tree_list, mnt_hash) {
|
|
struct mount *q;
|
|
hlist_del_init(&child->mnt_hash);
|
|
q = __lookup_mnt(&child->mnt_parent->mnt,
|
|
child->mnt_mountpoint);
|
|
if (q)
|
|
mnt_change_mountpoint(child, smp, q);
|
|
commit_tree(child);
|
|
}
|
|
put_mountpoint(smp);
|
|
unlock_mount_hash();
|
|
|
|
return 0;
|
|
|
|
out_cleanup_ids:
|
|
while (!hlist_empty(&tree_list)) {
|
|
child = hlist_entry(tree_list.first, struct mount, mnt_hash);
|
|
child->mnt_parent->mnt_ns->pending_mounts = 0;
|
|
umount_tree(child, UMOUNT_SYNC);
|
|
}
|
|
unlock_mount_hash();
|
|
cleanup_group_ids(source_mnt, NULL);
|
|
out:
|
|
ns->pending_mounts = 0;
|
|
|
|
read_seqlock_excl(&mount_lock);
|
|
put_mountpoint(smp);
|
|
read_sequnlock_excl(&mount_lock);
|
|
|
|
return err;
|
|
}
|
|
|
|
static struct mountpoint *lock_mount(struct path *path)
|
|
{
|
|
struct vfsmount *mnt;
|
|
struct dentry *dentry = path->dentry;
|
|
retry:
|
|
inode_lock(dentry->d_inode);
|
|
if (unlikely(cant_mount(dentry))) {
|
|
inode_unlock(dentry->d_inode);
|
|
return ERR_PTR(-ENOENT);
|
|
}
|
|
namespace_lock();
|
|
mnt = lookup_mnt(path);
|
|
if (likely(!mnt)) {
|
|
struct mountpoint *mp = get_mountpoint(dentry);
|
|
if (IS_ERR(mp)) {
|
|
namespace_unlock();
|
|
inode_unlock(dentry->d_inode);
|
|
return mp;
|
|
}
|
|
return mp;
|
|
}
|
|
namespace_unlock();
|
|
inode_unlock(path->dentry->d_inode);
|
|
path_put(path);
|
|
path->mnt = mnt;
|
|
dentry = path->dentry = dget(mnt->mnt_root);
|
|
goto retry;
|
|
}
|
|
|
|
static void unlock_mount(struct mountpoint *where)
|
|
{
|
|
struct dentry *dentry = where->m_dentry;
|
|
|
|
read_seqlock_excl(&mount_lock);
|
|
put_mountpoint(where);
|
|
read_sequnlock_excl(&mount_lock);
|
|
|
|
namespace_unlock();
|
|
inode_unlock(dentry->d_inode);
|
|
}
|
|
|
|
static int graft_tree(struct mount *mnt, struct mount *p, struct mountpoint *mp)
|
|
{
|
|
if (mnt->mnt.mnt_sb->s_flags & SB_NOUSER)
|
|
return -EINVAL;
|
|
|
|
if (d_is_dir(mp->m_dentry) !=
|
|
d_is_dir(mnt->mnt.mnt_root))
|
|
return -ENOTDIR;
|
|
|
|
return attach_recursive_mnt(mnt, p, mp, NULL);
|
|
}
|
|
|
|
/*
|
|
* Sanity check the flags to change_mnt_propagation.
|
|
*/
|
|
|
|
static int flags_to_propagation_type(int ms_flags)
|
|
{
|
|
int type = ms_flags & ~(MS_REC | MS_SILENT);
|
|
|
|
/* Fail if any non-propagation flags are set */
|
|
if (type & ~(MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
|
|
return 0;
|
|
/* Only one propagation flag should be set */
|
|
if (!is_power_of_2(type))
|
|
return 0;
|
|
return type;
|
|
}
|
|
|
|
/*
|
|
* recursively change the type of the mountpoint.
|
|
*/
|
|
static int do_change_type(struct path *path, int ms_flags)
|
|
{
|
|
struct mount *m;
|
|
struct mount *mnt = real_mount(path->mnt);
|
|
int recurse = ms_flags & MS_REC;
|
|
int type;
|
|
int err = 0;
|
|
|
|
if (path->dentry != path->mnt->mnt_root)
|
|
return -EINVAL;
|
|
|
|
type = flags_to_propagation_type(ms_flags);
|
|
if (!type)
|
|
return -EINVAL;
|
|
|
|
namespace_lock();
|
|
if (type == MS_SHARED) {
|
|
err = invent_group_ids(mnt, recurse);
|
|
if (err)
|
|
goto out_unlock;
|
|
}
|
|
|
|
lock_mount_hash();
|
|
for (m = mnt; m; m = (recurse ? next_mnt(m, mnt) : NULL))
|
|
change_mnt_propagation(m, type);
|
|
unlock_mount_hash();
|
|
|
|
out_unlock:
|
|
namespace_unlock();
|
|
return err;
|
|
}
|
|
|
|
static bool has_locked_children(struct mount *mnt, struct dentry *dentry)
|
|
{
|
|
struct mount *child;
|
|
list_for_each_entry(child, &mnt->mnt_mounts, mnt_child) {
|
|
if (!is_subdir(child->mnt_mountpoint, dentry))
|
|
continue;
|
|
|
|
if (child->mnt.mnt_flags & MNT_LOCKED)
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/*
|
|
* do loopback mount.
|
|
*/
|
|
static int do_loopback(struct path *path, const char *old_name,
|
|
int recurse)
|
|
{
|
|
struct path old_path;
|
|
struct mount *mnt = NULL, *old, *parent;
|
|
struct mountpoint *mp;
|
|
int err;
|
|
if (!old_name || !*old_name)
|
|
return -EINVAL;
|
|
err = kern_path(old_name, LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT, &old_path);
|
|
if (err)
|
|
return err;
|
|
|
|
err = -EINVAL;
|
|
if (mnt_ns_loop(old_path.dentry))
|
|
goto out;
|
|
|
|
mp = lock_mount(path);
|
|
err = PTR_ERR(mp);
|
|
if (IS_ERR(mp))
|
|
goto out;
|
|
|
|
old = real_mount(old_path.mnt);
|
|
parent = real_mount(path->mnt);
|
|
|
|
err = -EINVAL;
|
|
if (IS_MNT_UNBINDABLE(old))
|
|
goto out2;
|
|
|
|
if (!check_mnt(parent))
|
|
goto out2;
|
|
|
|
if (!check_mnt(old) && old_path.dentry->d_op != &ns_dentry_operations)
|
|
goto out2;
|
|
|
|
if (!recurse && has_locked_children(old, old_path.dentry))
|
|
goto out2;
|
|
|
|
if (recurse)
|
|
mnt = copy_tree(old, old_path.dentry, CL_COPY_MNT_NS_FILE);
|
|
else
|
|
mnt = clone_mnt(old, old_path.dentry, 0);
|
|
|
|
if (IS_ERR(mnt)) {
|
|
err = PTR_ERR(mnt);
|
|
goto out2;
|
|
}
|
|
|
|
mnt->mnt.mnt_flags &= ~MNT_LOCKED;
|
|
|
|
err = graft_tree(mnt, parent, mp);
|
|
if (err) {
|
|
lock_mount_hash();
|
|
umount_tree(mnt, UMOUNT_SYNC);
|
|
unlock_mount_hash();
|
|
}
|
|
out2:
|
|
unlock_mount(mp);
|
|
out:
|
|
path_put(&old_path);
|
|
return err;
|
|
}
|
|
|
|
static int change_mount_flags(struct vfsmount *mnt, int ms_flags)
|
|
{
|
|
int error = 0;
|
|
int readonly_request = 0;
|
|
|
|
if (ms_flags & MS_RDONLY)
|
|
readonly_request = 1;
|
|
if (readonly_request == __mnt_is_readonly(mnt))
|
|
return 0;
|
|
|
|
if (readonly_request)
|
|
error = mnt_make_readonly(real_mount(mnt));
|
|
else
|
|
__mnt_unmake_readonly(real_mount(mnt));
|
|
return error;
|
|
}
|
|
|
|
/*
|
|
* change filesystem flags. dir should be a physical root of filesystem.
|
|
* If you've mounted a non-root directory somewhere and want to do remount
|
|
* on it - tough luck.
|
|
*/
|
|
static int do_remount(struct path *path, int ms_flags, int sb_flags,
|
|
int mnt_flags, void *data)
|
|
{
|
|
int err;
|
|
struct super_block *sb = path->mnt->mnt_sb;
|
|
struct mount *mnt = real_mount(path->mnt);
|
|
|
|
if (!check_mnt(mnt))
|
|
return -EINVAL;
|
|
|
|
if (path->dentry != path->mnt->mnt_root)
|
|
return -EINVAL;
|
|
|
|
/* Don't allow changing of locked mnt flags.
|
|
*
|
|
* No locks need to be held here while testing the various
|
|
* MNT_LOCK flags because those flags can never be cleared
|
|
* once they are set.
|
|
*/
|
|
if ((mnt->mnt.mnt_flags & MNT_LOCK_READONLY) &&
|
|
!(mnt_flags & MNT_READONLY)) {
|
|
return -EPERM;
|
|
}
|
|
if ((mnt->mnt.mnt_flags & MNT_LOCK_NODEV) &&
|
|
!(mnt_flags & MNT_NODEV)) {
|
|
return -EPERM;
|
|
}
|
|
if ((mnt->mnt.mnt_flags & MNT_LOCK_NOSUID) &&
|
|
!(mnt_flags & MNT_NOSUID)) {
|
|
return -EPERM;
|
|
}
|
|
if ((mnt->mnt.mnt_flags & MNT_LOCK_NOEXEC) &&
|
|
!(mnt_flags & MNT_NOEXEC)) {
|
|
return -EPERM;
|
|
}
|
|
if ((mnt->mnt.mnt_flags & MNT_LOCK_ATIME) &&
|
|
((mnt->mnt.mnt_flags & MNT_ATIME_MASK) != (mnt_flags & MNT_ATIME_MASK))) {
|
|
return -EPERM;
|
|
}
|
|
|
|
err = security_sb_remount(sb, data);
|
|
if (err)
|
|
return err;
|
|
|
|
down_write(&sb->s_umount);
|
|
if (ms_flags & MS_BIND)
|
|
err = change_mount_flags(path->mnt, ms_flags);
|
|
else if (!ns_capable(sb->s_user_ns, CAP_SYS_ADMIN))
|
|
err = -EPERM;
|
|
else {
|
|
err = do_remount_sb2(path->mnt, sb, sb_flags, data, 0);
|
|
namespace_lock();
|
|
lock_mount_hash();
|
|
propagate_remount(mnt);
|
|
unlock_mount_hash();
|
|
namespace_unlock();
|
|
}
|
|
if (!err) {
|
|
lock_mount_hash();
|
|
mnt_flags |= mnt->mnt.mnt_flags & ~MNT_USER_SETTABLE_MASK;
|
|
mnt->mnt.mnt_flags = mnt_flags;
|
|
touch_mnt_namespace(mnt->mnt_ns);
|
|
unlock_mount_hash();
|
|
}
|
|
up_write(&sb->s_umount);
|
|
return err;
|
|
}
|
|
|
|
static inline int tree_contains_unbindable(struct mount *mnt)
|
|
{
|
|
struct mount *p;
|
|
for (p = mnt; p; p = next_mnt(p, mnt)) {
|
|
if (IS_MNT_UNBINDABLE(p))
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
static int do_move_mount(struct path *path, const char *old_name)
|
|
{
|
|
struct path old_path, parent_path;
|
|
struct mount *p;
|
|
struct mount *old;
|
|
struct mountpoint *mp;
|
|
int err;
|
|
if (!old_name || !*old_name)
|
|
return -EINVAL;
|
|
err = kern_path(old_name, LOOKUP_FOLLOW, &old_path);
|
|
if (err)
|
|
return err;
|
|
|
|
mp = lock_mount(path);
|
|
err = PTR_ERR(mp);
|
|
if (IS_ERR(mp))
|
|
goto out;
|
|
|
|
old = real_mount(old_path.mnt);
|
|
p = real_mount(path->mnt);
|
|
|
|
err = -EINVAL;
|
|
if (!check_mnt(p) || !check_mnt(old))
|
|
goto out1;
|
|
|
|
if (old->mnt.mnt_flags & MNT_LOCKED)
|
|
goto out1;
|
|
|
|
err = -EINVAL;
|
|
if (old_path.dentry != old_path.mnt->mnt_root)
|
|
goto out1;
|
|
|
|
if (!mnt_has_parent(old))
|
|
goto out1;
|
|
|
|
if (d_is_dir(path->dentry) !=
|
|
d_is_dir(old_path.dentry))
|
|
goto out1;
|
|
/*
|
|
* Don't move a mount residing in a shared parent.
|
|
*/
|
|
if (IS_MNT_SHARED(old->mnt_parent))
|
|
goto out1;
|
|
/*
|
|
* Don't move a mount tree containing unbindable mounts to a destination
|
|
* mount which is shared.
|
|
*/
|
|
if (IS_MNT_SHARED(p) && tree_contains_unbindable(old))
|
|
goto out1;
|
|
err = -ELOOP;
|
|
for (; mnt_has_parent(p); p = p->mnt_parent)
|
|
if (p == old)
|
|
goto out1;
|
|
|
|
err = attach_recursive_mnt(old, real_mount(path->mnt), mp, &parent_path);
|
|
if (err)
|
|
goto out1;
|
|
|
|
/* if the mount is moved, it should no longer be expire
|
|
* automatically */
|
|
list_del_init(&old->mnt_expire);
|
|
out1:
|
|
unlock_mount(mp);
|
|
out:
|
|
if (!err)
|
|
path_put(&parent_path);
|
|
path_put(&old_path);
|
|
return err;
|
|
}
|
|
|
|
static struct vfsmount *fs_set_subtype(struct vfsmount *mnt, const char *fstype)
|
|
{
|
|
int err;
|
|
const char *subtype = strchr(fstype, '.');
|
|
if (subtype) {
|
|
subtype++;
|
|
err = -EINVAL;
|
|
if (!subtype[0])
|
|
goto err;
|
|
} else
|
|
subtype = "";
|
|
|
|
mnt->mnt_sb->s_subtype = kstrdup(subtype, GFP_KERNEL);
|
|
err = -ENOMEM;
|
|
if (!mnt->mnt_sb->s_subtype)
|
|
goto err;
|
|
return mnt;
|
|
|
|
err:
|
|
mntput(mnt);
|
|
return ERR_PTR(err);
|
|
}
|
|
|
|
/*
|
|
* add a mount into a namespace's mount tree
|
|
*/
|
|
static int do_add_mount(struct mount *newmnt, struct path *path, int mnt_flags)
|
|
{
|
|
struct mountpoint *mp;
|
|
struct mount *parent;
|
|
int err;
|
|
|
|
mnt_flags &= ~MNT_INTERNAL_FLAGS;
|
|
|
|
mp = lock_mount(path);
|
|
if (IS_ERR(mp))
|
|
return PTR_ERR(mp);
|
|
|
|
parent = real_mount(path->mnt);
|
|
err = -EINVAL;
|
|
if (unlikely(!check_mnt(parent))) {
|
|
/* that's acceptable only for automounts done in private ns */
|
|
if (!(mnt_flags & MNT_SHRINKABLE))
|
|
goto unlock;
|
|
/* ... and for those we'd better have mountpoint still alive */
|
|
if (!parent->mnt_ns)
|
|
goto unlock;
|
|
}
|
|
|
|
/* Refuse the same filesystem on the same mount point */
|
|
err = -EBUSY;
|
|
if (path->mnt->mnt_sb == newmnt->mnt.mnt_sb &&
|
|
path->mnt->mnt_root == path->dentry)
|
|
goto unlock;
|
|
|
|
err = -EINVAL;
|
|
if (d_is_symlink(newmnt->mnt.mnt_root))
|
|
goto unlock;
|
|
|
|
newmnt->mnt.mnt_flags = mnt_flags;
|
|
err = graft_tree(newmnt, parent, mp);
|
|
|
|
unlock:
|
|
unlock_mount(mp);
|
|
return err;
|
|
}
|
|
|
|
static bool mount_too_revealing(struct vfsmount *mnt, int *new_mnt_flags);
|
|
|
|
/*
|
|
* create a new mount for userspace and request it to be added into the
|
|
* namespace's tree
|
|
*/
|
|
static int do_new_mount(struct path *path, const char *fstype, int sb_flags,
|
|
int mnt_flags, const char *name, void *data)
|
|
{
|
|
struct file_system_type *type;
|
|
struct vfsmount *mnt;
|
|
int err;
|
|
|
|
if (!fstype)
|
|
return -EINVAL;
|
|
|
|
type = get_fs_type(fstype);
|
|
if (!type)
|
|
return -ENODEV;
|
|
|
|
mnt = vfs_kern_mount(type, sb_flags, name, data);
|
|
if (!IS_ERR(mnt) && (type->fs_flags & FS_HAS_SUBTYPE) &&
|
|
!mnt->mnt_sb->s_subtype)
|
|
mnt = fs_set_subtype(mnt, fstype);
|
|
|
|
put_filesystem(type);
|
|
if (IS_ERR(mnt))
|
|
return PTR_ERR(mnt);
|
|
|
|
if (mount_too_revealing(mnt, &mnt_flags)) {
|
|
mntput(mnt);
|
|
return -EPERM;
|
|
}
|
|
|
|
err = do_add_mount(real_mount(mnt), path, mnt_flags);
|
|
if (err)
|
|
mntput(mnt);
|
|
return err;
|
|
}
|
|
|
|
int finish_automount(struct vfsmount *m, struct path *path)
|
|
{
|
|
struct mount *mnt = real_mount(m);
|
|
int err;
|
|
/* The new mount record should have at least 2 refs to prevent it being
|
|
* expired before we get a chance to add it
|
|
*/
|
|
BUG_ON(mnt_get_count(mnt) < 2);
|
|
|
|
if (m->mnt_sb == path->mnt->mnt_sb &&
|
|
m->mnt_root == path->dentry) {
|
|
err = -ELOOP;
|
|
goto fail;
|
|
}
|
|
|
|
err = do_add_mount(mnt, path, path->mnt->mnt_flags | MNT_SHRINKABLE);
|
|
if (!err)
|
|
return 0;
|
|
fail:
|
|
/* remove m from any expiration list it may be on */
|
|
if (!list_empty(&mnt->mnt_expire)) {
|
|
namespace_lock();
|
|
list_del_init(&mnt->mnt_expire);
|
|
namespace_unlock();
|
|
}
|
|
mntput(m);
|
|
mntput(m);
|
|
return err;
|
|
}
|
|
|
|
/**
|
|
* mnt_set_expiry - Put a mount on an expiration list
|
|
* @mnt: The mount to list.
|
|
* @expiry_list: The list to add the mount to.
|
|
*/
|
|
void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list)
|
|
{
|
|
namespace_lock();
|
|
|
|
list_add_tail(&real_mount(mnt)->mnt_expire, expiry_list);
|
|
|
|
namespace_unlock();
|
|
}
|
|
EXPORT_SYMBOL(mnt_set_expiry);
|
|
|
|
/*
|
|
* process a list of expirable mountpoints with the intent of discarding any
|
|
* mountpoints that aren't in use and haven't been touched since last we came
|
|
* here
|
|
*/
|
|
void mark_mounts_for_expiry(struct list_head *mounts)
|
|
{
|
|
struct mount *mnt, *next;
|
|
LIST_HEAD(graveyard);
|
|
|
|
if (list_empty(mounts))
|
|
return;
|
|
|
|
namespace_lock();
|
|
lock_mount_hash();
|
|
|
|
/* extract from the expiration list every vfsmount that matches the
|
|
* following criteria:
|
|
* - only referenced by its parent vfsmount
|
|
* - still marked for expiry (marked on the last call here; marks are
|
|
* cleared by mntput())
|
|
*/
|
|
list_for_each_entry_safe(mnt, next, mounts, mnt_expire) {
|
|
if (!xchg(&mnt->mnt_expiry_mark, 1) ||
|
|
propagate_mount_busy(mnt, 1))
|
|
continue;
|
|
list_move(&mnt->mnt_expire, &graveyard);
|
|
}
|
|
while (!list_empty(&graveyard)) {
|
|
mnt = list_first_entry(&graveyard, struct mount, mnt_expire);
|
|
touch_mnt_namespace(mnt->mnt_ns);
|
|
umount_tree(mnt, UMOUNT_PROPAGATE|UMOUNT_SYNC);
|
|
}
|
|
unlock_mount_hash();
|
|
namespace_unlock();
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(mark_mounts_for_expiry);
|
|
|
|
/*
|
|
* Ripoff of 'select_parent()'
|
|
*
|
|
* search the list of submounts for a given mountpoint, and move any
|
|
* shrinkable submounts to the 'graveyard' list.
|
|
*/
|
|
static int select_submounts(struct mount *parent, struct list_head *graveyard)
|
|
{
|
|
struct mount *this_parent = parent;
|
|
struct list_head *next;
|
|
int found = 0;
|
|
|
|
repeat:
|
|
next = this_parent->mnt_mounts.next;
|
|
resume:
|
|
while (next != &this_parent->mnt_mounts) {
|
|
struct list_head *tmp = next;
|
|
struct mount *mnt = list_entry(tmp, struct mount, mnt_child);
|
|
|
|
next = tmp->next;
|
|
if (!(mnt->mnt.mnt_flags & MNT_SHRINKABLE))
|
|
continue;
|
|
/*
|
|
* Descend a level if the d_mounts list is non-empty.
|
|
*/
|
|
if (!list_empty(&mnt->mnt_mounts)) {
|
|
this_parent = mnt;
|
|
goto repeat;
|
|
}
|
|
|
|
if (!propagate_mount_busy(mnt, 1)) {
|
|
list_move_tail(&mnt->mnt_expire, graveyard);
|
|
found++;
|
|
}
|
|
}
|
|
/*
|
|
* All done at this level ... ascend and resume the search
|
|
*/
|
|
if (this_parent != parent) {
|
|
next = this_parent->mnt_child.next;
|
|
this_parent = this_parent->mnt_parent;
|
|
goto resume;
|
|
}
|
|
return found;
|
|
}
|
|
|
|
/*
|
|
* process a list of expirable mountpoints with the intent of discarding any
|
|
* submounts of a specific parent mountpoint
|
|
*
|
|
* mount_lock must be held for write
|
|
*/
|
|
static void shrink_submounts(struct mount *mnt)
|
|
{
|
|
LIST_HEAD(graveyard);
|
|
struct mount *m;
|
|
|
|
/* extract submounts of 'mountpoint' from the expiration list */
|
|
while (select_submounts(mnt, &graveyard)) {
|
|
while (!list_empty(&graveyard)) {
|
|
m = list_first_entry(&graveyard, struct mount,
|
|
mnt_expire);
|
|
touch_mnt_namespace(m->mnt_ns);
|
|
umount_tree(m, UMOUNT_PROPAGATE|UMOUNT_SYNC);
|
|
}
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Some copy_from_user() implementations do not return the exact number of
|
|
* bytes remaining to copy on a fault. But copy_mount_options() requires that.
|
|
* Note that this function differs from copy_from_user() in that it will oops
|
|
* on bad values of `to', rather than returning a short copy.
|
|
*/
|
|
static long exact_copy_from_user(void *to, const void __user * from,
|
|
unsigned long n)
|
|
{
|
|
char *t = to;
|
|
const char __user *f = from;
|
|
char c;
|
|
|
|
if (!access_ok(VERIFY_READ, from, n))
|
|
return n;
|
|
|
|
while (n) {
|
|
if (__get_user(c, f)) {
|
|
memset(t, 0, n);
|
|
break;
|
|
}
|
|
*t++ = c;
|
|
f++;
|
|
n--;
|
|
}
|
|
return n;
|
|
}
|
|
|
|
void *copy_mount_options(const void __user * data)
|
|
{
|
|
int i;
|
|
unsigned long size;
|
|
char *copy;
|
|
|
|
if (!data)
|
|
return NULL;
|
|
|
|
copy = kmalloc(PAGE_SIZE, GFP_KERNEL);
|
|
if (!copy)
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
/* We only care that *some* data at the address the user
|
|
* gave us is valid. Just in case, we'll zero
|
|
* the remainder of the page.
|
|
*/
|
|
/* copy_from_user cannot cross TASK_SIZE ! */
|
|
size = TASK_SIZE - (unsigned long)untagged_addr(data);
|
|
if (size > PAGE_SIZE)
|
|
size = PAGE_SIZE;
|
|
|
|
i = size - exact_copy_from_user(copy, data, size);
|
|
if (!i) {
|
|
kfree(copy);
|
|
return ERR_PTR(-EFAULT);
|
|
}
|
|
if (i != PAGE_SIZE)
|
|
memset(copy + i, 0, PAGE_SIZE - i);
|
|
return copy;
|
|
}
|
|
|
|
char *copy_mount_string(const void __user *data)
|
|
{
|
|
return data ? strndup_user(data, PAGE_SIZE) : NULL;
|
|
}
|
|
|
|
/*
|
|
* Flags is a 32-bit value that allows up to 31 non-fs dependent flags to
|
|
* be given to the mount() call (ie: read-only, no-dev, no-suid etc).
|
|
*
|
|
* data is a (void *) that can point to any structure up to
|
|
* PAGE_SIZE-1 bytes, which can contain arbitrary fs-dependent
|
|
* information (or be NULL).
|
|
*
|
|
* Pre-0.97 versions of mount() didn't have a flags word.
|
|
* When the flags word was introduced its top half was required
|
|
* to have the magic value 0xC0ED, and this remained so until 2.4.0-test9.
|
|
* Therefore, if this magic number is present, it carries no information
|
|
* and must be discarded.
|
|
*/
|
|
long do_mount(const char *dev_name, const char __user *dir_name,
|
|
const char *type_page, unsigned long flags, void *data_page)
|
|
{
|
|
struct path path;
|
|
unsigned int mnt_flags = 0, sb_flags;
|
|
int retval = 0;
|
|
|
|
/* Discard magic */
|
|
if ((flags & MS_MGC_MSK) == MS_MGC_VAL)
|
|
flags &= ~MS_MGC_MSK;
|
|
|
|
/* Basic sanity checks */
|
|
if (data_page)
|
|
((char *)data_page)[PAGE_SIZE - 1] = 0;
|
|
|
|
if (flags & MS_NOUSER)
|
|
return -EINVAL;
|
|
|
|
/* ... and get the mountpoint */
|
|
retval = user_path(dir_name, &path);
|
|
if (retval)
|
|
return retval;
|
|
|
|
retval = security_sb_mount(dev_name, &path,
|
|
type_page, flags, data_page);
|
|
if (!retval && !may_mount())
|
|
retval = -EPERM;
|
|
if (!retval && (flags & SB_MANDLOCK) && !may_mandlock())
|
|
retval = -EPERM;
|
|
if (retval)
|
|
goto dput_out;
|
|
|
|
/* Default to relatime unless overriden */
|
|
if (!(flags & MS_NOATIME))
|
|
mnt_flags |= MNT_RELATIME;
|
|
|
|
/* Separate the per-mountpoint flags */
|
|
if (flags & MS_NOSUID)
|
|
mnt_flags |= MNT_NOSUID;
|
|
if (flags & MS_NODEV)
|
|
mnt_flags |= MNT_NODEV;
|
|
if (flags & MS_NOEXEC)
|
|
mnt_flags |= MNT_NOEXEC;
|
|
if (flags & MS_NOATIME)
|
|
mnt_flags |= MNT_NOATIME;
|
|
if (flags & MS_NODIRATIME)
|
|
mnt_flags |= MNT_NODIRATIME;
|
|
if (flags & MS_STRICTATIME)
|
|
mnt_flags &= ~(MNT_RELATIME | MNT_NOATIME);
|
|
if (flags & MS_RDONLY)
|
|
mnt_flags |= MNT_READONLY;
|
|
|
|
/* The default atime for remount is preservation */
|
|
if ((flags & MS_REMOUNT) &&
|
|
((flags & (MS_NOATIME | MS_NODIRATIME | MS_RELATIME |
|
|
MS_STRICTATIME)) == 0)) {
|
|
mnt_flags &= ~MNT_ATIME_MASK;
|
|
mnt_flags |= path.mnt->mnt_flags & MNT_ATIME_MASK;
|
|
}
|
|
|
|
sb_flags = flags & (SB_RDONLY |
|
|
SB_SYNCHRONOUS |
|
|
SB_MANDLOCK |
|
|
SB_DIRSYNC |
|
|
SB_SILENT |
|
|
SB_POSIXACL |
|
|
SB_LAZYTIME |
|
|
SB_I_VERSION);
|
|
|
|
if (flags & MS_REMOUNT)
|
|
retval = do_remount(&path, flags, sb_flags, mnt_flags,
|
|
data_page);
|
|
else if (flags & MS_BIND)
|
|
retval = do_loopback(&path, dev_name, flags & MS_REC);
|
|
else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
|
|
retval = do_change_type(&path, flags);
|
|
else if (flags & MS_MOVE)
|
|
retval = do_move_mount(&path, dev_name);
|
|
else
|
|
retval = do_new_mount(&path, type_page, sb_flags, mnt_flags,
|
|
dev_name, data_page);
|
|
dput_out:
|
|
path_put(&path);
|
|
return retval;
|
|
}
|
|
|
|
static struct ucounts *inc_mnt_namespaces(struct user_namespace *ns)
|
|
{
|
|
return inc_ucount(ns, current_euid(), UCOUNT_MNT_NAMESPACES);
|
|
}
|
|
|
|
static void dec_mnt_namespaces(struct ucounts *ucounts)
|
|
{
|
|
dec_ucount(ucounts, UCOUNT_MNT_NAMESPACES);
|
|
}
|
|
|
|
static void free_mnt_ns(struct mnt_namespace *ns)
|
|
{
|
|
ns_free_inum(&ns->ns);
|
|
dec_mnt_namespaces(ns->ucounts);
|
|
put_user_ns(ns->user_ns);
|
|
kfree(ns);
|
|
}
|
|
|
|
/*
|
|
* Assign a sequence number so we can detect when we attempt to bind
|
|
* mount a reference to an older mount namespace into the current
|
|
* mount namespace, preventing reference counting loops. A 64bit
|
|
* number incrementing at 10Ghz will take 12,427 years to wrap which
|
|
* is effectively never, so we can ignore the possibility.
|
|
*/
|
|
static atomic64_t mnt_ns_seq = ATOMIC64_INIT(1);
|
|
|
|
static struct mnt_namespace *alloc_mnt_ns(struct user_namespace *user_ns)
|
|
{
|
|
struct mnt_namespace *new_ns;
|
|
struct ucounts *ucounts;
|
|
int ret;
|
|
|
|
ucounts = inc_mnt_namespaces(user_ns);
|
|
if (!ucounts)
|
|
return ERR_PTR(-ENOSPC);
|
|
|
|
new_ns = kmalloc(sizeof(struct mnt_namespace), GFP_KERNEL);
|
|
if (!new_ns) {
|
|
dec_mnt_namespaces(ucounts);
|
|
return ERR_PTR(-ENOMEM);
|
|
}
|
|
ret = ns_alloc_inum(&new_ns->ns);
|
|
if (ret) {
|
|
kfree(new_ns);
|
|
dec_mnt_namespaces(ucounts);
|
|
return ERR_PTR(ret);
|
|
}
|
|
new_ns->ns.ops = &mntns_operations;
|
|
new_ns->seq = atomic64_add_return(1, &mnt_ns_seq);
|
|
atomic_set(&new_ns->count, 1);
|
|
new_ns->root = NULL;
|
|
INIT_LIST_HEAD(&new_ns->list);
|
|
init_waitqueue_head(&new_ns->poll);
|
|
new_ns->event = 0;
|
|
new_ns->user_ns = get_user_ns(user_ns);
|
|
new_ns->ucounts = ucounts;
|
|
new_ns->mounts = 0;
|
|
new_ns->pending_mounts = 0;
|
|
return new_ns;
|
|
}
|
|
|
|
__latent_entropy
|
|
struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
|
|
struct user_namespace *user_ns, struct fs_struct *new_fs)
|
|
{
|
|
struct mnt_namespace *new_ns;
|
|
struct vfsmount *rootmnt = NULL, *pwdmnt = NULL;
|
|
struct mount *p, *q;
|
|
struct mount *old;
|
|
struct mount *new;
|
|
int copy_flags;
|
|
|
|
BUG_ON(!ns);
|
|
|
|
if (likely(!(flags & CLONE_NEWNS))) {
|
|
get_mnt_ns(ns);
|
|
return ns;
|
|
}
|
|
|
|
old = ns->root;
|
|
|
|
new_ns = alloc_mnt_ns(user_ns);
|
|
if (IS_ERR(new_ns))
|
|
return new_ns;
|
|
|
|
namespace_lock();
|
|
/* First pass: copy the tree topology */
|
|
copy_flags = CL_COPY_UNBINDABLE | CL_EXPIRE;
|
|
if (user_ns != ns->user_ns)
|
|
copy_flags |= CL_SHARED_TO_SLAVE | CL_UNPRIVILEGED;
|
|
new = copy_tree(old, old->mnt.mnt_root, copy_flags);
|
|
if (IS_ERR(new)) {
|
|
namespace_unlock();
|
|
free_mnt_ns(new_ns);
|
|
return ERR_CAST(new);
|
|
}
|
|
new_ns->root = new;
|
|
list_add_tail(&new_ns->list, &new->mnt_list);
|
|
|
|
/*
|
|
* Second pass: switch the tsk->fs->* elements and mark new vfsmounts
|
|
* as belonging to new namespace. We have already acquired a private
|
|
* fs_struct, so tsk->fs->lock is not needed.
|
|
*/
|
|
p = old;
|
|
q = new;
|
|
while (p) {
|
|
q->mnt_ns = new_ns;
|
|
new_ns->mounts++;
|
|
if (new_fs) {
|
|
if (&p->mnt == new_fs->root.mnt) {
|
|
new_fs->root.mnt = mntget(&q->mnt);
|
|
rootmnt = &p->mnt;
|
|
}
|
|
if (&p->mnt == new_fs->pwd.mnt) {
|
|
new_fs->pwd.mnt = mntget(&q->mnt);
|
|
pwdmnt = &p->mnt;
|
|
}
|
|
}
|
|
p = next_mnt(p, old);
|
|
q = next_mnt(q, new);
|
|
if (!q)
|
|
break;
|
|
while (p->mnt.mnt_root != q->mnt.mnt_root)
|
|
p = next_mnt(p, old);
|
|
}
|
|
namespace_unlock();
|
|
|
|
if (rootmnt)
|
|
mntput(rootmnt);
|
|
if (pwdmnt)
|
|
mntput(pwdmnt);
|
|
|
|
return new_ns;
|
|
}
|
|
|
|
/**
|
|
* create_mnt_ns - creates a private namespace and adds a root filesystem
|
|
* @mnt: pointer to the new root filesystem mountpoint
|
|
*/
|
|
static struct mnt_namespace *create_mnt_ns(struct vfsmount *m)
|
|
{
|
|
struct mnt_namespace *new_ns = alloc_mnt_ns(&init_user_ns);
|
|
if (!IS_ERR(new_ns)) {
|
|
struct mount *mnt = real_mount(m);
|
|
mnt->mnt_ns = new_ns;
|
|
new_ns->root = mnt;
|
|
new_ns->mounts++;
|
|
list_add(&mnt->mnt_list, &new_ns->list);
|
|
} else {
|
|
mntput(m);
|
|
}
|
|
return new_ns;
|
|
}
|
|
|
|
struct dentry *mount_subtree(struct vfsmount *mnt, const char *name)
|
|
{
|
|
struct mnt_namespace *ns;
|
|
struct super_block *s;
|
|
struct path path;
|
|
int err;
|
|
|
|
ns = create_mnt_ns(mnt);
|
|
if (IS_ERR(ns))
|
|
return ERR_CAST(ns);
|
|
|
|
err = vfs_path_lookup(mnt->mnt_root, mnt,
|
|
name, LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT, &path);
|
|
|
|
put_mnt_ns(ns);
|
|
|
|
if (err)
|
|
return ERR_PTR(err);
|
|
|
|
/* trade a vfsmount reference for active sb one */
|
|
s = path.mnt->mnt_sb;
|
|
atomic_inc(&s->s_active);
|
|
mntput(path.mnt);
|
|
/* lock the sucker */
|
|
down_write(&s->s_umount);
|
|
/* ... and return the root of (sub)tree on it */
|
|
return path.dentry;
|
|
}
|
|
EXPORT_SYMBOL(mount_subtree);
|
|
|
|
int ksys_mount(char __user *dev_name, char __user *dir_name, char __user *type,
|
|
unsigned long flags, void __user *data)
|
|
{
|
|
int ret;
|
|
char *kernel_type;
|
|
char *kernel_dev;
|
|
void *options;
|
|
|
|
kernel_type = copy_mount_string(type);
|
|
ret = PTR_ERR(kernel_type);
|
|
if (IS_ERR(kernel_type))
|
|
goto out_type;
|
|
|
|
kernel_dev = copy_mount_string(dev_name);
|
|
ret = PTR_ERR(kernel_dev);
|
|
if (IS_ERR(kernel_dev))
|
|
goto out_dev;
|
|
|
|
options = copy_mount_options(data);
|
|
ret = PTR_ERR(options);
|
|
if (IS_ERR(options))
|
|
goto out_data;
|
|
|
|
ret = do_mount(kernel_dev, dir_name, kernel_type, flags, options);
|
|
|
|
kfree(options);
|
|
out_data:
|
|
kfree(kernel_dev);
|
|
out_dev:
|
|
kfree(kernel_type);
|
|
out_type:
|
|
return ret;
|
|
}
|
|
|
|
SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
|
|
char __user *, type, unsigned long, flags, void __user *, data)
|
|
{
|
|
return ksys_mount(dev_name, dir_name, type, flags, data);
|
|
}
|
|
|
|
/*
|
|
* Return true if path is reachable from root
|
|
*
|
|
* namespace_sem or mount_lock is held
|
|
*/
|
|
bool is_path_reachable(struct mount *mnt, struct dentry *dentry,
|
|
const struct path *root)
|
|
{
|
|
while (&mnt->mnt != root->mnt && mnt_has_parent(mnt)) {
|
|
dentry = mnt->mnt_mountpoint;
|
|
mnt = mnt->mnt_parent;
|
|
}
|
|
return &mnt->mnt == root->mnt && is_subdir(dentry, root->dentry);
|
|
}
|
|
|
|
bool path_is_under(const struct path *path1, const struct path *path2)
|
|
{
|
|
bool res;
|
|
read_seqlock_excl(&mount_lock);
|
|
res = is_path_reachable(real_mount(path1->mnt), path1->dentry, path2);
|
|
read_sequnlock_excl(&mount_lock);
|
|
return res;
|
|
}
|
|
EXPORT_SYMBOL(path_is_under);
|
|
|
|
/*
|
|
* pivot_root Semantics:
|
|
* Moves the root file system of the current process to the directory put_old,
|
|
* makes new_root as the new root file system of the current process, and sets
|
|
* root/cwd of all processes which had them on the current root to new_root.
|
|
*
|
|
* Restrictions:
|
|
* The new_root and put_old must be directories, and must not be on the
|
|
* same file system as the current process root. The put_old must be
|
|
* underneath new_root, i.e. adding a non-zero number of /.. to the string
|
|
* pointed to by put_old must yield the same directory as new_root. No other
|
|
* file system may be mounted on put_old. After all, new_root is a mountpoint.
|
|
*
|
|
* Also, the current root cannot be on the 'rootfs' (initial ramfs) filesystem.
|
|
* See Documentation/filesystems/ramfs-rootfs-initramfs.txt for alternatives
|
|
* in this situation.
|
|
*
|
|
* Notes:
|
|
* - we don't move root/cwd if they are not at the root (reason: if something
|
|
* cared enough to change them, it's probably wrong to force them elsewhere)
|
|
* - it's okay to pick a root that isn't the root of a file system, e.g.
|
|
* /nfs/my_root where /nfs is the mount point. It must be a mountpoint,
|
|
* though, so you may need to say mount --bind /nfs/my_root /nfs/my_root
|
|
* first.
|
|
*/
|
|
SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
|
|
const char __user *, put_old)
|
|
{
|
|
struct path new, old, parent_path, root_parent, root;
|
|
struct mount *new_mnt, *root_mnt, *old_mnt;
|
|
struct mountpoint *old_mp, *root_mp;
|
|
int error;
|
|
|
|
if (!may_mount())
|
|
return -EPERM;
|
|
|
|
error = user_path_dir(new_root, &new);
|
|
if (error)
|
|
goto out0;
|
|
|
|
error = user_path_dir(put_old, &old);
|
|
if (error)
|
|
goto out1;
|
|
|
|
error = security_sb_pivotroot(&old, &new);
|
|
if (error)
|
|
goto out2;
|
|
|
|
get_fs_root(current->fs, &root);
|
|
old_mp = lock_mount(&old);
|
|
error = PTR_ERR(old_mp);
|
|
if (IS_ERR(old_mp))
|
|
goto out3;
|
|
|
|
error = -EINVAL;
|
|
new_mnt = real_mount(new.mnt);
|
|
root_mnt = real_mount(root.mnt);
|
|
old_mnt = real_mount(old.mnt);
|
|
if (IS_MNT_SHARED(old_mnt) ||
|
|
IS_MNT_SHARED(new_mnt->mnt_parent) ||
|
|
IS_MNT_SHARED(root_mnt->mnt_parent))
|
|
goto out4;
|
|
if (!check_mnt(root_mnt) || !check_mnt(new_mnt))
|
|
goto out4;
|
|
if (new_mnt->mnt.mnt_flags & MNT_LOCKED)
|
|
goto out4;
|
|
error = -ENOENT;
|
|
if (d_unlinked(new.dentry))
|
|
goto out4;
|
|
error = -EBUSY;
|
|
if (new_mnt == root_mnt || old_mnt == root_mnt)
|
|
goto out4; /* loop, on the same file system */
|
|
error = -EINVAL;
|
|
if (root.mnt->mnt_root != root.dentry)
|
|
goto out4; /* not a mountpoint */
|
|
if (!mnt_has_parent(root_mnt))
|
|
goto out4; /* not attached */
|
|
root_mp = root_mnt->mnt_mp;
|
|
if (new.mnt->mnt_root != new.dentry)
|
|
goto out4; /* not a mountpoint */
|
|
if (!mnt_has_parent(new_mnt))
|
|
goto out4; /* not attached */
|
|
/* make sure we can reach put_old from new_root */
|
|
if (!is_path_reachable(old_mnt, old.dentry, &new))
|
|
goto out4;
|
|
/* make certain new is below the root */
|
|
if (!is_path_reachable(new_mnt, new.dentry, &root))
|
|
goto out4;
|
|
lock_mount_hash();
|
|
root_mp->m_count++; /* pin it so it won't go away */
|
|
detach_mnt(new_mnt, &parent_path);
|
|
detach_mnt(root_mnt, &root_parent);
|
|
if (root_mnt->mnt.mnt_flags & MNT_LOCKED) {
|
|
new_mnt->mnt.mnt_flags |= MNT_LOCKED;
|
|
root_mnt->mnt.mnt_flags &= ~MNT_LOCKED;
|
|
}
|
|
/* mount old root on put_old */
|
|
attach_mnt(root_mnt, old_mnt, old_mp);
|
|
/* mount new_root on / */
|
|
attach_mnt(new_mnt, real_mount(root_parent.mnt), root_mp);
|
|
touch_mnt_namespace(current->nsproxy->mnt_ns);
|
|
/* A moved mount should not expire automatically */
|
|
list_del_init(&new_mnt->mnt_expire);
|
|
put_mountpoint(root_mp);
|
|
unlock_mount_hash();
|
|
chroot_fs_refs(&root, &new);
|
|
error = 0;
|
|
out4:
|
|
unlock_mount(old_mp);
|
|
if (!error) {
|
|
path_put(&root_parent);
|
|
path_put(&parent_path);
|
|
}
|
|
out3:
|
|
path_put(&root);
|
|
out2:
|
|
path_put(&old);
|
|
out1:
|
|
path_put(&new);
|
|
out0:
|
|
return error;
|
|
}
|
|
|
|
static void __init init_mount_tree(void)
|
|
{
|
|
struct vfsmount *mnt;
|
|
struct mnt_namespace *ns;
|
|
struct path root;
|
|
struct file_system_type *type;
|
|
|
|
type = get_fs_type("rootfs");
|
|
if (!type)
|
|
panic("Can't find rootfs type");
|
|
mnt = vfs_kern_mount(type, 0, "rootfs", NULL);
|
|
put_filesystem(type);
|
|
if (IS_ERR(mnt))
|
|
panic("Can't create rootfs");
|
|
|
|
ns = create_mnt_ns(mnt);
|
|
if (IS_ERR(ns))
|
|
panic("Can't allocate initial namespace");
|
|
|
|
init_task.nsproxy->mnt_ns = ns;
|
|
get_mnt_ns(ns);
|
|
|
|
root.mnt = mnt;
|
|
root.dentry = mnt->mnt_root;
|
|
mnt->mnt_flags |= MNT_LOCKED;
|
|
|
|
set_fs_pwd(current->fs, &root);
|
|
set_fs_root(current->fs, &root);
|
|
}
|
|
|
|
void __init mnt_init(void)
|
|
{
|
|
int err;
|
|
|
|
mnt_cache = kmem_cache_create("mnt_cache", sizeof(struct mount),
|
|
0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL);
|
|
|
|
mount_hashtable = alloc_large_system_hash("Mount-cache",
|
|
sizeof(struct hlist_head),
|
|
mhash_entries, 19,
|
|
HASH_ZERO,
|
|
&m_hash_shift, &m_hash_mask, 0, 0);
|
|
mountpoint_hashtable = alloc_large_system_hash("Mountpoint-cache",
|
|
sizeof(struct hlist_head),
|
|
mphash_entries, 19,
|
|
HASH_ZERO,
|
|
&mp_hash_shift, &mp_hash_mask, 0, 0);
|
|
|
|
if (!mount_hashtable || !mountpoint_hashtable)
|
|
panic("Failed to allocate mount hash table\n");
|
|
|
|
kernfs_init();
|
|
|
|
err = sysfs_init();
|
|
if (err)
|
|
printk(KERN_WARNING "%s: sysfs_init error: %d\n",
|
|
__func__, err);
|
|
fs_kobj = kobject_create_and_add("fs", NULL);
|
|
if (!fs_kobj)
|
|
printk(KERN_WARNING "%s: kobj create error\n", __func__);
|
|
init_rootfs();
|
|
init_mount_tree();
|
|
}
|
|
|
|
void put_mnt_ns(struct mnt_namespace *ns)
|
|
{
|
|
if (!atomic_dec_and_test(&ns->count))
|
|
return;
|
|
drop_collected_mounts(&ns->root->mnt);
|
|
free_mnt_ns(ns);
|
|
}
|
|
|
|
struct vfsmount *kern_mount_data(struct file_system_type *type, void *data)
|
|
{
|
|
struct vfsmount *mnt;
|
|
mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, data);
|
|
if (!IS_ERR(mnt)) {
|
|
/*
|
|
* it is a longterm mount, don't release mnt until
|
|
* we unmount before file sys is unregistered
|
|
*/
|
|
real_mount(mnt)->mnt_ns = MNT_NS_INTERNAL;
|
|
}
|
|
return mnt;
|
|
}
|
|
EXPORT_SYMBOL_GPL(kern_mount_data);
|
|
|
|
void kern_unmount(struct vfsmount *mnt)
|
|
{
|
|
/* release long term mount so mount point can be released */
|
|
if (!IS_ERR_OR_NULL(mnt)) {
|
|
real_mount(mnt)->mnt_ns = NULL;
|
|
synchronize_rcu(); /* yecchhh... */
|
|
mntput(mnt);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(kern_unmount);
|
|
|
|
bool our_mnt(struct vfsmount *mnt)
|
|
{
|
|
return check_mnt(real_mount(mnt));
|
|
}
|
|
|
|
bool current_chrooted(void)
|
|
{
|
|
/* Does the current process have a non-standard root */
|
|
struct path ns_root;
|
|
struct path fs_root;
|
|
bool chrooted;
|
|
|
|
/* Find the namespace root */
|
|
ns_root.mnt = ¤t->nsproxy->mnt_ns->root->mnt;
|
|
ns_root.dentry = ns_root.mnt->mnt_root;
|
|
path_get(&ns_root);
|
|
while (d_mountpoint(ns_root.dentry) && follow_down_one(&ns_root))
|
|
;
|
|
|
|
get_fs_root(current->fs, &fs_root);
|
|
|
|
chrooted = !path_equal(&fs_root, &ns_root);
|
|
|
|
path_put(&fs_root);
|
|
path_put(&ns_root);
|
|
|
|
return chrooted;
|
|
}
|
|
|
|
static bool mnt_already_visible(struct mnt_namespace *ns, struct vfsmount *new,
|
|
int *new_mnt_flags)
|
|
{
|
|
int new_flags = *new_mnt_flags;
|
|
struct mount *mnt;
|
|
bool visible = false;
|
|
|
|
down_read(&namespace_sem);
|
|
list_for_each_entry(mnt, &ns->list, mnt_list) {
|
|
struct mount *child;
|
|
int mnt_flags;
|
|
|
|
if (mnt->mnt.mnt_sb->s_type != new->mnt_sb->s_type)
|
|
continue;
|
|
|
|
/* This mount is not fully visible if it's root directory
|
|
* is not the root directory of the filesystem.
|
|
*/
|
|
if (mnt->mnt.mnt_root != mnt->mnt.mnt_sb->s_root)
|
|
continue;
|
|
|
|
/* A local view of the mount flags */
|
|
mnt_flags = mnt->mnt.mnt_flags;
|
|
|
|
/* Don't miss readonly hidden in the superblock flags */
|
|
if (sb_rdonly(mnt->mnt.mnt_sb))
|
|
mnt_flags |= MNT_LOCK_READONLY;
|
|
|
|
/* Verify the mount flags are equal to or more permissive
|
|
* than the proposed new mount.
|
|
*/
|
|
if ((mnt_flags & MNT_LOCK_READONLY) &&
|
|
!(new_flags & MNT_READONLY))
|
|
continue;
|
|
if ((mnt_flags & MNT_LOCK_ATIME) &&
|
|
((mnt_flags & MNT_ATIME_MASK) != (new_flags & MNT_ATIME_MASK)))
|
|
continue;
|
|
|
|
/* This mount is not fully visible if there are any
|
|
* locked child mounts that cover anything except for
|
|
* empty directories.
|
|
*/
|
|
list_for_each_entry(child, &mnt->mnt_mounts, mnt_child) {
|
|
struct inode *inode = child->mnt_mountpoint->d_inode;
|
|
/* Only worry about locked mounts */
|
|
if (!(child->mnt.mnt_flags & MNT_LOCKED))
|
|
continue;
|
|
/* Is the directory permanetly empty? */
|
|
if (!is_empty_dir_inode(inode))
|
|
goto next;
|
|
}
|
|
/* Preserve the locked attributes */
|
|
*new_mnt_flags |= mnt_flags & (MNT_LOCK_READONLY | \
|
|
MNT_LOCK_ATIME);
|
|
visible = true;
|
|
goto found;
|
|
next: ;
|
|
}
|
|
found:
|
|
up_read(&namespace_sem);
|
|
return visible;
|
|
}
|
|
|
|
static bool mount_too_revealing(struct vfsmount *mnt, int *new_mnt_flags)
|
|
{
|
|
const unsigned long required_iflags = SB_I_NOEXEC | SB_I_NODEV;
|
|
struct mnt_namespace *ns = current->nsproxy->mnt_ns;
|
|
unsigned long s_iflags;
|
|
|
|
if (ns->user_ns == &init_user_ns)
|
|
return false;
|
|
|
|
/* Can this filesystem be too revealing? */
|
|
s_iflags = mnt->mnt_sb->s_iflags;
|
|
if (!(s_iflags & SB_I_USERNS_VISIBLE))
|
|
return false;
|
|
|
|
if ((s_iflags & required_iflags) != required_iflags) {
|
|
WARN_ONCE(1, "Expected s_iflags to contain 0x%lx\n",
|
|
required_iflags);
|
|
return true;
|
|
}
|
|
|
|
return !mnt_already_visible(ns, mnt, new_mnt_flags);
|
|
}
|
|
|
|
bool mnt_may_suid(struct vfsmount *mnt)
|
|
{
|
|
/*
|
|
* Foreign mounts (accessed via fchdir or through /proc
|
|
* symlinks) are always treated as if they are nosuid. This
|
|
* prevents namespaces from trusting potentially unsafe
|
|
* suid/sgid bits, file caps, or security labels that originate
|
|
* in other namespaces.
|
|
*/
|
|
return !(mnt->mnt_flags & MNT_NOSUID) && check_mnt(real_mount(mnt)) &&
|
|
current_in_userns(mnt->mnt_sb->s_user_ns);
|
|
}
|
|
|
|
static struct ns_common *mntns_get(struct task_struct *task)
|
|
{
|
|
struct ns_common *ns = NULL;
|
|
struct nsproxy *nsproxy;
|
|
|
|
task_lock(task);
|
|
nsproxy = task->nsproxy;
|
|
if (nsproxy) {
|
|
ns = &nsproxy->mnt_ns->ns;
|
|
get_mnt_ns(to_mnt_ns(ns));
|
|
}
|
|
task_unlock(task);
|
|
|
|
return ns;
|
|
}
|
|
|
|
static void mntns_put(struct ns_common *ns)
|
|
{
|
|
put_mnt_ns(to_mnt_ns(ns));
|
|
}
|
|
|
|
static int mntns_install(struct nsproxy *nsproxy, struct ns_common *ns)
|
|
{
|
|
struct fs_struct *fs = current->fs;
|
|
struct mnt_namespace *mnt_ns = to_mnt_ns(ns), *old_mnt_ns;
|
|
struct path root;
|
|
int err;
|
|
|
|
if (!ns_capable(mnt_ns->user_ns, CAP_SYS_ADMIN) ||
|
|
!ns_capable(current_user_ns(), CAP_SYS_CHROOT) ||
|
|
!ns_capable(current_user_ns(), CAP_SYS_ADMIN))
|
|
return -EPERM;
|
|
|
|
if (fs->users != 1)
|
|
return -EINVAL;
|
|
|
|
get_mnt_ns(mnt_ns);
|
|
old_mnt_ns = nsproxy->mnt_ns;
|
|
nsproxy->mnt_ns = mnt_ns;
|
|
|
|
/* Find the root */
|
|
err = vfs_path_lookup(mnt_ns->root->mnt.mnt_root, &mnt_ns->root->mnt,
|
|
"/", LOOKUP_DOWN, &root);
|
|
if (err) {
|
|
/* revert to old namespace */
|
|
nsproxy->mnt_ns = old_mnt_ns;
|
|
put_mnt_ns(mnt_ns);
|
|
return err;
|
|
}
|
|
|
|
put_mnt_ns(old_mnt_ns);
|
|
|
|
/* Update the pwd and root */
|
|
set_fs_pwd(fs, &root);
|
|
set_fs_root(fs, &root);
|
|
|
|
path_put(&root);
|
|
return 0;
|
|
}
|
|
|
|
static struct user_namespace *mntns_owner(struct ns_common *ns)
|
|
{
|
|
return to_mnt_ns(ns)->user_ns;
|
|
}
|
|
|
|
const struct proc_ns_operations mntns_operations = {
|
|
.name = "mnt",
|
|
.type = CLONE_NEWNS,
|
|
.get = mntns_get,
|
|
.put = mntns_put,
|
|
.install = mntns_install,
|
|
.owner = mntns_owner,
|
|
};
|