Linux 4.13.6
Greg KH
maintainerI'm announcing the release of the 4.13.6 kernel.
All users of the 4.13 kernel series must upgrade.
The updated 4.13.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.13.y
and can be browsed at the normal kernel.org git web browser:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Documentation/filesystems/overlayfs.txt | 5 Makefile | 2 arch/arm64/boot/dts/marvell/armada-ap806.dtsi | 4 arch/arm64/kernel/armv8_deprecated.c | 2 arch/arm64/kernel/cpufeature.c | 2 arch/powerpc/kernel/dt_cpu_ftrs.c | 4 arch/powerpc/kernel/exceptions-64s.S | 24 ++ arch/powerpc/kernel/signal_64.c | 13 + arch/powerpc/kvm/book3s_xive.c | 5 arch/powerpc/kvm/book3s_xive.h | 1 arch/powerpc/platforms/powernv/setup.c | 10 arch/x86/include/asm/kvm_para.h | 4 arch/x86/kernel/kvm.c | 14 - arch/x86/kvm/mmu.c | 2 arch/x86/net/bpf_jit_comp.c | 4 block/bsg-lib.c | 27 +- drivers/auxdisplay/charlcd.c | 11 - drivers/auxdisplay/panel.c | 11 - drivers/base/arch_topology.c | 14 - drivers/base/platform.c | 3 drivers/clk/samsung/clk-exynos4.c | 15 + drivers/gpu/drm/i915/intel_audio.c | 5 drivers/gpu/drm/i915/intel_bios.c | 7 drivers/gpu/drm/i915/intel_modes.c | 17 + drivers/hid/hid-rmi.c | 13 - drivers/hid/i2c-hid/i2c-hid.c | 3 drivers/hid/wacom_sys.c | 7 drivers/hid/wacom_wac.c | 110 ++++++++-- drivers/hv/channel_mgmt.c | 4 drivers/hv/hv_fcopy.c | 4 drivers/hwtracing/intel_th/pci.c | 5 drivers/hwtracing/stm/core.c | 2 drivers/iio/adc/ad7793.c | 4 drivers/iio/adc/ad_sigma_delta.c | 28 ++ drivers/iio/adc/mcp320x.c | 25 +- drivers/iio/adc/stm32-adc.c | 2 drivers/iio/adc/twl4030-madc.c | 10 drivers/iio/industrialio-core.c | 4 drivers/iio/pressure/bmp280-core.c | 2 drivers/iio/trigger/stm32-timer-trigger.c | 4 drivers/isdn/i4l/isdn_ppp.c | 37 ++- drivers/md/dm-core.h | 1 drivers/md/dm-crypt.c | 5 drivers/md/dm-ioctl.c | 37 ++- drivers/md/dm.c | 10 drivers/mmc/core/mmc.c | 36 +-- drivers/net/bonding/bond_main.c | 17 - drivers/net/bonding/bond_options.c | 3 drivers/net/dsa/mv88e6xxx/chip.c | 6 drivers/net/ethernet/ibm/emac/mal.c | 3 drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 3 drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 38 ++- drivers/net/ethernet/qualcomm/emac/emac-mac.c | 3 drivers/net/ethernet/realtek/8139too.c | 5 drivers/net/ethernet/rocker/rocker_tlv.h | 48 ++-- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 1 drivers/net/phy/xilinx_gmii2rgmii.c | 2 drivers/net/tun.c | 8 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 37 +-- drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h | 5 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 10 drivers/nvme/host/pci.c | 14 - drivers/scsi/scsi_scan.c | 3 drivers/scsi/sd.c | 35 ++- drivers/staging/iio/adc/ad7192.c | 4 drivers/staging/media/imx/imx-media-of.c | 2 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 6 drivers/usb/class/cdc-wdm.c | 4 drivers/usb/core/config.c | 16 + drivers/usb/core/devio.c | 11 - drivers/usb/core/hub.c | 2 drivers/usb/core/message.c | 4 drivers/usb/dwc3/ep0.c | 7 drivers/usb/gadget/function/f_mass_storage.c | 27 -- drivers/usb/gadget/function/f_mass_storage.h | 14 - drivers/usb/gadget/legacy/inode.c | 46 +++- drivers/usb/gadget/legacy/mass_storage.c | 26 -- drivers/usb/gadget/udc/atmel_usba_udc.c | 4 drivers/usb/gadget/udc/core.c | 3 drivers/usb/gadget/udc/dummy_hcd.c | 56 ++++- drivers/usb/gadget/udc/renesas_usb3.c | 19 + drivers/usb/host/pci-quirks.c | 10 drivers/usb/host/xhci-hub.c | 14 - drivers/usb/host/xhci-pci.c | 12 - drivers/usb/host/xhci-plat.c | 16 - drivers/usb/host/xhci.c | 3 drivers/usb/host/xhci.h | 10 drivers/usb/renesas_usbhs/fifo.c | 21 + drivers/usb/storage/transport.c | 14 + drivers/usb/storage/uas-detect.h | 15 - drivers/usb/storage/uas.c | 10 drivers/usb/storage/unusual_devs.h | 7 drivers/uwb/hwa-rc.c | 2 drivers/uwb/uwbd.c | 12 - fs/btrfs/ctree.h | 2 fs/btrfs/extent_io.c | 2 fs/overlayfs/copy_up.c | 6 fs/overlayfs/dir.c | 20 - fs/overlayfs/namei.c | 1 fs/overlayfs/overlayfs.h | 1 fs/overlayfs/ovl_entry.h | 3 fs/overlayfs/readdir.c | 6 fs/overlayfs/super.c | 27 +- fs/overlayfs/util.c | 24 ++ fs/userfaultfd.c | 66 +++++- fs/xattr.c | 2 include/asm-generic/percpu.h | 24 ++ include/linux/iio/adc/ad_sigma_delta.h | 3 include/linux/mmu_notifier.h | 5 include/linux/trace_events.h | 1 include/net/netlink.h | 73 +++++- include/net/protocol.h | 4 include/net/route.h | 4 include/net/sctp/ulpevent.h | 6 include/net/tcp.h | 2 include/net/udp.h | 2 include/scsi/scsi_device.h | 1 include/scsi/scsi_devinfo.h | 1 include/uapi/linux/bpf.h | 2 include/uapi/linux/dm-ioctl.h | 4 include/uapi/linux/usb/ch9.h | 1 kernel/bpf/core.c | 2 kernel/bpf/syscall.c | 6 kernel/bpf/verifier.c | 3 kernel/cgroup/cgroup.c | 8 kernel/events/core.c | 3 kernel/trace/ftrace.c | 14 - lib/ratelimit.c | 4 mm/ksm.c | 5 mm/madvise.c | 12 - mm/oom_kill.c | 16 + mm/rodata_test.c | 2 mm/swap.c | 4 mm/swap_state.c | 11 + net/core/dev.c | 1 net/core/filter.c | 12 - net/core/gen_estimator.c | 4 net/core/rtnetlink.c | 3 net/core/sock.c | 7 net/dsa/slave.c | 28 +- net/ipv4/ip_input.c | 25 +- net/ipv4/ip_vti.c | 3 net/ipv4/route.c | 46 ++-- net/ipv4/tcp_ipv4.c | 9 net/ipv4/tcp_output.c | 33 ++- net/ipv4/udp.c | 36 ++- net/ipv6/addrconf.c | 5 net/ipv6/ip6_gre.c | 22 +- net/ipv6/ip6_tunnel.c | 8 net/ipv6/ip6_vti.c | 3 net/ipv6/udp.c | 1 net/l2tp/l2tp_core.c | 10 net/l2tp/l2tp_core.h | 5 net/l2tp/l2tp_eth.c | 51 ---- net/netlink/af_netlink.c | 7 net/openvswitch/datapath.c | 3 net/packet/af_packet.c | 28 +- net/sched/act_api.c | 6 net/sched/cls_matchall.c | 1 net/sched/sch_generic.c | 1 net/tipc/msg.c | 2 net/wireless/nl80211.c | 14 + security/smack/smack_lsm.c | 55 ++--- sound/core/compress_offload.c | 3 sound/pci/echoaudio/echoaudio.c | 6 sound/usb/card.c | 20 + sound/usb/usx2y/usb_stream.c | 6 tools/testing/selftests/bpf/test_verifier.c | 16 + 168 files changed, 1389 insertions(+), 671 deletions(-)
Aaron Armstrong Skomra (1):
HID: wacom: leds: Don't try to control the EKR's read-only LEDs
Adam Wallis (1):
usb: host: xhci-plat: allow sysdev to inherit from ACPI
Adrian Salido (1):
HID: i2c-hid: allocate hid buffers for real worst case
Alan Stern (9):
USB: gadgetfs: Fix crash caused by inadequate synchronization
USB: gadgetfs: fix copy_to_user while holding spinlock
usb-storage: unusual_devs entry to fix write-access regression for Seagate external drives
usb-storage: fix bogus hardware error messages for ATA pass-thru devices
USB: dummy-hcd: fix connection failures (wrong speed)
USB: dummy-hcd: fix infinite-loop resubmission bug
USB: dummy-hcd: Fix erroneous synchronization change
USB: g_mass_storage: Fix deadlock when driver is unbound
USB: uas: fix bug in handling of alternate settings
Alexander Potapenko (1):
tun: bail out from tun_get_user() if the skb is empty
Alexander Shishkin (2):
intel_th: pci: Add Lewisburg PCH support
stm class: Fix a use-after-free
Alexandru Moise (1):
mm, hugetlb, soft_offline: save compound page order before page migration
Alexei Starovoitov (1):
bpf: fix bpf_tail_call() x64 JIT
Alexey Kodanev (1):
vti: fix use after free in vti_tunnel_xmit/vti6_tnl_xmit
Amir Goldstein (5):
ovl: fix error value printed in ovl_lookup_index()
ovl: fix dput() of ERR_PTR in ovl_cleanup_index()
ovl: fix dentry leak in ovl_indexdir_cleanup()
ovl: fix missing unlock_rename() in ovl_do_copy_up()
ovl: fix regression caused by exclusive upper/work dir protection
Andrea Arcangeli (1):
userfaultfd: non-cooperative: fix fork use after free
Andrew Lunn (1):
net: dsa: mv88e6xxx: Allow dsa and cpu ports in multiple vlans
Andrey Konovalov (2):
uwb: properly check kthread_run return value
uwb: ensure that endpoint is interrupt
Anton Blanchard (1):
powerpc/powernv: Increase memory block size to 1GB on radix
Arend Van Spriel (2):
brcmfmac: add length check in brcmf_cfg80211_escan_handler()
brcmfmac: setup passive scan if requested by user-space
Arkadi Sharshevsky (1):
mlxsw: spectrum: Fix EEPROM access in case of SFP/SFP+
Arnd Bergmann (3):
imx-media-of: avoid uninitialized variable warning
rocker: fix rocker_tlv_put_* functions for KASAN
netlink: fix nla_put_{u8,u16,u32} for KASAN
Baruch Siach (1):
arm64: dt marvell: Fix AP806 system controller size
Benjamin Block (1):
bsg-lib: fix use-after-free under memory-pressure
Bjørn Mork (1):
USB: cdc-wdm: ignore -EPIPE from GetEncapsulatedResponse
Boqun Feng (1):
kvm/x86: Avoid async PF preempting the kernel incorrectly
Casey Schaufler (1):
lsm: fix smack_inode_removexattr and xattr_getsecurity memleak
Chanho Min (1):
mmc: core: add driver strength selection when selecting hs400es
Christian Lamparter (1):
net: emac: Fix napi poll list corruption
Christoph Hellwig (1):
nvme-pci: Use PCI bus address for data/queues in CMB
Christoph Paasch (1):
net: Set sk_prot_creator when cloning sockets to the right proto
Christophe JAILLET (3):
openvswitch: Fix an error handling path in 'ovs_nla_init_match_and_action()'
iio: adc: twl4030: Fix an error handling path in 'twl4030_madc_probe()'
iio: adc: twl4030: Disable the vusb3v1 rugulator in the error handling path of 'twl4030_madc_probe()'
Christophe Leroy (1):
mm: fix RODATA_TEST failure "rodata_test: test data was not read only"
Colin Parker (1):
IIO: BME280: Updates to Humidity readings need ctrl_reg write!
Cyril Bur (1):
powerpc/64s: Use emergency stack for kernel TM Bad Thing program checks
Dan Carpenter (3):
sctp: potential read out of bounds in sctp_ulpevent_type_enabled()
USB: devio: Prevent integer overflow in proc_do_submiturb()
USB: devio: Don't corrupt user memory
Davide Caratti (1):
net/sched: cls_matchall: fix crash when used with classful qdisc
Dexuan Cui (1):
vmbus: don't acquire the mutex in vmbus_hvsock_device_unregister()
Dmitry Fleytman (1):
usb: Increase quirk delay for USB devices
Dragos Bogdan (2):
iio: ad_sigma_delta: Implement a dedicated reset function
iio: ad7793: Fix the serial interface reset
Edward Cree (2):
bpf/verifier: reject BPF_ALU64|BPF_END
net: change skb->mac_header when Generic XDP calls adjust_head
Eric Dumazet (7):
net_sched: gen_estimator: fix scaling error in bytes/packets samples
tcp: update skb->skb_mstamp more carefully
tcp: fix data delivery rate
8139too: revisit napi_complete_done() usage
bpf: do not disable/enable BH in bpf_map_free_id()
tcp: fastopen: fix on syn-data transmit failure
socket, bpf: fix possible use after free
Fabrice Gasnier (3):
iio: trigger: stm32-timer: preset shouldn't be buffered
iio: trigger: stm32-timer: fix a corner case to write preset
iio: adc: stm32: fix bad error check on max_channels
Fahad Kunnathadi (1):
net: phy: Fix mask value write on gmii2rgmii converter speed register
Felipe Balbi (1):
usb: dwc3: ep0: fix DMA starvation by assigning req->trb on ep0
Florian Fainelli (1):
net: dsa: Fix network device registration order
Goffredo Baroncelli (1):
btrfs: avoid overflow when sector_t is 32 bit
Greg Kroah-Hartman (3):
USB: core: harden cdc_parse_cdc_header
USB: fix out-of-bounds in usb_set_configuration Linux 4.13.6
Guillaume Nault (1):
l2tp: fix l2tp_eth module loading
Guneshwor Singh (1):
ALSA: compress: Remove unused variable
Gustavo Romero (1):
powerpc/tm: Fix illegal TM state in signal handler
Jani Nikula (2):
drm/i915: always update ELD connector type after get modes drm/i915/bios: ignore HDMI on port A
Jason A. Donenfeld (1):
netlink: do not proceed if dump's start() errs
Jason Gerecke (5):
HID: wacom: Properly report negative values from Intuos Pro 2 Bluetooth
HID: wacom: Correct coordinate system of touchring and pen twist
HID: wacom: generic: Send MSC_SERIAL and ABS_MISC when leaving prox
HID: wacom: generic: Clear ABS_MISC when tool leaves proximity
HID: wacom: Always increment hdev refcount within wacom_get_hdev_data
Jeffy Chen (1):
dm crypt: fix memory leak in crypt_ctr_cipher_old()
Jeremy Kerr (1):
powerpc: Fix action argument for cpufeatures-based TLB flush
Jim Dickerson (1):
usb: pci-quirks.c: Corrected timeout values used in handshake
Jiri Pirko (1):
net: sched: fix use-after-free in tcf_action_destroy and tcf_del_walker
Kai-Heng Feng (1):
Revert "xhci: Limit USB2 port wake support for AMD Promontory hosts"
Kirill Tkhai (1):
ksm: fix unlocked iteration over vmas in cmp_and_merge_page()
Konstantin Khlebnikov (1):
net_sched: always reset qdisc backlog in qdisc_reset()
Kosuke Tatsukawa (1):
net: bonding: Fix transmit load balancing in balance-alb mode if specified by sysfs
Lu Baolu (1):
usb: xhci: Free the right ring in xhci_add_endpoint()
Luca Coelho (1):
iwlwifi: mvm: use IWL_HCMD_NOCOPY for MCAST_FILTER_CMD
Lukas Wunner (2):
iio: adc: mcp320x: Fix readout of negative voltages
iio: adc: mcp320x: Fix oops on module unloadLyude (1):
HID: rmi: Make sure the HID device is opened on resume
Marek Szyprowski (1):
clk: samsung: exynos4: Enable VPLL and EPLL clocks for suspend/resume cycle
Mark Rutland (1):
percpu: make this_cpu_generic_read() atomic w.r.t. interrupts
Martin K. Petersen (2):
scsi: sd: Implement blacklist option for WRITE SAME w/ UNMAP
scsi: sd: Do not override max_sectors_kb sysfs setting
Mathias Nyman (4):
xhci: fix finding correct bus_state structure for USB 3.1 hosts
xhci: fix wrong endpoint ESIT value shown in tracing
xhci: Fix sleeping with spin_lock_irq() held in ASmedia 1042A workaround
xhci: set missing SuperSpeedPlus Link Protocol bit in roothub descriptor
Matt Fornero (1):
iio: core: Return error for failed read_reg
Meng Xu (1):
isdn/i4l: fetch the ppp_write buffer in one shot
Michal Hocko (1):
mm, oom_reaper: skip mm structs with mmu notifiers
Mike Manning (1):
net: ipv6: fix regression of no RTM_DELADDR sent after DAD failure
Mikulas Patocka (1):
dm ioctl: fix alignment of event number in the device list
Milan Broz (1):
dm crypt: reject sector_size feature if device length is not aligned to it
Nicolai Stange (1):
driver core: platform: Don't read past the end of "driver_override" buffer
Nicolas Ferre (1):
usb: gadget: udc: atmel: set vbus irqflags explicitly
Nikolay Aleksandrov (2):
net: bonding: fix tlb_dynamic_lb default value
net: rtnetlink: fix info leak in RTM_GETSTATS call
Olaf Hering (1):
Drivers: hv: fcopy: restore correct transfer length
Paolo Abeni (3):
IPv4: early demux can return an error code
udp: perform source validation for mcast early demux
udp: fix bcast packet reception
Parthasarathy Bhuvaragan (1):
tipc: use only positive error codes in messages
Peng Xu (1):
nl80211: Define policy for packet pattern attributes
Ping Cheng (1):
HID: wacom: bits shifted too much for 9th and 10th buttons
Roger Quadros (1):
usb: gadget: core: fix ->udc_set_speed() logic
Roi Dayan (1):
net/mlx5e: IPoIB, Fix access to invalid memory address
Sabrina Dubroca (1):
l2tp: fix race condition in l2tp_tunnel_delete
Sam Bobroff (1):
KVM: PPC: Book3S: Fix server always zero from kvmppc_xive_get_xive()
Sergey Senozhatsky (1):
lib/ratelimit.c: use deferred printk() version
Shaohua Li (2):
mm: avoid marking swap cached page as lazyfree
mm: fix data corruption caused by lazyfree page
Shu Wang (1):
ftrace: Fix kmemleak in unregister_ftrace_graph
Stefan Popa (1):
staging: iio: ad7192: Fix - use the dedicated reset function avoiding dma from stack.
Stefan Wahren (1):
staging: vchiq_2835_arm: Fix NULL ptr dereference in free_pagelist
Subash Abhinov Kasiviswanathan (1):
udpv6: Fix the checksum computation when HW checksum does not apply
Sudeep Holla (1):
base: arch_topology: fix section mismatch build warnings
Suzuki K Poulose (1):
arm64: Ensure the instruction emulation is ready for userspace
Takashi Iwai (2):
ALSA: usb-audio: Check out-of-bounds access by corrupted buffer descriptor
ALSA: usx2y: Suppress kernel warning at page allocation failures
Takashi Sakamoto (1):
Revert "ALSA: echoaudio: purge contradictions between dimension matrix members and total number of members"
Thomas Meyer (1):
net: stmmac: Cocci spatch "of_table"
Timur Tabi (1):
net: qcom/emac: specify the correct size when mapping a DMA buffer
Tsutomu Itoh (1):
Btrfs: fix overlap of fs_info::flags values
Vivien Didelot (1):
net: dsa: mv88e6xxx: lock mutex when freeing IRQs
Waiman Long (1):
cgroup: Reinit cgroup_taskset structure before cgroup_migrate_execute() returns
Willem de Bruijn (3):
packet: hold bind lock when rebinding to fanout hook
packet: in packet_do_bind, test fanout with bind_lock held
packet: only test po->has_vnet_hdr once in packet_snd
Willy Tarreau (1):
auxdisplay: charlcd: properly restore atomic counter on error path
Xin Long (4):
ip6_gre: skb_push ipv6hdr before packing the header in ip6gre_header
ip6_tunnel: do not allow loading ip6_tunnel if ipv6 is disabled in cmdline
ip6_gre: ip6gre_tap device should keep dst
ip6_tunnel: update mtu properly for ARPHRD_ETHER tunnel device in tx path
Yonghong Song (1):
bpf: one perf event close won't free bpf program attached by another perf event
Yoshihiro Shimoda (5):
usb: gadget: udc: renesas_usb3: fix for no-data control transfer
usb: gadget: udc: renesas_usb3: fix Pn_RAMMAP.Pn_MPKT value
usb: gadget: udc: renesas_usb3: Fix return value of usb3_write_pipe()
usb: renesas_usbhs: fix the BCLR setting condition for non-DCP pipe
usb: renesas_usbhs: fix usbhsf_fifo_clear() for RX direction
Yuval Mintz (1):
mlxsw: spectrum: Prevent mirred-related crash on removal
Greg KH
maintainerDocumentation/filesystems/overlayfs.txt +4 -1
@@ -210,8 +210,11 @@ path as another overlay mount and it may use a lower layer path that is beneath or above the path of another overlay lower layer path. Using an upper layer path and/or a workdir path that are already used by -another overlay mount is not allowed and will fail with EBUSY. Using +another overlay mount is not allowed and may fail with EBUSY. Using partially overlapping paths is not allowed but will not fail with EBUSY. +If files are accessed from two overlayfs mounts which share or overlap the +upper layer and/or workdir path the behavior of the overlay is undefined, +though it will not result in a crash or deadlock. Mounting an overlay using an upper layer path, where the upper layer path was previously used by another mounted overlay in combination with a
Makefile +1 -1
@@ -1,6 +1,6 @@ VERSION = 4 PATCHLEVEL = 13 -SUBLEVEL = 5 +SUBLEVEL = 6 EXTRAVERSION = NAME = Fearless Coyote
arch/arm64/boot/dts/marvell/armada-ap806.dtsi +2 -2
@@ -254,7 +254,7 @@ ap_syscon: system-controller@6f4000 { compatible = "syscon", "simple-mfd"; - reg = <0x6f4000 0x1000>; + reg = <0x6f4000 0x2000>; ap_clk: clock { compatible = "marvell,ap806-clock";
@@ -265,7 +265,7 @@ compatible = "marvell,ap806-pinctrl"; }; - ap_gpio: gpio { + ap_gpio: gpio@1040 { compatible = "marvell,armada-8k-gpio"; offset = <0x1040>; ngpios = <20>;
arch/arm64/kernel/armv8_deprecated.c +1 -1
@@ -649,4 +649,4 @@ static int __init armv8_deprecated_init(void)return 0 ; } -late_initcall (armv8_deprecated_init); +core_initcall (armv8_deprecated_init);
arch/arm64/kernel/cpufeature.c +1 -1
@@ -1294,4 +1294,4 @@ static int __init enable_mrs_emulation(void)return 0 ; } -late_initcall (enable_mrs_emulation); +core_initcall (enable_mrs_emulation);
arch/powerpc/kernel/dt_cpu_ftrs.c +2 -2
@@ -102,10 +102,10 @@ static void cpufeatures_flush_tlb(void)case PVR_POWER8 :case PVR_POWER8E :case PVR_POWER8NVL : -__flush_tlb_power8 (POWER8_TLB_SETS ); +__flush_tlb_power8 (TLB_INVAL_SCOPE_GLOBAL );break ;case PVR_POWER9 : -__flush_tlb_power9 (POWER9_TLB_SETS_HASH ); +__flush_tlb_power9 (TLB_INVAL_SCOPE_GLOBAL );break ;default :pr_err ("unknown CPU version for boot TLB flush\n" );
arch/powerpc/kernel/exceptions-64s.S +23 -1
@@ -734,7 +734,29 @@ EXC_REAL(program_check, 0x700, 0x100) EXC_VIRT(program_check, 0x4700, 0x100, 0x700) TRAMP_KVM(PACA_EXGEN, 0x700) EXC_COMMON_BEGIN(program_check_common) - EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN) + /* + * It's possible to receive a TM Bad Thing type program check with + * userspace register values (in particular r1), but with SRR1 reporting + * that we came from the kernel. Normally that would confuse the bad + * stack logic, and we would report a bad kernel stack pointer. Instead + * we switch to the emergency stack if we're taking a TM Bad Thing from + * the kernel. + */ + li r10,MSR_PR /* Build a mask of MSR_PR .. */ + oris r10,r10,0x200000@h /* .. and SRR1_PROGTM */ + and r10,r10,r12 /* Mask SRR1 with that. */ + srdi r10,r10,8 /* Shift it so we can compare */ + cmpldi r10,(0x200000 >> 8) /* .. with an immediate. */ + bne 1f /* If != go to normal path. */ + + /* SRR1 had PR=0 and SRR1_PROGTM=1, so use the emergency stack */ + andi. r10,r12,MSR_PR; /* Set CR0 correctly for label */ + /* 3 in EXCEPTION_PROLOG_COMMON */ + mr r10,r1 /* Save r1 */ + ld r1,PACAEMERGSP(r13) /* Use emergency stack */ + subi r1,r1,INT_FRAME_SIZE /* alloc stack frame */ + b 3f /* Jump into the macro !! */ +1: EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN) bl save_nvgprs RECONCILE_IRQ_STATE(r10, r11) addi r3,r1,STACK_FRAME_OVERHEAD
arch/powerpc/kernel/signal_64.c +12 -1
@@ -452,9 +452,20 @@ static long restore_tm_sigcontexts(struct task_struct *tsk,if (MSR_TM_RESV (msr))return -EINVAL ; -/* pull in MSR TM from user context */ +/* pull in MSR TS bits from user context */ regs->msr = (regs->msr & ~MSR_TS_MASK ) | (msr &MSR_TS_MASK ); +/* +* Ensure that TM is enabled in regs->msr before we leave the signal +* handler. It could be the case that (a) user disabled the TM bit +* through the manipulation of the MSR bits in uc_mcontext or (b) the +* TM bit was disabled because a sufficient number of context switches +* happened whilst in the signal handler and load_tm overflowed, +* disabling the TM bit. In either case we can end up with an illegal +* TM state leading to a TM Bad Thing when we return to userspace. +*/ + regs->msr |=MSR_TM ; +/* pull in MSR LE from user context */ regs->msr = (regs->msr & ~MSR_LE ) | (msr &MSR_LE );
arch/powerpc/kvm/book3s_xive.c +2 -3
@@ -622,7 +622,7 @@ int kvmppc_xive_get_xive(struct kvm *kvm, u32 irq, u32 *server,return -EINVAL ; state = &sb->irq_state[idx];arch_spin_lock (&sb->lock); - *server = state->guest_server; + *server = state->act_server; *priority = state->guest_priority;arch_spin_unlock (&sb->lock);
@@ -1331,7 +1331,7 @@ static int xive_get_source(struct kvmppc_xive *xive, long irq, u64 addr) xive->saved_src_count++;/* Convert saved state into something compatible with xics */ - val = state->guest_server; + val = state->act_server; prio = state->saved_scan_prio;if (prio ==MASKED ) {
@@ -1507,7 +1507,6 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr)/* First convert prio and mark interrupt as untargetted */ act_prio =xive_prio_from_guest (guest_prio); state->act_priority =MASKED ; - state->guest_server = server;/* * We need to drop the lock due to the mutex below. Hopefully
arch/powerpc/kvm/book3s_xive.h +0 -1
@@ -35,7 +35,6 @@ struct kvmppc_xive_irq_state {struct xive_irq_data *pt_data;/* XIVE Pass-through associated data */ /* Targetting as set by guest */ -u32 guest_server;/* Current guest selected target */ u8 guest_priority;/* Guest set priority */ u8 saved_priority;/* Saved priority when masking */
arch/powerpc/platforms/powernv/setup.c +9 -1
@@ -272,7 +272,15 @@ static void pnv_kexec_cpu_down(int crash_shutdown, int secondary)#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE static unsigned long pnv_memory_block_size (void ) { -return 256UL *1024 *1024 ; +/* +* We map the kernel linear region with 1GB large pages on radix. For +* memory hot unplug to work our memory block size must be at least +* this size. +*/ +if (radix_enabled ()) +return 1UL *1024 *1024 *1024 ; +else +return 256UL *1024 *1024 ; }#endif
arch/x86/include/asm/kvm_para.h +2 -2
@@ -88,7 +88,7 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,bool kvm_para_available (void );unsigned int kvm_arch_para_features (void );void __init kvm_guest_init (void ); -void kvm_async_pf_task_wait (u32 token); +void kvm_async_pf_task_wait (u32 token,int interrupt_kernel);void kvm_async_pf_task_wake (u32 token);u32 kvm_read_and_reset_pf_reason (void );extern void kvm_disable_steal_time (void );
@@ -103,7 +103,7 @@ static inline void kvm_spinlock_init(void)#else /* CONFIG_KVM_GUEST */ #define kvm_guest_init () do {} while (0) -#define kvm_async_pf_task_wait (T ) do {} while(0) +#define kvm_async_pf_task_wait (T ,I ) do {} while(0)#define kvm_async_pf_task_wake (T ) do {} while(0)static inline bool kvm_para_available (void )
arch/x86/kernel/kvm.c +10 -4
@@ -117,7 +117,11 @@ static struct kvm_task_sleep_node *_find_apf_task(struct kvm_task_sleep_head *b,return NULL ; } -void kvm_async_pf_task_wait (u32 token) +/* +* @interrupt_kernel: Is this called from a routine which interrupts the kernel +* (other than user space)? +*/ +void kvm_async_pf_task_wait (u32 token,int interrupt_kernel) {u32 key =hash_32 (token,KVM_TASK_SLEEP_HASHBITS );struct kvm_task_sleep_head *b = &async_pf_sleepers[key];
@@ -140,8 +144,10 @@ void kvm_async_pf_task_wait(u32 token) n.token = token; n.cpu =smp_processor_id (); - n.halted =is_idle_task (current) ||preempt_count () >1 || -rcu_preempt_depth (); + n.halted =is_idle_task (current) || + (IS_ENABLED (CONFIG_PREEMPT_COUNT ) + ?preempt_count () >1 ||rcu_preempt_depth () + : interrupt_kernel);init_swait_queue_head (&n.wq);hlist_add_head (&n.link, &b->list);raw_spin_unlock (&b->lock);
@@ -269,7 +275,7 @@ do_async_page_fault(struct pt_regs *regs, unsigned long error_code)case KVM_PV_REASON_PAGE_NOT_PRESENT :/* page is swapped out by the host. */ prev_state =exception_enter (); -kvm_async_pf_task_wait ((u32 )read_cr2 ()); +kvm_async_pf_task_wait ((u32 )read_cr2 (), !user_mode (regs));exception_exit (prev_state);break ;case KVM_PV_REASON_PAGE_READY :
arch/x86/kvm/mmu.c +1 -1
@@ -3799,7 +3799,7 @@ int kvm_handle_page_fault(struct kvm_vcpu *vcpu, u64 error_code,case KVM_PV_REASON_PAGE_NOT_PRESENT : vcpu->arch.apf.host_apf_reason =0 ;local_irq_disable (); -kvm_async_pf_task_wait (fault_address); +kvm_async_pf_task_wait (fault_address,0 );local_irq_enable ();break ;case KVM_PV_REASON_PAGE_READY :
arch/x86/net/bpf_jit_comp.c +2 -2
@@ -282,9 +282,9 @@ static void emit_bpf_tail_call(u8 **pprog)/* if (index >= array->map.max_entries) * goto out; */ -EMIT4 (0x48 ,0x8B ,0x46 ,/* mov rax, qword ptr [rsi + 16] */ +EMIT2 (0x89 ,0xD2 );/* mov edx, edx */ +EMIT3 (0x39 ,0x56 ,/* cmp dword ptr [rsi + 16], edx */ offsetof(struct bpf_array, map.max_entries)); -EMIT3 (0x48 ,0x39 ,0xD0 );/* cmp rax, rdx */ #define OFFSET1 47/* number of bytes to jump */ EMIT2 (X86_JBE ,OFFSET1 );/* jbe out */ label1 = cnt;
block/bsg-lib.c +21 -6
@@ -207,20 +207,34 @@ static int bsg_init_rq(struct request_queue *q, struct request *req, gfp_t gfp)struct bsg_job *job =blk_mq_rq_to_pdu (req);struct scsi_request *sreq = &job->sreq; +/* called right after the request is allocated for the request_queue */ + + sreq->sense =kzalloc (SCSI_SENSE_BUFFERSIZE , gfp); +if (!sreq->sense) +return -ENOMEM ; + +return 0 ; +} + +static void bsg_initialize_rq (struct request *req) +{ +struct bsg_job *job =blk_mq_rq_to_pdu (req); +struct scsi_request *sreq = &job->sreq; +void *sense = sreq->sense; + +/* called right before the request is given to the request_queue user */ +memset (job,0 ,sizeof (*job));scsi_req_init (sreq); + + sreq->sense = sense; sreq->sense_len =SCSI_SENSE_BUFFERSIZE ; - sreq->sense =kzalloc (sreq->sense_len, gfp); -if (!sreq->sense) -return -ENOMEM ; job->req = req; - job->reply = sreq->sense; + job->reply = sense; job->reply_len = sreq->sense_len; job->dd_data = job +1 ; - -return 0 ; }static void bsg_exit_rq (struct request_queue *q,struct request *req)
@@ -250,6 +264,7 @@ struct request_queue *bsg_setup_queue(struct device *dev, char *name, q->cmd_size =sizeof (struct bsg_job ) + dd_job_size; q->init_rq_fn = bsg_init_rq; q->exit_rq_fn = bsg_exit_rq; + q->initialize_rq_fn = bsg_initialize_rq; q->request_fn = bsg_request_fn; ret =blk_init_allocated_queue (q);
drivers/auxdisplay/charlcd.c +9 -2
@@ -647,18 +647,25 @@ static ssize_t charlcd_write(struct file *file, const char __user *buf,static int charlcd_open (struct inode *inode,struct file *file) {struct charlcd_priv *priv =to_priv (the_charlcd); +int ret; + ret = -EBUSY ;if (!atomic_dec_and_test (&charlcd_available)) -return -EBUSY ;/* open only once at a time */ + goto fail;/* open only once at a time */ + ret = -EPERM ;if (file->f_mode &FMODE_READ )/* device is write-only */ -return -EPERM ; + goto fail;if (priv->must_clear) {charlcd_clear_display (&priv->lcd); priv->must_clear = false; }return nonseekable_open (inode, file); + + fail: +atomic_inc (&charlcd_available); +return ret; }static int charlcd_release (struct inode *inode,struct file *file)
drivers/auxdisplay/panel.c +9 -2
@@ -1105,14 +1105,21 @@ static ssize_t keypad_read(struct file *file,static int keypad_open (struct inode *inode,struct file *file) { +int ret; + + ret = -EBUSY ;if (!atomic_dec_and_test (&keypad_available)) -return -EBUSY ;/* open only once at a time */ + goto fail;/* open only once at a time */ + ret = -EPERM ;if (file->f_mode &FMODE_WRITE )/* device is read-only */ -return -EPERM ; + goto fail; keypad_buflen =0 ;/* flush the buffer on opening */ return 0 ; + fail: +atomic_inc (&keypad_available); +return ret; }static int keypad_release (struct inode *inode,struct file *file)
drivers/base/arch_topology.c +7 -7
@@ -160,12 +160,12 @@ int __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) }#ifdef CONFIG_CPU_FREQ -static cpumask_var_t cpus_to_visit; -static bool cap_parsing_done; -static void parsing_done_workfn (struct work_struct *work); -static DECLARE_WORK(parsing_done_work, parsing_done_workfn); +static bool cap_parsing_done__initdata ; +static cpumask_var_t cpus_to_visit__initdata ; +static void __init parsing_done_workfn (struct work_struct *work); +static __initdata DECLARE_WORK(parsing_done_work, parsing_done_workfn); -static int +static int __init init_cpu_capacity_callback (struct notifier_block *nb,unsigned long val,void *data)
@@ -200,7 +200,7 @@ init_cpu_capacity_callback(struct notifier_block *nb,return 0 ; } -static struct notifier_block init_cpu_capacity_notifier = { +static struct notifier_block init_cpu_capacity_notifier__initdata = { .notifier_call = init_cpu_capacity_callback, };
@@ -226,7 +226,7 @@ static int __init register_cpufreq_notifier(void) }core_initcall (register_cpufreq_notifier); -static void parsing_done_workfn (struct work_struct *work) +static void __init parsing_done_workfn (struct work_struct *work) {cpufreq_unregister_notifier (&init_cpu_capacity_notifier,CPUFREQ_POLICY_NOTIFIER );
drivers/base/platform.c +2 -1
@@ -868,7 +868,8 @@ static ssize_t driver_override_store(struct device *dev,struct platform_device *pdev =to_platform_device (dev);char *driver_override, *old, *cp; -if (count >PATH_MAX ) +/* We need to keep extra room for a newline */ +if (count >= (PAGE_SIZE -1 ))return -EINVAL ; driver_override =kstrndup (buf, count,GFP_KERNEL );
drivers/clk/samsung/clk-exynos4.c +15 -0
@@ -294,6 +294,18 @@ static const struct samsung_clk_reg_dump src_mask_suspend_e4210[] = {#define PLL_ENABLED (1 << 31)#define PLL_LOCKED (1 << 29) +static void exynos4_clk_enable_pll (u32 reg) +{ +u32 pll_con =readl (reg_base + reg); + pll_con |=PLL_ENABLED ; +writel (pll_con, reg_base + reg); + +while (!(pll_con &PLL_LOCKED )) { +cpu_relax (); + pll_con =readl (reg_base + reg); + } +} +static void exynos4_clk_wait_for_pll (u32 reg) {u32 pll_con;
@@ -315,6 +327,9 @@ static int exynos4_clk_suspend(void)samsung_clk_save (reg_base, exynos4_save_pll,ARRAY_SIZE (exynos4_clk_pll_regs)); +exynos4_clk_enable_pll (EPLL_CON0 ); +exynos4_clk_enable_pll (VPLL_CON0 ); +if (exynos4_soc ==EXYNOS4210 ) {samsung_clk_save (reg_base, exynos4_save_soc,ARRAY_SIZE (exynos4210_clk_save));
drivers/gpu/drm/i915/intel_audio.c +0 -5
@@ -606,11 +606,6 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder, connector->encoder->base.id, connector->encoder->name); -/* ELD Conn_Type */ - connector->eld[5 ] &= ~(3 <<2 ); -if (intel_crtc_has_dp_encoder (crtc_state)) - connector->eld[5 ] |= (1 <<2 ); - connector->eld[6 ] =drm_av_sync_delay (connector, adjusted_mode) /2 ;if (dev_priv->display.audio_codec_enable)
drivers/gpu/drm/i915/intel_bios.c +7 -0
@@ -1163,6 +1163,13 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port, is_hdmi = is_dvi && (child->common.device_type &DEVICE_TYPE_NOT_HDMI_OUTPUT ) ==0 ; is_edp = is_dp && (child->common.device_type &DEVICE_TYPE_INTERNAL_CONNECTOR ); +if (port ==PORT_A && is_dvi) { +DRM_DEBUG_KMS ("VBT claims port A supports DVI%s, ignoring\n" , + is_hdmi ?"/HDMI" :"" ); + is_dvi = false; + is_hdmi = false; + } + info->supports_dvi = is_dvi; info->supports_hdmi = is_hdmi; info->supports_dp = is_dp;
drivers/gpu/drm/i915/intel_modes.c +17 -0
@@ -30,6 +30,21 @@#include "intel_drv.h" #include "i915_drv.h" +static void intel_connector_update_eld_conn_type (struct drm_connector *connector) +{ +u8 conn_type; + +if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort || + connector->connector_type == DRM_MODE_CONNECTOR_eDP) { + conn_type =DRM_ELD_CONN_TYPE_DP ; + }else { + conn_type =DRM_ELD_CONN_TYPE_HDMI ; + } + + connector->eld[DRM_ELD_SAD_COUNT_CONN_TYPE ] &= ~DRM_ELD_CONN_TYPE_MASK ; + connector->eld[DRM_ELD_SAD_COUNT_CONN_TYPE ] |= conn_type; +} +/** * intel_connector_update_modes - update connector from edid * @connector: DRM connector device to use
@@ -44,6 +59,8 @@ int intel_connector_update_modes(struct drm_connector *connector, ret =drm_add_edid_modes (connector, edid);drm_edid_to_eld (connector, edid); +intel_connector_update_eld_conn_type (connector); +return ret; }
drivers/hid/hid-rmi.c +10 -3
@@ -436,17 +436,24 @@ static int rmi_post_resume(struct hid_device *hdev)if (!(data->device_flags &RMI_DEVICE ))return 0 ; - ret =rmi_reset_attn_mode (hdev); +/* Make sure the HID device is ready to receive events */ + ret =hid_hw_open (hdev);if (ret)return ret; + ret =rmi_reset_attn_mode (hdev); +if (ret) + goto out; + ret =rmi_driver_resume (rmi_dev, false);if (ret) {hid_warn (hdev,"Failed to resume device: %d\n" , ret); -return ret; + goto out; } - return 0; +out: +hid_hw_close (hdev); + return ret; }#endif /* CONFIG_PM */
drivers/hid/i2c-hid/i2c-hid.c +2 -1
@@ -543,7 +543,8 @@ static int i2c_hid_alloc_buffers(struct i2c_hid *ihid, size_t report_size) {/* the worst case is computed from the set_report command with a * reportID > 15 and the maximum report length */ -int args_len =sizeof (__u8) +/* optional ReportID byte */ +int args_len =sizeof (__u8) +/* ReportID */ +sizeof (__u8) +/* optional ReportID byte */ sizeof (__u16) +/* data register */ sizeof (__u16) +/* size of the report */ report_size;/* report */
drivers/hid/wacom_sys.c +6 -1
@@ -668,8 +668,10 @@ static struct wacom_hdev_data *wacom_get_hdev_data(struct hid_device *hdev)/* Try to find an already-probed interface from the same device */ list_for_each_entry (data, &wacom_udev_list, list) { -if (compare_device_paths (hdev, data->dev,'/' )) +if (compare_device_paths (hdev, data->dev,'/' )) { +kref_get (&data->kref);return data; + } }/* Fallback to finding devices that appear to be "siblings" */
@@ -766,6 +768,9 @@ static int wacom_led_control(struct wacom *wacom)if (!wacom->led.groups)return -ENOTSUPP ; +if (wacom->wacom_wac.features.type ==REMOTE ) +return -ENOTSUPP ; +if (wacom->wacom_wac.pid) {/* wireless connected */ report_id =WAC_CMD_WL_LED_CONTROL ; buf_size =13 ;
drivers/hid/wacom_wac.c +89 -21
183 lines not on this page · raw message
drivers/hv/channel_mgmt.c +0 -4
@@ -922,14 +922,10 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr)void vmbus_hvsock_device_unregister (struct vmbus_channel *channel) { -mutex_lock (&vmbus_connection.channel_mutex); -BUG_ON (!is_hvsock_channel (channel)); channel->rescind = true;vmbus_device_unregister (channel->device_obj); - -mutex_unlock (&vmbus_connection.channel_mutex); }EXPORT_SYMBOL_GPL (vmbus_hvsock_device_unregister);
drivers/hv/hv_fcopy.c +4 -0
@@ -170,6 +170,10 @@ static void fcopy_send_data(struct work_struct *dummy) out_src = smsg_out;break ; +case WRITE_TO_FILE : + out_src = fcopy_transaction.fcopy_msg; + out_len =sizeof (struct hv_do_fcopy ); +break ;default : out_src = fcopy_transaction.fcopy_msg; out_len = fcopy_transaction.recv_len;
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -90,6 +90,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x19e1), .driver_data = (kernel_ulong_t )0 , }, + { +/* Lewisburg PCH */ +PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0xa1a6 ), + .driver_data = (kernel_ulong_t)0, + }, {/* Gemini Lake */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x318e),
drivers/hwtracing/stm/core.c +1 -1
@@ -1119,7 +1119,7 @@ void stm_source_unregister_device(struct stm_source_data *data)stm_source_link_drop (src); -device_destroy (&stm_source_class, src->dev.devt); +device_unregister (&src->dev); }EXPORT_SYMBOL_GPL (stm_source_unregister_device);
drivers/iio/adc/ad7793.c +2 -2
@@ -257,7 +257,7 @@ static int ad7793_setup(struct iio_dev *indio_dev, unsigned int vref_mv) {struct ad7793_state *st =iio_priv (indio_dev); -int i, ret =-1 ; +int i, ret;unsigned long long scale_uv;u32 id;
@@ -266,7 +266,7 @@ static int ad7793_setup(struct iio_dev *indio_dev,return ret;/* reset the serial interface */ - ret =spi_write (st->sd.spi, (u8 *)&ret,sizeof (ret)); + ret =ad_sd_reset (&st->sd,32 );if (ret <0 ) goto out;usleep_range (500 ,2000 );/* Wait for at least 500us */
drivers/iio/adc/ad_sigma_delta.c +28 -0
@@ -177,6 +177,34 @@ int ad_sd_read_reg(struct ad_sigma_delta *sigma_delta, }EXPORT_SYMBOL_GPL (ad_sd_read_reg); +/** +* ad_sd_reset() - Reset the serial interface +* +* @sigma_delta: The sigma delta device +* @reset_length: Number of SCLKs with DIN = 1 +* +* Returns 0 on success, an error code otherwise. +**/ +int ad_sd_reset (struct ad_sigma_delta *sigma_delta, +unsigned int reset_length) +{ +uint8_t *buf; +unsigned int size; +int ret; + + size =DIV_ROUND_UP (reset_length,8 ); + buf =kcalloc (size,sizeof (*buf),GFP_KERNEL ); +if (!buf) +return -ENOMEM ; + +memset (buf,0xff , size); + ret =spi_write (sigma_delta->spi, buf, size); +kfree (buf); + +return ret; +} +EXPORT_SYMBOL_GPL (ad_sd_reset); +static int ad_sd_calibrate (struct ad_sigma_delta *sigma_delta,unsigned int mode,unsigned int channel) {
drivers/iio/adc/mcp320x.c +16 -9
@@ -17,6 +17,8 @@* MCP3204 * MCP3208 * ------------ +* 13 bit converter +* MCP3301 * * Datasheet can be found here: * http://ww1.microchip.com/downloads/en/DeviceDoc/21293C.pdf mcp3001
@@ -96,7 +98,7 @@ static int mcp320x_channel_to_tx_data(int device_index, }static int mcp320x_adc_conversion (struct mcp320x *adc,u8 channel, -bool differential,int device_index) +bool differential,int device_index,int *val) {int ret;
@@ -117,19 +119,25 @@ static int mcp320x_adc_conversion(struct mcp320x *adc, u8 channel,switch (device_index) {case mcp3001: -return (adc->rx_buf[0 ] <<5 | adc->rx_buf[1 ] >>3 ); + *val = (adc->rx_buf[0 ] <<5 | adc->rx_buf[1 ] >>3 ); +return 0 ;case mcp3002:case mcp3004:case mcp3008: -return (adc->rx_buf[0 ] <<2 | adc->rx_buf[1 ] >>6 ); + *val = (adc->rx_buf[0 ] <<2 | adc->rx_buf[1 ] >>6 ); +return 0 ;case mcp3201: -return (adc->rx_buf[0 ] <<7 | adc->rx_buf[1 ] >>1 ); + *val = (adc->rx_buf[0 ] <<7 | adc->rx_buf[1 ] >>1 ); +return 0 ;case mcp3202:case mcp3204:case mcp3208: -return (adc->rx_buf[0 ] <<4 | adc->rx_buf[1 ] >>4 ); + *val = (adc->rx_buf[0 ] <<4 | adc->rx_buf[1 ] >>4 ); +return 0 ;case mcp3301: -return sign_extend32 ((adc->rx_buf[0 ] &0x1f ) <<8 | adc->rx_buf[1 ],12 ); + *val =sign_extend32 ((adc->rx_buf[0 ] &0x1f ) <<8 + | adc->rx_buf[1 ],12 ); +return 0 ;default :return -EINVAL ; }
@@ -150,12 +158,10 @@ static int mcp320x_read_raw(struct iio_dev *indio_dev,switch (mask) {case IIO_CHAN_INFO_RAW : ret =mcp320x_adc_conversion (adc, channel->address, - channel->differential, device_index); - + channel->differential, device_index, val);if (ret <0 ) goto out; - *val = ret; ret =IIO_VAL_INT ;break ;
@@ -312,6 +318,7 @@ static int mcp320x_probe(struct spi_device *spi) indio_dev->name =spi_get_device_id (spi)->name; indio_dev->modes =INDIO_DIRECT_MODE ; indio_dev->info = &mcp320x_info; +spi_set_drvdata (spi, indio_dev); chip_info = &mcp320x_chip_infos[spi_get_device_id (spi)->driver_data]; indio_dev->channels = chip_info->channels;
drivers/iio/adc/stm32-adc.c +1 -1
@@ -1543,7 +1543,7 @@ static int stm32_adc_chan_of_init(struct iio_dev *indio_dev) num_channels =of_property_count_u32_elems (node,"st,adc-channels" );if (num_channels <0 || - num_channels >= adc_info->max_channels) { + num_channels > adc_info->max_channels) {dev_err (&indio_dev->dev,"Bad st,adc-channels?\n" );return num_channels <0 ? num_channels : -EINVAL ; }
drivers/iio/adc/twl4030-madc.c +7 -3
@@ -887,8 +887,10 @@ static int twl4030_madc_probe(struct platform_device *pdev)/* Enable 3v1 bias regulator for MADC[3:6] */ madc->usb3v1 =devm_regulator_get (madc->dev,"vusb3v1" ); -if (IS_ERR (madc->usb3v1)) -return -ENODEV ; +if (IS_ERR (madc->usb3v1)) { + ret = -ENODEV ; + goto err_i2c; + } ret =regulator_enable (madc->usb3v1);if (ret)
@@ -897,11 +899,13 @@ static int twl4030_madc_probe(struct platform_device *pdev) ret =iio_device_register (iio_dev);if (ret) {dev_err (&pdev->dev,"could not register iio device\n" ); - goto err_i2c; + goto err_usb3v1; }return 0 ; +err_usb3v1: +regulator_disable (madc->usb3v1); err_i2c:twl4030_madc_set_current_generator (madc,0 ,0 ); err_current_generator:
drivers/iio/industrialio-core.c +3 -1
@@ -310,8 +310,10 @@ static ssize_t iio_debugfs_read_reg(struct file *file, char __user *userbuf, ret = indio_dev->info->debugfs_reg_access (indio_dev, indio_dev->cached_reg_addr,0 , &val); -if (ret) +if (ret) {dev_err (indio_dev->dev.parent,"%s: read failed\n" , __func__); +return ret; + } len =snprintf (buf,sizeof (buf),"0x%X\n" , val);
drivers/iio/pressure/bmp280-core.c +1 -1
@@ -573,7 +573,7 @@ static int bmp280_chip_config(struct bmp280_data *data)u8 osrs =BMP280_OSRS_TEMP_X (data->oversampling_temp +1 ) |BMP280_OSRS_PRESS_X (data->oversampling_press +1 ); - ret = regmap_update_bits(data->regmap, BMP280_REG_CTRL_MEAS, + ret = regmap_write_bits(data->regmap, BMP280_REG_CTRL_MEAS, BMP280_OSRS_TEMP_MASK | BMP280_OSRS_PRESS_MASK | BMP280_MODE_MASK,
drivers/iio/trigger/stm32-timer-trigger.c +3 -1
@@ -138,6 +138,7 @@ static void stm32_timer_stop(struct stm32_timer_trigger *priv)clk_disable (priv->clk);/* Stop timer */ +regmap_update_bits (priv->regmap,TIM_CR1 ,TIM_CR1_ARPE ,0 );regmap_update_bits (priv->regmap,TIM_CR1 ,TIM_CR1_CEN ,0 );regmap_write (priv->regmap,TIM_PSC ,0 );regmap_write (priv->regmap,TIM_ARR ,0 );
@@ -679,8 +680,9 @@ static ssize_t stm32_count_set_preset(struct iio_dev *indio_dev,if (ret)return ret; +/* TIMx_ARR register shouldn't be buffered (ARPE=0) */ +regmap_update_bits (priv->regmap,TIM_CR1 ,TIM_CR1_ARPE ,0 );regmap_write (priv->regmap,TIM_ARR , preset); -regmap_update_bits (priv->regmap,TIM_CR1 ,TIM_CR1_ARPE ,TIM_CR1_ARPE );return len; }
drivers/isdn/i4l/isdn_ppp.c +25 -12
@@ -825,7 +825,6 @@ isdn_ppp_write(int min, struct file *file, const char __user *buf, int count)isdn_net_local *lp;struct ippp_struct *is;int proto; -unsigned char protobuf[4 ]; is = file->private_data;
@@ -839,24 +838,28 @@ isdn_ppp_write(int min, struct file *file, const char __user *buf, int count)if (!lp)printk (KERN_DEBUG "isdn_ppp_write: lp == NULL\n" );else { -/* -* Don't reset huptimer for -* LCP packets. (Echo requests). -*/ -if (copy_from_user (protobuf, buf,4 )) -return -EFAULT ; - proto =PPP_PROTOCOL (protobuf); -if (proto !=PPP_LCP ) - lp->huptimer =0 ; +if (lp->isdn_device <0 || lp->isdn_channel <0 ) { +unsigned char protobuf[4 ]; +/* +* Don't reset huptimer for +* LCP packets. (Echo requests). +*/ +if (copy_from_user (protobuf, buf,4 )) +return -EFAULT ; + + proto =PPP_PROTOCOL (protobuf); +if (proto !=PPP_LCP ) + lp->huptimer =0 ; -if (lp->isdn_device <0 || lp->isdn_channel <0 )return 0 ; + }if ((dev->drv[lp->isdn_device]->flags &DRV_FLAG_RUNNING ) && lp->dialstate ==0 && (lp->flags &ISDN_NET_CONNECTED )) {unsigned short hl;struct sk_buff *skb; +unsigned char *cpy_buf;/* * we need to reserve enough space in front of * sk_buff. old call to dev_alloc_skb only reserved
@@ -869,11 +872,21 @@ isdn_ppp_write(int min, struct file *file, const char __user *buf, int count)return count; }skb_reserve (skb, hl); -if (copy_from_user (skb_put (skb, count), buf, count)) + cpy_buf =skb_put (skb, count); +if (copy_from_user (cpy_buf, buf, count)) {kfree_skb (skb);return -EFAULT ; } + +/* +* Don't reset huptimer for +* LCP packets. (Echo requests). +*/ + proto =PPP_PROTOCOL (cpy_buf); +if (proto !=PPP_LCP ) + lp->huptimer =0 ; +if (is->debug &0x40 ) {printk (KERN_DEBUG "ppp xmit: len %d\n" , (int ) skb->len);isdn_ppp_frame_log ("xmit" , skb->data, skb->len,32 , is->unit, lp->ppp_slot);
drivers/md/dm-core.h +1 -0
@@ -149,5 +149,6 @@ static inline bool dm_message_test_buffer_overflow(char *result, unsigned maxlenextern atomic_t dm_global_event_nr;extern wait_queue_head_t dm_global_eventq; +void dm_issue_global_event (void );#endif
drivers/md/dm-crypt.c +5 -0
@@ -2470,6 +2470,7 @@ static int crypt_ctr_cipher_old(struct dm_target *ti, char *cipher_in, char *keykfree (cipher_api);return ret; } +kfree (cipher_api);return 0 ; bad_mem:
@@ -2588,6 +2589,10 @@ static int crypt_ctr_optional(struct dm_target *ti, unsigned int argc, char **ar ti->error ="Invalid feature value for sector_size" ;return -EINVAL ; } +if (ti->len & ((cc->sector_size >>SECTOR_SHIFT ) -1 )) { + ti->error ="Device size is not multiple of sector_size feature" ; +return -EINVAL ; + } cc->sector_shift =__ffs (cc->sector_size) -SECTOR_SHIFT ; }else if (!strcasecmp (opt_string,"iv_large_sectors" ))set_bit (CRYPT_IV_LARGE_SECTORS , &cc->cipher_flags);
drivers/md/dm-ioctl.c +24 -13
@@ -477,9 +477,13 @@ static int remove_all(struct file *filp, struct dm_ioctl *param, size_t param_si* Round up the ptr to an 8-byte boundary. */ #define ALIGN_MASK 7 +static inline size_t align_val (size_t val) +{ +return (val +ALIGN_MASK ) & ~ALIGN_MASK ; +}static inline void *align_ptr (void *ptr) { -return (void *) (((size_t ) (ptr +ALIGN_MASK )) & ~ALIGN_MASK ); +return (void *)align_val ((size_t )ptr); }/*
@@ -505,7 +509,7 @@ static int list_devices(struct file *filp, struct dm_ioctl *param, size_t param_struct hash_cell *hc;size_t len, needed =0 ;struct gendisk *disk; -struct dm_name_list *nl, *old_nl =NULL ; +struct dm_name_list *orig_nl, *nl, *old_nl =NULL ;uint32_t *event_nr;down_write (&_hash_lock);
@@ -516,17 +520,15 @@ static int list_devices(struct file *filp, struct dm_ioctl *param, size_t param_*/ for (i =0 ; i <NUM_BUCKETS ; i++) { list_for_each_entry (hc, _name_buckets + i, name_list) { - needed +=sizeof (struct dm_name_list ); - needed +=strlen (hc->name) +1 ; - needed +=ALIGN_MASK ; - needed += (sizeof (uint32_t ) +ALIGN_MASK ) & ~ALIGN_MASK ; + needed +=align_val (offsetof(struct dm_name_list , name) +strlen (hc->name) +1 ); + needed +=align_val (sizeof (uint32_t )); } }/* * Grab our output buffer. */ - nl =get_result_buffer (param, param_size, &len); + nl = orig_nl =get_result_buffer (param, param_size, &len);if (len < needed) { param->flags |=DM_BUFFER_FULL_FLAG ; goto out;
@@ -549,11 +551,16 @@ static int list_devices(struct file *filp, struct dm_ioctl *param, size_t param_strcpy (nl->name, hc->name); old_nl = nl; - event_nr =align_ptr (((void *) (nl +1 )) +strlen (hc->name) +1 ); + event_nr =align_ptr (nl->name +strlen (hc->name) +1 ); *event_nr =dm_get_event_nr (hc->md); nl =align_ptr (event_nr +1 ); } } +/* +* If mismatch happens, security may be compromised due to buffer +* overflow, so it's better to crash. +*/ +BUG_ON ((char *)nl - (char *)orig_nl != needed); out:up_write (&_hash_lock);
@@ -1621,7 +1628,8 @@ static int target_message(struct file *filp, struct dm_ioctl *param, size_t para* which has a variable size, is not used by the function processing * the ioctl. */ -#define IOCTL_FLAGS_NO_PARAMS 1 +#define IOCTL_FLAGS_NO_PARAMS 1 +#define IOCTL_FLAGS_ISSUE_GLOBAL_EVENT 2/*----------------------------------------------------------------- * Implementation of open/close/ioctl on the special char
@@ -1635,12 +1643,12 @@ static ioctl_fn lookup_ioctl(unsigned int cmd, int *ioctl_flags)ioctl_fn fn; } _ioctls[] = { {DM_VERSION_CMD, 0, NULL}, /* version is dealt with elsewhere */ - {DM_REMOVE_ALL_CMD, IOCTL_FLAGS_NO_PARAMS, remove_all}, + {DM_REMOVE_ALL_CMD, IOCTL_FLAGS_NO_PARAMS | IOCTL_FLAGS_ISSUE_GLOBAL_EVENT, remove_all}, {DM_LIST_DEVICES_CMD, 0, list_devices}, - {DM_DEV_CREATE_CMD, IOCTL_FLAGS_NO_PARAMS, dev_create}, - {DM_DEV_REMOVE_CMD, IOCTL_FLAGS_NO_PARAMS, dev_remove}, - {DM_DEV_RENAME_CMD, 0, dev_rename}, + {DM_DEV_CREATE_CMD, IOCTL_FLAGS_NO_PARAMS | IOCTL_FLAGS_ISSUE_GLOBAL_EVENT, dev_create}, + {DM_DEV_REMOVE_CMD, IOCTL_FLAGS_NO_PARAMS | IOCTL_FLAGS_ISSUE_GLOBAL_EVENT, dev_remove}, + {DM_DEV_RENAME_CMD, IOCTL_FLAGS_ISSUE_GLOBAL_EVENT, dev_rename}, {DM_DEV_SUSPEND_CMD, IOCTL_FLAGS_NO_PARAMS, dev_suspend}, {DM_DEV_STATUS_CMD, IOCTL_FLAGS_NO_PARAMS, dev_status}, {DM_DEV_WAIT_CMD, 0, dev_wait},
@@ -1869,6 +1877,9 @@ static int ctl_ioctl(struct file *file, uint command, struct dm_ioctl __user *us unlikely(ioctl_flags & IOCTL_FLAGS_NO_PARAMS))DMERR ("ioctl %d tried to output some data but has IOCTL_FLAGS_NO_PARAMS set" , cmd); +if (!r && ioctl_flags &IOCTL_FLAGS_ISSUE_GLOBAL_EVENT ) +dm_issue_global_event (); +/* * Copy the results back to userland. */
drivers/md/dm.c +8 -2
@@ -52,6 +52,12 @@ static struct workqueue_struct *deferred_remove_workqueue;atomic_t dm_global_event_nr =ATOMIC_INIT (0 );DECLARE_WAIT_QUEUE_HEAD (dm_global_eventq); +void dm_issue_global_event (void ) +{ +atomic_inc (&dm_global_event_nr); +wake_up (&dm_global_eventq); +} +/* * One of these is allocated per bio. */
@@ -1865,9 +1871,8 @@ static void event_callback(void *context)dm_send_uevents (&uevents, &disk_to_dev (md->disk)->kobj);atomic_inc (&md->event_nr); -atomic_inc (&dm_global_event_nr);wake_up (&md->eventq); -wake_up (&dm_global_eventq); +dm_issue_global_event (); }/*
@@ -2283,6 +2288,7 @@ struct dm_table *dm_swap_table(struct mapped_device *md, struct dm_table *table) } map =__bind (md, table, &limits); +dm_issue_global_event (); out:mutex_unlock (&md->suspend_lock);
drivers/mmc/core/mmc.c +19 -17
@@ -1286,6 +1286,23 @@ int mmc_hs400_to_hs200(struct mmc_card *card)return err; } +static void mmc_select_driver_type (struct mmc_card *card) +{ +int card_drv_type, drive_strength, drv_type; + + card_drv_type = card->ext_csd.raw_driver_strength | +mmc_driver_type_mask (0 ); + + drive_strength =mmc_select_drive_strength (card, + card->ext_csd.hs200_max_dtr, + card_drv_type, &drv_type); + + card->drive_strength = drive_strength; + +if (drv_type) +mmc_set_driver_type (card->host, drv_type); +} +static int mmc_select_hs400es (struct mmc_card *card) {struct mmc_host *host = card->host;
@@ -1341,6 +1358,8 @@ static int mmc_select_hs400es(struct mmc_card *card) goto out_err; } +mmc_select_driver_type (card); +/* Switch card to HS400 */ val =EXT_CSD_TIMING_HS400 | card->drive_strength <<EXT_CSD_DRV_STR_SHIFT ;
@@ -1374,23 +1393,6 @@ static int mmc_select_hs400es(struct mmc_card *card)return err; } -static void mmc_select_driver_type (struct mmc_card *card) -{ -int card_drv_type, drive_strength, drv_type; - - card_drv_type = card->ext_csd.raw_driver_strength | -mmc_driver_type_mask (0 ); - - drive_strength =mmc_select_drive_strength (card, - card->ext_csd.hs200_max_dtr, - card_drv_type, &drv_type); - - card->drive_strength = drive_strength; - -if (drv_type) -mmc_set_driver_type (card->host, drv_type); -} -/* * For device supporting HS200 mode, the following sequence * should be done before executing the tuning process.
drivers/net/bonding/bond_main.c +7 -10
@@ -4289,7 +4289,7 @@ static int bond_check_params(struct bond_params *params)int bond_mode =BOND_MODE_ROUNDROBIN ;int xmit_hashtype =BOND_XMIT_POLICY_LAYER2 ;int lacp_fast =0 ; -int tlb_dynamic_lb =0 ; +int tlb_dynamic_lb;/* Convert string parameters. */ if (mode) {
@@ -4601,16 +4601,13 @@ static int bond_check_params(struct bond_params *params) } ad_user_port_key = valptr->value; -if ((bond_mode ==BOND_MODE_TLB ) || (bond_mode ==BOND_MODE_ALB )) { -bond_opt_initstr (&newval,"default" ); - valptr =bond_opt_parse (bond_opt_get (BOND_OPT_TLB_DYNAMIC_LB ), - &newval); -if (!valptr) { -pr_err ("Error: No tlb_dynamic_lb default value" ); -return -EINVAL ; - } - tlb_dynamic_lb = valptr->value; +bond_opt_initstr (&newval,"default" ); + valptr =bond_opt_parse (bond_opt_get (BOND_OPT_TLB_DYNAMIC_LB ), &newval); +if (!valptr) { +pr_err ("Error: No tlb_dynamic_lb default value" ); +return -EINVAL ; } + tlb_dynamic_lb = valptr->value;if (lp_interval ==0 ) { pr_warn("Warning: ip_interval must be between 1 and %d, so it was reset to %d\n",
drivers/net/bonding/bond_options.c +3 -0
@@ -754,6 +754,9 @@ static int bond_option_mode_set(struct bonding *bond, bond->params.miimon); } +if (newval->value ==BOND_MODE_ALB ) + bond->params.tlb_dynamic_lb =1 ; +/* don't cache arp_validate between modes */ bond->params.arp_validate =BOND_ARP_VALIDATE_NONE ; bond->params.mode = newval->value;
drivers/net/dsa/mv88e6xxx/chip.c +6 -0
@@ -1184,6 +1184,10 @@ static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port, };int i, err; +/* DSA and CPU ports have to be members of multiple vlans */ +if (dsa_is_dsa_port (ds, port) ||dsa_is_cpu_port (ds, port)) +return 0 ; +if (!vid_begin)return -EOPNOTSUPP ;
@@ -4015,7 +4019,9 @@ static void mv88e6xxx_remove(struct mdio_device *mdiodev)if (chip->irq >0 ) {if (mv88e6xxx_has (chip,MV88E6XXX_FLAG_G2_INT ))mv88e6xxx_g2_irq_free (chip); +mutex_lock (&chip->reg_lock);mv88e6xxx_g1_irq_free (chip); +mutex_unlock (&chip->reg_lock); } }
drivers/net/ethernet/ibm/emac/mal.c +1 -2
@@ -402,7 +402,7 @@ static int mal_poll(struct napi_struct *napi, int budget)unsigned long flags;MAL_DBG2 (mal,"poll(%d)" NL , budget); - again: +/* Process TX skbs */ list_for_each (l, &mal->poll_list) { struct mal_commac *mc =
@@ -451,7 +451,6 @@ static int mal_poll(struct napi_struct *napi, int budget)spin_lock_irqsave (&mal->lock, flags);mal_disable_eob_irq (mal);spin_unlock_irqrestore (&mal->lock, flags); - goto again; } mc->ops->poll_tx (mc->dev); }
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +2 -1
@@ -572,12 +572,13 @@ void mlx5_rdma_netdev_free(struct net_device *netdev) {struct mlx5e_priv *priv =mlx5i_epriv (netdev);const struct mlx5e_profile *profile = priv->profile; +struct mlx5_core_dev *mdev = priv->mdev;mlx5e_detach_netdev (priv); profile->cleanup (priv);destroy_workqueue (priv->wq);free_netdev (netdev); -mlx5e_destroy_mdev_resources (priv->mdev); +mlx5e_destroy_mdev_resources (mdev); }EXPORT_SYMBOL (mlx5_rdma_netdev_free);
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +26 -12
@@ -572,15 +572,14 @@ static void mlxsw_sp_span_entry_destroy(struct mlxsw_sp *mlxsw_sp, }static struct mlxsw_sp_span_entry * -mlxsw_sp_span_entry_find (struct mlxsw_sp_port *port) +mlxsw_sp_span_entry_find (struct mlxsw_sp *mlxsw_sp,u8 local_port) { -struct mlxsw_sp *mlxsw_sp = port->mlxsw_sp;int i;for (i =0 ; i < mlxsw_sp->span.entries_count; i++) {struct mlxsw_sp_span_entry *curr = &mlxsw_sp->span.entries[i]; -if (curr->used && curr->local_port == port->local_port) +if (curr->used && curr->local_port == local_port)return curr; }return NULL ;
@@ -591,7 +590,8 @@ static struct mlxsw_sp_span_entry {struct mlxsw_sp_span_entry *span_entry; - span_entry =mlxsw_sp_span_entry_find (port); + span_entry =mlxsw_sp_span_entry_find (port->mlxsw_sp, + port->local_port);if (span_entry) {/* Already exists, just take a reference */ span_entry->ref_count++;
@@ -780,12 +780,13 @@ static int mlxsw_sp_span_mirror_add(struct mlxsw_sp_port *from, }static void mlxsw_sp_span_mirror_remove (struct mlxsw_sp_port *from, -struct mlxsw_sp_port *to, +u8 destination_port,enum mlxsw_sp_span_type type) {struct mlxsw_sp_span_entry *span_entry; - span_entry =mlxsw_sp_span_entry_find (to); + span_entry =mlxsw_sp_span_entry_find (from->mlxsw_sp, + destination_port);if (!span_entry) {netdev_err (from->dev,"no span entry found\n" );return ;
@@ -1560,14 +1561,12 @@ static void mlxsw_sp_port_del_cls_matchall_mirror(struct mlxsw_sp_port *mlxsw_sp_port, struct mlxsw_sp_port_mall_mirror_tc_entry *mirror) { - struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; enum mlxsw_sp_span_type span_type; -struct mlxsw_sp_port *to_port; - to_port = mlxsw_sp->ports[mirror->to_local_port]; span_type = mirror->ingress ?MLXSW_SP_SPAN_INGRESS :MLXSW_SP_SPAN_EGRESS ; -mlxsw_sp_span_mirror_remove (mlxsw_sp_port, to_port, span_type); +mlxsw_sp_span_mirror_remove (mlxsw_sp_port, mirror->to_local_port, + span_type); } static int
@@ -2519,7 +2518,9 @@ static int mlxsw_sp_flash_device(struct net_device *dev,return err; } -#define MLXSW_SP_QSFP_I2C_ADDR 0x50 +#define MLXSW_SP_I2C_ADDR_LOW 0x50 +#define MLXSW_SP_I2C_ADDR_HIGH 0x51 +#define MLXSW_SP_EEPROM_PAGE_LENGTH 256 static int mlxsw_sp_query_module_eeprom(struct mlxsw_sp_port *mlxsw_sp_port, u16 offset, u16 size, void *data,
@@ -2528,12 +2529,25 @@ static int mlxsw_sp_query_module_eeprom(struct mlxsw_sp_port *mlxsw_sp_port,struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;char eeprom_tmp[MLXSW_SP_REG_MCIA_EEPROM_SIZE ];char mcia_pl[MLXSW_REG_MCIA_LEN ]; +u16 i2c_addr;int status;int err; size =min_t (u16, size,MLXSW_SP_REG_MCIA_EEPROM_SIZE ); + +if (offset <MLXSW_SP_EEPROM_PAGE_LENGTH && + offset + size >MLXSW_SP_EEPROM_PAGE_LENGTH ) +/* Cross pages read, read until offset 256 in low page */ + size =MLXSW_SP_EEPROM_PAGE_LENGTH - offset; + + i2c_addr =MLXSW_SP_I2C_ADDR_LOW ; +if (offset >=MLXSW_SP_EEPROM_PAGE_LENGTH ) { + i2c_addr =MLXSW_SP_I2C_ADDR_HIGH ; + offset -=MLXSW_SP_EEPROM_PAGE_LENGTH ; + } +mlxsw_reg_mcia_pack (mcia_pl, mlxsw_sp_port->mapping.module, -0 ,0 , offset, size,MLXSW_SP_QSFP_I2C_ADDR ); +0 ,0 , offset, size, i2c_addr); err =mlxsw_reg_query (mlxsw_sp->core,MLXSW_REG (mcia), mcia_pl);if (err)
drivers/net/ethernet/qualcomm/emac/emac-mac.c +2 -1
@@ -876,7 +876,8 @@ static void emac_mac_rx_descs_refill(struct emac_adapter *adpt, curr_rxbuf->dma_addr =dma_map_single (adpt->netdev->dev.parent, skb->data, - curr_rxbuf->length,DMA_FROM_DEVICE ); + adpt->rxbuf_size,DMA_FROM_DEVICE ); + ret =dma_mapping_error (adpt->netdev->dev.parent, curr_rxbuf->dma_addr);if (ret) {
drivers/net/ethernet/realtek/8139too.c +3 -2
@@ -2135,11 +2135,12 @@ static int rtl8139_poll(struct napi_struct *napi, int budget)if (likely (RTL_R16 (IntrStatus) & RxAckBits)) work_done +=rtl8139_rx (dev, tp, budget); -if (work_done < budget &&napi_complete_done (napi, work_done)) { +if (work_done < budget) {unsigned long flags;spin_lock_irqsave (&tp->lock, flags); -RTL_W16_F (IntrMask, rtl8139_intr_mask); +if (napi_complete_done (napi, work_done)) +RTL_W16_F (IntrMask, rtl8139_intr_mask);spin_unlock_irqrestore (&tp->lock, flags); }spin_unlock (&tp->rx_lock);
drivers/net/ethernet/rocker/rocker_tlv.h +30 -18
70 lines not on this page · raw message
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +1 -0
@@ -315,6 +315,7 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat, { .compatible = "allwinner,sun8i-h3-emac" }, { .compatible = "allwinner,sun8i-v3s-emac" }, { .compatible = "allwinner,sun50i-a64-emac" }, + {}, };/* If phy-handle property is passed from DT, use it as the PHY */
drivers/net/phy/xilinx_gmii2rgmii.c +1 -1
@@ -44,7 +44,7 @@ static int xgmiitorgmii_read_status(struct phy_device *phydev) priv->phy_drv->read_status (phydev); val =mdiobus_read (phydev->mdio.bus, priv->addr,XILINX_GMII2RGMII_REG ); - val &=XILINX_GMII2RGMII_SPEED_MASK ; + val &= ~XILINX_GMII2RGMII_SPEED_MASK ;if (phydev->speed ==SPEED_1000 ) val |=BMCR_SPEED1000 ;
drivers/net/tun.c +5 -3
@@ -1298,11 +1298,13 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,switch (tun->flags &TUN_TYPE_MASK ) {case IFF_TUN :if (tun->flags &IFF_NO_PI ) { -switch (skb->data[0 ] &0xf0 ) { -case 0x40 : +u8 ip_version = skb->len ? (skb->data[0 ] >>4 ) :0 ; + +switch (ip_version) { +case 4 : pi.proto =htons (ETH_P_IP );break ; -case 0x60 : +case 6 : pi.proto =htons (ETH_P_IPV6 );break ;default :
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +19 -18
@@ -980,7 +980,7 @@ static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,eth_broadcast_addr (params_le->bssid); params_le->bss_type =DOT11_BSSTYPE_ANY ; - params_le->scan_type =0 ; + params_le->scan_type =BRCMF_SCANTYPE_ACTIVE ; params_le->channel_num =0 ; params_le->nprobes =cpu_to_le32 (-1 ); params_le->active_time =cpu_to_le32 (-1 );
@@ -988,12 +988,9 @@ static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg, params_le->home_time =cpu_to_le32 (-1 );memset (¶ms_le->ssid_le,0 ,sizeof (params_le->ssid_le)); -/* if request is null exit so it will be all channel broadcast scan */ -if (!request) -return ; - n_ssids = request->n_ssids; n_channels = request->n_channels; +/* Copy channel array if applicable */ brcmf_dbg (SCAN ,"### List of channelspecs to scan ### %d\n" , n_channels);
@@ -1030,16 +1027,8 @@ static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg, ptr +=sizeof (ssid_le); } }else { -brcmf_dbg (SCAN ,"Broadcast scan %p\n" , request->ssids); -if ((request->ssids) && request->ssids->ssid_len) { -brcmf_dbg (SCAN ,"SSID %s len=%d\n" , - params_le->ssid_le.SSID, - request->ssids->ssid_len); - params_le->ssid_le.SSID_len = -cpu_to_le32 (request->ssids->ssid_len); -memcpy (¶ms_le->ssid_le.SSID, request->ssids->ssid, - request->ssids->ssid_len); - } +brcmf_dbg (SCAN ,"Performing passive scan\n" ); + params_le->scan_type =BRCMF_SCANTYPE_PASSIVE ; }/* Adding mask to channel numbers */ params_le->channel_num =
@@ -3162,6 +3151,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,struct brcmf_cfg80211_info *cfg = ifp->drvr->config;s32 status;struct brcmf_escan_result_le *escan_result_le; +u32 escan_buflen;struct brcmf_bss_info_le *bss_info_le;struct brcmf_bss_info_le *bss =NULL ;u32 bi_length;
@@ -3181,11 +3171,23 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,if (status ==BRCMF_E_STATUS_PARTIAL ) {brcmf_dbg (SCAN ,"ESCAN Partial result\n" ); +if (e->datalen <sizeof (*escan_result_le)) { +brcmf_err ("invalid event data length\n" ); + goto exit; + } escan_result_le = (struct brcmf_escan_result_le *) data;if (!escan_result_le) {brcmf_err ("Invalid escan result (NULL pointer)\n" ); goto exit; } + escan_buflen =le32_to_cpu (escan_result_le->buflen); +if (escan_buflen >BRCMF_ESCAN_BUF_SIZE || + escan_buflen > e->datalen || + escan_buflen <sizeof (*escan_result_le)) { +brcmf_err ("Invalid escan buffer length: %d\n" , + escan_buflen); + goto exit; + }if (le16_to_cpu (escan_result_le->bss_count) !=1 ) {brcmf_err ("Invalid bss_count %d: ignoring\n" , escan_result_le->bss_count);
@@ -3202,9 +3204,8 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp, } bi_length =le32_to_cpu (bss_info_le->length); -if (bi_length != (le32_to_cpu (escan_result_le->buflen) - -WL_ESCAN_RESULTS_FIXED_SIZE )) { -brcmf_err ("Invalid bss_info length %d: ignoring\n" , +if (bi_length != escan_buflen -WL_ESCAN_RESULTS_FIXED_SIZE ) { +brcmf_err ("Ignoring invalid bss_info length: %d\n" , bi_length); goto exit; }
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +5 -0
@@ -45,6 +45,11 @@#define BRCMF_SCAN_PARAMS_COUNT_MASK 0x0000ffff#define BRCMF_SCAN_PARAMS_NSSID_SHIFT 16 +/* scan type definitions */ +#define BRCMF_SCANTYPE_DEFAULT 0xFF +#define BRCMF_SCANTYPE_ACTIVE 0 +#define BRCMF_SCANTYPE_PASSIVE 1 +#define BRCMF_WSEC_MAX_PSK_LEN 32#define BRCMF_WSEC_PASSPHRASE BIT(0)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +9 -1
@@ -1589,6 +1589,11 @@ static void iwl_mvm_mc_iface_iterator(void *_data, u8 *mac,struct iwl_mvm_mc_iter_data *data = _data;struct iwl_mvm *mvm = data->mvm;struct iwl_mcast_filter_cmd *cmd = mvm->mcast_filter_cmd; +struct iwl_host_cmd hcmd = { + .id =MCAST_FILTER_CMD , + .flags =CMD_ASYNC , + .dataflags[0 ] =IWL_HCMD_DFL_NOCOPY , + };int ret, len;/* if we don't have free ports, mcast frames will be dropped */
@@ -1603,7 +1608,10 @@ static void iwl_mvm_mc_iface_iterator(void *_data, u8 *mac,memcpy (cmd->bssid, vif->bss_conf.bssid,ETH_ALEN ); len =roundup (sizeof (*cmd) + cmd->count *ETH_ALEN ,4 ); - ret =iwl_mvm_send_cmd_pdu (mvm,MCAST_FILTER_CMD ,CMD_ASYNC , len, cmd); + hcmd.len[0 ] = len; + hcmd.data[0 ] = cmd; + + ret =iwl_mvm_send_cmd (mvm, &hcmd);if (ret)IWL_ERR (mvm,"mcast filter cmd error. ret=%d\n" , ret); }
drivers/nvme/host/pci.c +7 -7
@@ -93,7 +93,7 @@ struct nvme_dev {struct mutex shutdown_lock;bool subsystem;void __iomem *cmb; -dma_addr_t cmb_dma_addr; +pci_bus_addr_t cmb_bus_addr;u64 cmb_size;u32 cmbsz;u32 cmbloc;
@@ -1218,7 +1218,7 @@ static int nvme_alloc_sq_cmds(struct nvme_dev *dev, struct nvme_queue *nvmeq,if (qid && dev->cmb && use_cmb_sqes &&NVME_CMB_SQS (dev->cmbsz)) {unsigned offset = (qid -1 ) *roundup (SQ_SIZE (depth), dev->ctrl.page_size); - nvmeq->sq_dma_addr = dev->cmb_dma_addr + offset; + nvmeq->sq_dma_addr = dev->cmb_bus_addr + offset; nvmeq->sq_cmds_io = dev->cmb + offset; }else { nvmeq->sq_cmds = dma_alloc_coherent(dev->dev, SQ_SIZE(depth),
@@ -1517,7 +1517,7 @@ static void __iomem *nvme_map_cmb(struct nvme_dev *dev)resource_size_t bar_size;struct pci_dev *pdev =to_pci_dev (dev->dev);void __iomem *cmb; -dma_addr_t dma_addr; +int bar; dev->cmbsz =readl (dev->bar +NVME_REG_CMBSZ );if (!(NVME_CMB_SZ (dev->cmbsz)))
@@ -1530,7 +1530,8 @@ static void __iomem *nvme_map_cmb(struct nvme_dev *dev) szu = (u64 )1 << (12 +4 *NVME_CMB_SZU (dev->cmbsz)); size = szu *NVME_CMB_SZ (dev->cmbsz); offset = szu *NVME_CMB_OFST (dev->cmbloc); - bar_size =pci_resource_len (pdev,NVME_CMB_BIR (dev->cmbloc)); + bar =NVME_CMB_BIR (dev->cmbloc); + bar_size =pci_resource_len (pdev, bar);if (offset > bar_size)return NULL ;
@@ -1543,12 +1544,11 @@ static void __iomem *nvme_map_cmb(struct nvme_dev *dev)if (size > bar_size - offset) size = bar_size - offset; - dma_addr =pci_resource_start (pdev,NVME_CMB_BIR (dev->cmbloc)) + offset; - cmb =ioremap_wc (dma_addr, size); + cmb =ioremap_wc (pci_resource_start (pdev, bar) + offset, size);if (!cmb)return NULL ; - dev->cmb_dma_addr = dma_addr; + dev->cmb_bus_addr =pci_bus_address (pdev, bar) + offset; dev->cmb_size = size;return cmb; }
drivers/scsi/scsi_scan.c +3 -0
@@ -956,6 +956,9 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,if (*bflags &BLIST_NO_DIF ) sdev->no_dif =1 ; +if (*bflags &BLIST_UNMAP_LIMIT_WS ) + sdev->unmap_limit_for_ws =1 ; + sdev->eh_timeout =SCSI_DEFAULT_EH_TIMEOUT ;if (*bflags &BLIST_TRY_VPD_PAGES )
drivers/scsi/sd.c +26 -9
@@ -715,13 +715,21 @@ static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode)break ;case SD_LBP_WS16 : - max_blocks =min_not_zero (sdkp->max_ws_blocks, - (u32 )SD_MAX_WS16_BLOCKS ); +if (sdkp->device->unmap_limit_for_ws) + max_blocks = sdkp->max_unmap_blocks; +else + max_blocks = sdkp->max_ws_blocks; + + max_blocks =min_not_zero (max_blocks, (u32 )SD_MAX_WS16_BLOCKS );break ;case SD_LBP_WS10 : - max_blocks =min_not_zero (sdkp->max_ws_blocks, - (u32 )SD_MAX_WS10_BLOCKS ); +if (sdkp->device->unmap_limit_for_ws) + max_blocks = sdkp->max_unmap_blocks; +else + max_blocks = sdkp->max_ws_blocks; + + max_blocks =min_not_zero (max_blocks, (u32 )SD_MAX_WS10_BLOCKS );break ;case SD_LBP_ZERO :
@@ -3101,8 +3109,6 @@ static int sd_revalidate_disk(struct gendisk *disk)sd_read_security (sdkp, buffer); } - sdkp->first_scan =0 ; -/* * We now have all cache related info, determine how we deal * with flush requests.
@@ -3117,7 +3123,7 @@ static int sd_revalidate_disk(struct gendisk *disk) q->limits.max_dev_sectors =logical_to_sectors (sdp, dev_max);/* -* Use the device's preferred I/O size for reads and writes +* Determine the device's preferred I/O size for reads and writes * unless the reported value is unreasonably small, large, or * garbage. */
@@ -3131,8 +3137,19 @@ static int sd_revalidate_disk(struct gendisk *disk) rw_max =min_not_zero (logical_to_sectors (sdp, dev_max), (sector_t )BLK_DEF_MAX_SECTORS ); -/* Combine with controller limits */ - q->limits.max_sectors =min (rw_max,queue_max_hw_sectors (q)); +/* Do not exceed controller limit */ + rw_max =min (rw_max,queue_max_hw_sectors (q)); + +/* +* Only update max_sectors if previously unset or if the current value +* exceeds the capabilities of the hardware. +*/ +if (sdkp->first_scan || + q->limits.max_sectors > q->limits.max_dev_sectors || + q->limits.max_sectors > q->limits.max_hw_sectors) + q->limits.max_sectors = rw_max; + + sdkp->first_scan =0 ;set_capacity (disk,logical_to_sectors (sdp, sdkp->capacity));sd_config_write_same (sdkp);
drivers/staging/iio/adc/ad7192.c +1 -3
@@ -223,11 +223,9 @@ static int ad7192_setup(struct ad7192_state *st,struct iio_dev *indio_dev =spi_get_drvdata (st->sd.spi);unsigned long long scale_uv;int i, ret, id; -u8 ones[6 ];/* reset the serial interface */ -memset (&ones,0xFF ,6 ); - ret =spi_write (st->sd.spi, &ones,6 ); + ret =ad_sd_reset (&st->sd,48 );if (ret <0 ) goto out;usleep_range (500 ,1000 );/* Wait for at least 500us */
drivers/staging/media/imx/imx-media-of.c +1 -1
@@ -167,7 +167,7 @@ of_parse_subdev(struct imx_media_dev *imxmd, struct device_node *sd_np,of_parse_sensor (imxmd, imxsd, sd_np);for (i =0 ; i < num_pads; i++) { -struct device_node *epnode =NULL , *port, *remote_np; +struct device_node *epnode =NULL , *port, *remote_np =NULL ;struct imx_media_subdev *remote_imxsd;struct imx_media_pad *pad;int remote_pad;
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +4 -2
@@ -612,18 +612,20 @@ free_pagelist(struct vchiq_pagelist_info *pagelistinfo,if (head_bytes > actual) head_bytes = actual; -memcpy ((char *)page_address (pages[0 ]) + +memcpy ((char *)kmap (pages[0 ]) + pagelist->offset, fragments, head_bytes); +kunmap (pages[0 ]); }if ((actual >=0 ) && (head_bytes < actual) && (tail_bytes !=0 )) { -memcpy ((char *)page_address (pages[num_pages -1 ]) + +memcpy ((char *)kmap (pages[num_pages -1 ]) + ((pagelist->offset + actual) & (PAGE_SIZE -1 ) & ~(g_cache_line_size -1 )), fragments + g_cache_line_size, tail_bytes); +kunmap (pages[num_pages -1 ]); }down (&g_free_fragments_mutex);
drivers/usb/class/cdc-wdm.c +3 -1
@@ -194,8 +194,10 @@ static void wdm_in_callback(struct urb *urb)/* * only set a new error if there is no previous error. * Errors are only cleared during read/open +* Avoid propagating -EPIPE (stall) to userspace since it is +* better handled as an empty read */ -if (desc->rerr ==0 ) +if (desc->rerr ==0 && status != -EPIPE ) desc->rerr = status;if (length + desc->length > desc->wMaxCommand) {
drivers/usb/core/config.c +12 -4
@@ -643,15 +643,23 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, }else if (header->bDescriptorType ==USB_DT_INTERFACE_ASSOCIATION ) { +struct usb_interface_assoc_descriptor *d; + + d = (struct usb_interface_assoc_descriptor *)header; +if (d->bLength <USB_DT_INTERFACE_ASSOCIATION_SIZE ) { +dev_warn (ddev, +"config %d has an invalid interface association descriptor of length %d, skipping\n" , + cfgno, d->bLength); +continue ; + } +if (iad_num ==USB_MAXIADS ) {dev_warn (ddev,"found more Interface " "Association Descriptors " "than allocated for in " "configuration %d\n" , cfgno); }else { - config->intf_assoc[iad_num] = - (struct usb_interface_assoc_descriptor - *)header; + config->intf_assoc[iad_num] = d; iad_num++; }
@@ -852,7 +860,7 @@ int usb_get_configuration(struct usb_device *dev) }if (dev->quirks &USB_QUIRK_DELAY_INIT ) -msleep (100 ); +msleep (200 ); result =usb_get_descriptor (dev,USB_DT_CONFIG , cfgno, bigbuffer, length);
drivers/usb/core/devio.c +10 -1
@@ -140,6 +140,9 @@ module_param(usbfs_memory_mb, uint, 0644);MODULE_PARM_DESC (usbfs_memory_mb,"maximum MB allowed for usbfs buffers (0 = no limit)" ); +/* Hard limit, necessary to avoid arithmetic overflow */ +#define USBFS_XFER_MAX (UINT_MAX / 2 - 1000000) +static atomic64_t usbfs_memory_usage;/* Total memory currently allocated */ /* Check whether it's okay to allocate more memory for a transfer */
@@ -1460,6 +1463,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurbUSBDEVFS_URB_ZERO_PACKET | USBDEVFS_URB_NO_INTERRUPT)) return -EINVAL; +if ((unsigned int )uurb->buffer_length >=USBFS_XFER_MAX ) +return -EINVAL ;if (uurb->buffer_length >0 && !uurb->buffer)return -EINVAL ; if (!(uurb->type == USBDEVFS_URB_TYPE_CONTROL &&
@@ -1571,7 +1576,11 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb totlen += isopkt[u].length; } u *=sizeof (struct usb_iso_packet_descriptor ); - uurb->buffer_length = totlen; +if (totlen <= uurb->buffer_length) + uurb->buffer_length = totlen; +else +WARN_ONCE (1 ,"uurb->buffer_length is too short %d vs %d" , + totlen, uurb->buffer_length);break ;default :
drivers/usb/core/hub.c +1 -1
@@ -4825,7 +4825,7 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus, goto loop;if (udev->quirks &USB_QUIRK_DELAY_INIT ) -msleep (1000 ); +msleep (2000 );/* consecutive bus-powered hubs aren't reliable; they can * violate the voltage drop budget. if the new child has
drivers/usb/core/message.c +4 -0
@@ -2069,6 +2069,10 @@ int cdc_parse_cdc_header(struct usb_cdc_parsed_header *hdr, elength =1 ; goto next_desc; } +if ((buflen < elength) || (elength <3 )) { +dev_err (&intf->dev,"invalid descriptor buffer length\n" ); +break ; + }if (buffer[1 ] !=USB_DT_CS_INTERFACE ) {dev_err (&intf->dev,"skipping garbage\n" ); goto next_desc;
drivers/usb/dwc3/ep0.c +7 -0
@@ -990,6 +990,8 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,DWC3_TRBCTL_CONTROL_DATA , true); + req->trb = &dwc->ep0_trb[dep->trb_enqueue -1 ]; +/* Now prepare one extra TRB to align transfer size */ dwc3_ep0_prepare_one_trb(dep, dwc->bounce_addr, maxpacket - rem,
@@ -1015,6 +1017,8 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,DWC3_TRBCTL_CONTROL_DATA , true); + req->trb = &dwc->ep0_trb[dep->trb_enqueue -1 ]; +/* Now prepare one extra TRB to align transfer size */ dwc3_ep0_prepare_one_trb(dep, dwc->bounce_addr, 0, DWC3_TRBCTL_CONTROL_DATA,
@@ -1029,6 +1033,9 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,dwc3_ep0_prepare_one_trb (dep, req->request.dma, req->request.length,DWC3_TRBCTL_CONTROL_DATA , false); + + req->trb = &dwc->ep0_trb[dep->trb_enqueue]; + ret =dwc3_ep0_start_trans (dep); }
drivers/usb/gadget/function/f_mass_storage.c +7 -20
@@ -307,8 +307,6 @@ struct fsg_common {struct completion thread_notifier;struct task_struct *thread_task; -/* Callback functions. */ -const struct fsg_operations *ops;/* Gadget's private data. */ void *private_data;
@@ -2440,6 +2438,7 @@ static void handle_exception(struct fsg_common *common)static int fsg_main_thread (void *common_) {struct fsg_common *common = common_; +int i;/* * Allow the thread to be killed by a signal, but set the signal mask
@@ -2485,21 +2484,16 @@ static int fsg_main_thread(void *common_) common->thread_task =NULL ;spin_unlock_irq (&common->lock); -if (!common->ops || !common->ops->thread_exits - || common->ops->thread_exits (common) <0 ) { -int i; +/* Eject media from all LUNs */ -down_write (&common->filesem); -for (i =0 ; i <ARRAY_SIZE (common->luns); i++) { -struct fsg_lun *curlun = common->luns[i]; -if (!curlun || !fsg_lun_is_open (curlun)) -continue ; +down_write (&common->filesem); +for (i =0 ; i <ARRAY_SIZE (common->luns); i++) { +struct fsg_lun *curlun = common->luns[i]; +if (curlun &&fsg_lun_is_open (curlun))fsg_lun_close (curlun); - curlun->unit_attention_data =SS_MEDIUM_NOT_PRESENT ; - } -up_write (&common->filesem); } +up_write (&common->filesem);/* Let fsg_unbind() know the thread has exited */ complete_and_exit (&common->thread_notifier,0 );
@@ -2690,13 +2684,6 @@ void fsg_common_remove_luns(struct fsg_common *common) }EXPORT_SYMBOL_GPL (fsg_common_remove_luns); -void fsg_common_set_ops (struct fsg_common *common, -const struct fsg_operations *ops) -{ - common->ops = ops; -} -EXPORT_SYMBOL_GPL (fsg_common_set_ops); -void fsg_common_free_buffers (struct fsg_common *common) {_fsg_common_free_buffers (common->buffhds, common->fsg_num_buffers);
drivers/usb/gadget/function/f_mass_storage.h +0 -14
@@ -60,17 +60,6 @@ struct fsg_module_parameters {struct fsg_common ;/* FSF callback functions */ -struct fsg_operations { -/* -* Callback function to call when thread exits. If no -* callback is set or it returns value lower then zero MSF -* will force eject all LUNs it operates on (including those -* marked as non-removable or with prevent_medium_removal flag -* set). -*/ -int (*thread_exits)(struct fsg_common *common); -}; -struct fsg_lun_opts {struct config_group group;struct fsg_lun *lun;
@@ -142,9 +131,6 @@ void fsg_common_remove_lun(struct fsg_lun *lun);void fsg_common_remove_luns (struct fsg_common *common); -void fsg_common_set_ops (struct fsg_common *common, -const struct fsg_operations *ops); -int fsg_common_create_lun (struct fsg_common *common,struct fsg_lun_config *cfg,unsigned int id,const char *name,const char **name_pfx);
drivers/usb/gadget/legacy/inode.c +40 -6
148 lines not on this page · raw message
drivers/usb/gadget/legacy/mass_storage.c +3 -23
@@ -107,15 +107,6 @@ static unsigned int fsg_num_buffers = CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS; FSG_MODULE_PARAMETERS(/* no prefix */, mod_data); -static unsigned long msg_registered; -static void msg_cleanup (void ); - -static int msg_thread_exits (struct fsg_common *common) -{ -msg_cleanup (); -return 0 ; -} -static int msg_do_config (struct usb_configuration *c) {struct fsg_opts *opts;
@@ -154,9 +145,6 @@ static struct usb_configuration msg_config_driver = {static int msg_bind (struct usb_composite_dev *cdev) { -static const struct fsg_operations ops = { - .thread_exits = msg_thread_exits, - };struct fsg_opts *opts;struct fsg_config config;int status;
@@ -173,8 +161,6 @@ static int msg_bind(struct usb_composite_dev *cdev)if (status) goto fail; -fsg_common_set_ops (opts->common, &ops); - status =fsg_common_set_cdev (opts->common, cdev, config.can_stall);if (status) goto fail_set_cdev;
@@ -256,18 +242,12 @@ MODULE_LICENSE("GPL");static int __init msg_init (void ) { -int ret; - - ret =usb_composite_probe (&msg_driver); -set_bit (0 , &msg_registered); - -return ret; +return usb_composite_probe (&msg_driver); }module_init (msg_init); -static void msg_cleanup (void ) +static void __exit msg_cleanup(void) { -if (test_and_clear_bit (0 , &msg_registered)) -usb_composite_unregister (&msg_driver); +usb_composite_unregister (&msg_driver); }module_exit (msg_cleanup);
drivers/usb/gadget/udc/atmel_usba_udc.c +3 -1
@@ -29,6 +29,8 @@#include <linux/of_gpio.h> #include "atmel_usba_udc.h" +#define USBA_VBUS_IRQFLAGS (IRQF_ONESHOT \ + | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING)#ifdef CONFIG_USB_GADGET_DEBUG_FS #include <linux/debugfs.h>
@@ -2361,7 +2363,7 @@ static int usba_udc_probe(struct platform_device *pdev) IRQ_NOAUTOEN); ret =devm_request_threaded_irq (&pdev->dev,gpio_to_irq (udc->vbus_pin),NULL , - usba_vbus_irq_thread,IRQF_ONESHOT , + usba_vbus_irq_thread,USBA_VBUS_IRQFLAGS ,"atmel_usba_udc" , udc);if (ret) { udc->vbus_pin = -ENODEV ;
drivers/usb/gadget/udc/core.c +1 -2
@@ -1314,8 +1314,7 @@ static int udc_bind_to_driver(struct usb_udc *udc, struct usb_gadget_driver *dri udc->dev.driver = &driver->driver; udc->gadget->dev.driver = &driver->driver; -if (driver->max_speed < udc->gadget->max_speed) -usb_gadget_udc_set_speed (udc, driver->max_speed); +usb_gadget_udc_set_speed (udc, driver->max_speed); ret = driver->bind (udc->gadget, driver);if (ret)
drivers/usb/gadget/udc/dummy_hcd.c +50 -6
156 lines not on this page · raw message
drivers/usb/gadget/udc/renesas_usb3.c +15 -4
@@ -1032,7 +1032,7 @@ static int usb3_write_pipe(struct renesas_usb3_ep *usb3_ep, usb3_ep->ep.maxpacket);u8 *buf = usb3_req->req.buf + usb3_req->req.actual;u32 tmp =0 ; -bool is_last; +bool is_last = !len ? true : false;if (usb3_wait_pipe_status (usb3_ep,PX_STA_BUFSTS ) <0 )return -EBUSY ;
@@ -1053,7 +1053,8 @@ static int usb3_write_pipe(struct renesas_usb3_ep *usb3_ep,usb3_write (usb3, tmp, fifo_reg); } - is_last =usb3_is_transfer_complete (usb3_ep, usb3_req); +if (!is_last) + is_last =usb3_is_transfer_complete (usb3_ep, usb3_req);/* Send the data */ usb3_set_px_con_send (usb3_ep, len, is_last);
@@ -1144,7 +1145,8 @@ static void usb3_start_pipe0(struct renesas_usb3_ep *usb3_ep,usb3_set_p0_con_for_ctrl_read_data (usb3); }else {usb3_clear_bit (usb3,P0_MOD_DIR ,USB3_P0_MOD ); -usb3_set_p0_con_for_ctrl_write_data (usb3); +if (usb3_req->req.length) +usb3_set_p0_con_for_ctrl_write_data (usb3); }usb3_p0_xfer (usb3_ep, usb3_req);
@@ -2047,7 +2049,16 @@ static u32 usb3_calc_ramarea(int ram_size)static u32 usb3_calc_rammap_val (struct renesas_usb3_ep *usb3_ep,const struct usb_endpoint_descriptor *desc) { -return usb3_ep->rammap_val |PN_RAMMAP_MPKT (usb_endpoint_maxp (desc)); +int i; +const u32 max_packet_array[] = {8 ,16 ,32 ,64 ,512 }; +u32 mpkt =PN_RAMMAP_MPKT (1024 ); + +for (i =0 ; i <ARRAY_SIZE (max_packet_array); i++) { +if (usb_endpoint_maxp (desc) <= max_packet_array[i]) + mpkt =PN_RAMMAP_MPKT (max_packet_array[i]); + } + +return usb3_ep->rammap_val | mpkt; } static int usb3_enable_pipe_n(struct renesas_usb3_ep *usb3_ep,
drivers/usb/host/pci-quirks.c +5 -5
@@ -447,7 +447,7 @@ static int usb_asmedia_wait_write(struct pci_dev *pdev)if ((value &ASMT_CONTROL_WRITE_BIT ) ==0 )return 0 ; -usleep_range (40 ,60 ); +udelay (50 ); }dev_warn (&pdev->dev,"%s: check_write_ready timeout" , __func__);
@@ -1022,7 +1022,7 @@ EXPORT_SYMBOL_GPL(usb_disable_xhci_ports);* * Takes care of the handoff between the Pre-OS (i.e. BIOS) and the OS. * It signals to the BIOS that the OS wants control of the host controller, -* and then waits 5 seconds for the BIOS to hand over control. +* and then waits 1 second for the BIOS to hand over control. * If we timeout, assume the BIOS is broken and take control anyway. */ static void quirk_usb_handoff_xhci (struct pci_dev *pdev)
@@ -1069,9 +1069,9 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev)if (val &XHCI_HC_BIOS_OWNED ) {writel (val |XHCI_HC_OS_OWNED , base + ext_cap_offset); -/* Wait for 5 seconds with 10 microsecond polling interval */ +/* Wait for 1 second with 10 microsecond polling interval */ timeout =handshake (base + ext_cap_offset,XHCI_HC_BIOS_OWNED , -0 ,5000 ,10 ); +0 ,1000000 ,10 );/* Assume a buggy BIOS and take HC ownership anyway */ if (timeout) {
@@ -1100,7 +1100,7 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev)* operational or runtime registers. Wait 5 seconds and no more. */ timeout =handshake (op_reg_base +XHCI_STS_OFFSET ,XHCI_STS_CNR ,0 , -5000 ,10 ); +5000000 ,10 );/* Assume a buggy HC and start HC initialization anyway */ if (timeout) { val =readl (op_reg_base +XHCI_STS_OFFSET );
drivers/usb/host/xhci-hub.c +10 -4
@@ -112,7 +112,7 @@ static int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf,/* If PSI table exists, add the custom speed attributes from it */ if (usb3_1 && xhci->usb3_rhub.psi_count) { -u32 ssp_cap_base, bm_attrib, psi; +u32 ssp_cap_base, bm_attrib, psi, psi_mant, psi_exp;int offset; ssp_cap_base =USB_DT_BOS_SIZE +USB_DT_USB_SS_CAP_SIZE ;
@@ -139,6 +139,15 @@ static int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf,for (i =0 ; i < xhci->usb3_rhub.psi_count; i++) { psi = xhci->usb3_rhub.psi[i]; psi &= ~USB_SSP_SUBLINK_SPEED_RSVD ; + psi_exp =XHCI_EXT_PORT_PSIE (psi); + psi_mant =XHCI_EXT_PORT_PSIM (psi); + +/* Shift to Gbps and set SSP Link BIT(14) if 10Gpbs */ +for (; psi_exp <3 ; psi_exp++) + psi_mant /=1000 ; +if (psi_mant >=10 ) + psi |=BIT (14 ); +if ((psi &PLT_MASK ) ==PLT_SYM ) {/* Symmetric, create SSA RX and TX from one PSI entry */ put_unaligned_le32 (psi, &buf[offset]);
@@ -1473,9 +1482,6 @@ int xhci_bus_suspend(struct usb_hcd *hcd) t2 |=PORT_WKOC_E |PORT_WKCONN_E ; t2 &= ~PORT_WKDISC_E ; } -if ((xhci->quirks &XHCI_U2_DISABLE_WAKE ) && - (hcd->speed <HCD_USB3 )) - t2 &= ~PORT_WAKE_BITS ; }else t2 &= ~PORT_WAKE_BITS ;
drivers/usb/host/xhci-pci.c +0 -12
@@ -54,11 +54,6 @@#define PCI_DEVICE_ID_INTEL_APL_XHCI 0x5aa8#define PCI_DEVICE_ID_INTEL_DNV_XHCI 0x19d0 -#define PCI_DEVICE_ID_AMD_PROMONTORYA_4 0x43b9 -#define PCI_DEVICE_ID_AMD_PROMONTORYA_3 0x43ba -#define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb -#define PCI_DEVICE_ID_AMD_PROMONTORYA_1 0x43bc -#define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142static const char hcd_name[] ="xhci_hcd" ;
@@ -142,13 +137,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)if (pdev->vendor ==PCI_VENDOR_ID_AMD ) xhci->quirks |=XHCI_TRUST_TX_LENGTH ; -if ((pdev->vendor ==PCI_VENDOR_ID_AMD ) && - ((pdev->device ==PCI_DEVICE_ID_AMD_PROMONTORYA_4 ) || - (pdev->device ==PCI_DEVICE_ID_AMD_PROMONTORYA_3 ) || - (pdev->device ==PCI_DEVICE_ID_AMD_PROMONTORYA_2 ) || - (pdev->device ==PCI_DEVICE_ID_AMD_PROMONTORYA_1 ))) - xhci->quirks |=XHCI_U2_DISABLE_WAKE ; -if (pdev->vendor ==PCI_VENDOR_ID_INTEL ) { xhci->quirks |=XHCI_LPM_SUPPORT ; xhci->quirks |=XHCI_INTEL_HOST ;
drivers/usb/host/xhci-plat.c +10 -6
@@ -186,14 +186,18 @@ static int xhci_plat_probe(struct platform_device *pdev)* 2. xhci_plat is child of a device from firmware (dwc3-plat) * 3. xhci_plat is grandchild of a pci device (dwc3-pci) */ - sysdev = &pdev->dev; -if (sysdev->parent && !sysdev->of_node && sysdev->parent->of_node) - sysdev = sysdev->parent; +for (sysdev = &pdev->dev; sysdev; sysdev = sysdev->parent) { +if (is_of_node (sysdev->fwnode) || +is_acpi_device_node (sysdev->fwnode)) +break ;#ifdef CONFIG_PCI - else if (sysdev->parent && sysdev->parent->parent && - sysdev->parent->parent->bus == &pci_bus_type) - sysdev = sysdev->parent->parent; + else if (sysdev->bus == &pci_bus_type) + break;#endif + } + +if (!sysdev) + sysdev = &pdev->dev;/* Try to set 64-bit DMA first */ if (WARN_ON (!sysdev->dma_mask))
drivers/usb/host/xhci.c +2 -1
@@ -1703,7 +1703,8 @@ static int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev,if (xhci->quirks &XHCI_MTK_HOST ) { ret =xhci_mtk_add_ep_quirk (hcd, udev, ep);if (ret <0 ) { -xhci_free_endpoint_ring (xhci, virt_dev, ep_index); +xhci_ring_free (xhci, virt_dev->eps[ep_index].new_ring); + virt_dev->eps[ep_index].new_ring =NULL ;return ret; } }
drivers/usb/host/xhci.h +6 -4
@@ -728,6 +728,8 @@ struct xhci_ep_ctx {#define EP_MAXPSTREAMS (p) (((p) << 10) & EP_MAXPSTREAMS_MASK)/* Endpoint is set up with a Linear Stream Array (vs. Secondary Stream Array) */ #define EP_HAS_LSA (1 << 15) +/* hosts with LEC=1 use bits 31:24 as ESIT high bits. */ +#define CTX_TO_MAX_ESIT_PAYLOAD_HI (p) (((p) >> 24) & 0xff)/* ep_info2 bitmasks */ /*
@@ -1674,7 +1676,7 @@ struct xhci_bus_state {static inline unsigned int hcd_index (struct usb_hcd *hcd) { -if (hcd->speed ==HCD_USB3 ) +if (hcd->speed >=HCD_USB3 )return 0 ;else return 1 ;
@@ -1819,7 +1821,7 @@ struct xhci_hcd {/* For controller with a broken Port Disable implementation */ #define XHCI_BROKEN_PORT_PED (1 << 25)#define XHCI_LIMIT_ENDPOINT_INTERVAL_7 (1 << 26) -#define XHCI_U2_DISABLE_WAKE (1 << 27) +/* Reserved. It was XHCI_U2_DISABLE_WAKE */ #define XHCI_ASMEDIA_MODIFY_FLOWCONTROL (1 << 28)unsigned int num_active_eps;
@@ -2452,8 +2454,8 @@ static inline const char *xhci_decode_ep_context(u32 info, u32 info2, u64 deq,u8 lsa;u8 hid; - esit =EP_MAX_ESIT_PAYLOAD_HI (info) <<16 | -EP_MAX_ESIT_PAYLOAD_LO (tx_info); + esit =CTX_TO_MAX_ESIT_PAYLOAD_HI (info) <<16 | +CTX_TO_MAX_ESIT_PAYLOAD (tx_info); ep_state = info &EP_STATE_MASK ; max_pstr = info &EP_MAXPSTREAMS_MASK ;
drivers/usb/renesas_usbhs/fifo.c +18 -3
@@ -282,11 +282,26 @@ static void usbhsf_fifo_clear(struct usbhs_pipe *pipe, struct usbhs_fifo *fifo) {struct usbhs_priv *priv =usbhs_pipe_to_priv (pipe); +int ret =0 ; -if (!usbhs_pipe_is_dcp (pipe)) -usbhsf_fifo_barrier (priv, fifo); +if (!usbhs_pipe_is_dcp (pipe)) { +/* +* This driver checks the pipe condition first to avoid -EBUSY +* from usbhsf_fifo_barrier() with about 10 msec delay in +* the interrupt handler if the pipe is RX direction and empty. +*/ +if (usbhs_pipe_is_dir_in (pipe)) + ret =usbhs_pipe_is_accessible (pipe); +if (!ret) + ret =usbhsf_fifo_barrier (priv, fifo); + } -usbhs_write (priv, fifo->ctr,BCLR ); +/* +* if non-DCP pipe, this driver should set BCLR when +* usbhsf_fifo_barrier() returns 0. +*/ +if (!ret) +usbhs_write (priv, fifo->ctr,BCLR ); } static int usbhsf_fifo_rcv_len(struct usbhs_priv *priv,
drivers/usb/storage/transport.c +13 -1
@@ -834,13 +834,25 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)if (result ==USB_STOR_TRANSPORT_GOOD ) { srb->result =SAM_STAT_GOOD ; srb->sense_buffer[0 ] =0x0 ; + } + +/* +* ATA-passthru commands use sense data to report +* the command completion status, and often devices +* return Check Condition status when nothing is +* wrong. +*/ +else if (srb->cmnd[0 ] ==ATA_16 || + srb->cmnd[0 ] ==ATA_12 ) { +/* leave the data alone */ + }/* * If there was a problem, report an unspecified * hardware error to prevent the higher layers from * entering an infinite retry loop. */ - }else { +else { srb->result =DID_ERROR <<16 ;if ((sshdr.response_code &0x72 ) ==0x72 ) srb->sense_buffer[1 ] =HARDWARE_ERROR ;
drivers/usb/storage/uas-detect.h +8 -7
@@ -9,7 +9,8 @@ static int uas_is_interface(struct usb_host_interface *intf) intf->desc.bInterfaceProtocol == USB_PR_UAS); } -static int uas_find_uas_alt_setting (struct usb_interface *intf) +static struct usb_host_interface *uas_find_uas_alt_setting ( +struct usb_interface *intf) {int i;
@@ -17,10 +18,10 @@ static int uas_find_uas_alt_setting(struct usb_interface *intf)struct usb_host_interface *alt = &intf->altsetting[i];if (uas_is_interface (alt)) -return alt->desc.bAlternateSetting; +return alt; } -return -ENODEV ; +return NULL ; } static int uas_find_endpoints(struct usb_host_interface *alt,
@@ -58,14 +59,14 @@ static int uas_use_uas_driver(struct usb_interface *intf,struct usb_device *udev =interface_to_usbdev (intf);struct usb_hcd *hcd =bus_to_hcd (udev->bus);unsigned long flags = id->driver_info; -int r, alt; - +struct usb_host_interface *alt; +int r; alt =uas_find_uas_alt_setting (intf); -if (alt <0 ) +if (!alt)return 0 ; - r =uas_find_endpoints (&intf->altsetting[alt], eps); + r =uas_find_endpoints (alt, eps);if (r <0 )return 0 ;
drivers/usb/storage/uas.c +5 -5
@@ -873,14 +873,14 @@ MODULE_DEVICE_TABLE(usb, uas_usb_ids);static int uas_switch_interface (struct usb_device *udev,struct usb_interface *intf) { -int alt; +struct usb_host_interface *alt; alt =uas_find_uas_alt_setting (intf); -if (alt <0 ) -return alt; +if (!alt) +return -ENODEV ; -return usb_set_interface (udev, - intf->altsetting[0 ].desc.bInterfaceNumber, alt); +return usb_set_interface (udev, alt->desc.bInterfaceNumber, + alt->desc.bAlternateSetting); }static int uas_configure_endpoints (struct uas_dev_info *devinfo)
drivers/usb/storage/unusual_devs.h +7 -0
@@ -1459,6 +1459,13 @@ UNUSUAL_DEV( 0x0bc2, 0x3010, 0x0000, 0x0000, USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_SANE_SENSE ), +/* Reported by Kris Lindgren <[email protected]> */ +UNUSUAL_DEV (0x0bc2 ,0x3332 ,0x0000 ,0x9999 , +"Seagate" , +"External" , +USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , +US_FL_NO_WP_DETECT ), + UNUSUAL_DEV( 0x0d49, 0x7310, 0x0000, 0x9999, "Maxtor", "USB to SATA",
drivers/uwb/hwa-rc.c +2 -0
@@ -825,6 +825,8 @@ static int hwarc_probe(struct usb_interface *iface,if (iface->cur_altsetting->desc.bNumEndpoints <1 )return -ENODEV ; +if (!usb_endpoint_xfer_int (&iface->cur_altsetting->endpoint[0 ].desc)) +return -ENODEV ; result = -ENOMEM ; uwb_rc =uwb_rc_alloc ();
drivers/uwb/uwbd.c +8 -4
@@ -302,18 +302,22 @@ static int uwbd(void *param)/** Start the UWB daemon */ void uwbd_start (struct uwb_rc *rc) { - rc->uwbd.task =kthread_run (uwbd, rc,"uwbd" ); -if (rc->uwbd.task ==NULL ) +struct task_struct *task =kthread_run (uwbd, rc,"uwbd" ); +if (IS_ERR (task)) { + rc->uwbd.task =NULL ;printk (KERN_ERR "UWB: Cannot start management daemon; " "UWB won't work\n" ); -else + }else { + rc->uwbd.task = task; rc->uwbd.pid = rc->uwbd.task->pid; + } }/* Stop the UWB daemon and free any unprocessed events */ void uwbd_stop (struct uwb_rc *rc) { -kthread_stop (rc->uwbd.task); +if (rc->uwbd.task) +kthread_stop (rc->uwbd.task);uwbd_flush (rc); }
fs/btrfs/ctree.h +1 -1
@@ -723,7 +723,7 @@ struct btrfs_delayed_root;* Indicate that a whole-filesystem exclusive operation is running * (device replace, resize, device add/delete, balance) */ -#define BTRFS_FS_EXCL_OP 14 +#define BTRFS_FS_EXCL_OP 16struct btrfs_fs_info {u8 fsid[BTRFS_FSID_SIZE ];
fs/btrfs/extent_io.c +1 -1
@@ -2799,7 +2799,7 @@ static int submit_extent_page(int op, int op_flags, struct extent_io_tree *tree, } } - bio =btrfs_bio_alloc (bdev, sector <<9 ); + bio =btrfs_bio_alloc (bdev, (u64 )sector <<9 );bio_add_page (bio, page, page_size, offset); bio->bi_end_io = end_io_func; bio->bi_private = tree;
fs/overlayfs/copy_up.c +2 -4
@@ -561,10 +561,8 @@ static int ovl_do_copy_up(struct ovl_copy_up_ctx *c) c->tmpfile = true; err =ovl_copy_up_locked (c); }else { - err = -EIO ; -if (lock_rename (c->workdir, c->destdir) !=NULL ) { -pr_err ("overlayfs: failed to lock workdir+upperdir\n" ); - }else { + err =ovl_lock_rename_workdir (c->workdir, c->destdir); +if (!err) { err =ovl_copy_up_locked (c);unlock_rename (c->workdir, c->destdir); }
fs/overlayfs/dir.c +0 -20
@@ -216,26 +216,6 @@ static int ovl_create_upper(struct dentry *dentry, struct inode *inode,return err; } -static int ovl_lock_rename_workdir (struct dentry *workdir, -struct dentry *upperdir) -{ -/* Workdir should not be the same as upperdir */ -if (workdir == upperdir) - goto err; - -/* Workdir should not be subdir of upperdir and vice versa */ -if (lock_rename (workdir, upperdir) !=NULL ) - goto err_unlock; - -return 0 ; - -err_unlock: -unlock_rename (workdir, upperdir); -err: -pr_err ("overlayfs: failed to lock workdir+upperdir\n" ); -return -EIO ; -} -static struct dentry *ovl_clear_empty (struct dentry *dentry,struct list_head *list) {
fs/overlayfs/namei.c +1 -0
@@ -506,6 +506,7 @@ static struct dentry *ovl_lookup_index(struct dentry *dentry, index =lookup_one_len_unlocked (name.name, ofs->indexdir, name.len);if (IS_ERR (index)) { + err =PTR_ERR (index); pr_warn_ratelimited("overlayfs: failed inode index lookup (ino=%lu, key=%*s, err=%i);\n" "overlayfs: mount with '-o index=off' to disable inodes index.\n", d_inode(origin)->i_ino, name.len, name.name,
fs/overlayfs/overlayfs.h +1 -0
@@ -234,6 +234,7 @@ bool ovl_inuse_trylock(struct dentry *dentry);void ovl_inuse_unlock (struct dentry *dentry);int ovl_nlink_start (struct dentry *dentry,bool *locked);void ovl_nlink_end (struct dentry *dentry,bool locked); +int ovl_lock_rename_workdir (struct dentry *workdir,struct dentry *upperdir);static inline bool ovl_is_impuredir (struct dentry *dentry) {
fs/overlayfs/ovl_entry.h +3 -0
@@ -37,6 +37,9 @@ struct ovl_fs {bool noxattr;/* sb common to all layers */ struct super_block *same_sb; +/* Did we take the inuse lock? */ +bool upperdir_locked; +bool workdir_locked; };/* private information held for every overlayfs dentry */
fs/overlayfs/readdir.c +4 -2
@@ -672,6 +672,7 @@ int ovl_indexdir_cleanup(struct dentry *dentry, struct vfsmount *mnt, struct path *lowerstack, unsigned int numlower) { int err; +struct dentry *index =NULL ;struct inode *dir = dentry->d_inode;struct path path = { .mnt = mnt, .dentry = dentry };LIST_HEAD (list);
@@ -690,8 +691,6 @@ int ovl_indexdir_cleanup(struct dentry *dentry, struct vfsmount *mnt,inode_lock_nested (dir,I_MUTEX_PARENT );list_for_each_entry (p, &list, l_node) { -struct dentry *index; -if (p->name[0 ] =='.' ) {if (p->len ==1 )continue ;
@@ -701,6 +700,7 @@ int ovl_indexdir_cleanup(struct dentry *dentry, struct vfsmount *mnt, index =lookup_one_len (p->name, dentry, p->len);if (IS_ERR (index)) { err =PTR_ERR (index); + index =NULL ;break ; } err =ovl_verify_index (index, lowerstack, numlower);
@@ -712,7 +712,9 @@ int ovl_indexdir_cleanup(struct dentry *dentry, struct vfsmount *mnt,break ; }dput (index); + index =NULL ; } +dput (index);inode_unlock (dir); out:ovl_cache_free (&list);
fs/overlayfs/super.c +19 -8
@@ -210,9 +210,10 @@ static void ovl_put_super(struct super_block *sb)dput (ufs->indexdir);dput (ufs->workdir); -ovl_inuse_unlock (ufs->workbasedir); +if (ufs->workdir_locked) +ovl_inuse_unlock (ufs->workbasedir);dput (ufs->workbasedir); -if (ufs->upper_mnt) +if (ufs->upper_mnt && ufs->upperdir_locked)ovl_inuse_unlock (ufs->upper_mnt->mnt_root);mntput (ufs->upper_mnt);for (i =0 ; i < ufs->numlower; i++)
@@ -880,9 +881,13 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) goto out_put_upperpath; err = -EBUSY ; -if (!ovl_inuse_trylock (upperpath.dentry)) { -pr_err ("overlayfs: upperdir is in-use by another mount\n" ); +if (ovl_inuse_trylock (upperpath.dentry)) { + ufs->upperdir_locked = true; + }else if (ufs->config.index) { +pr_err ("overlayfs: upperdir is in-use by another mount, mount with '-o index=off' to override exclusive upperdir protection.\n" ); goto out_put_upperpath; + }else { +pr_warn ("overlayfs: upperdir is in-use by another mount, accessing files from both mounts will result in undefined behavior.\n" ); } err =ovl_mount_dir (ufs->config.workdir, &workpath);
@@ -900,9 +905,13 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) } err = -EBUSY ; -if (!ovl_inuse_trylock (workpath.dentry)) { -pr_err ("overlayfs: workdir is in-use by another mount\n" ); +if (ovl_inuse_trylock (workpath.dentry)) { + ufs->workdir_locked = true; + }else if (ufs->config.index) { +pr_err ("overlayfs: workdir is in-use by another mount, mount with '-o index=off' to override exclusive workdir protection.\n" ); goto out_put_workpath; + }else { +pr_warn ("overlayfs: workdir is in-use by another mount, accessing files from both mounts will result in undefined behavior.\n" ); } ufs->workbasedir = workpath.dentry;
@@ -1155,11 +1164,13 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) out_free_lowertmp:kfree (lowertmp); out_unlock_workdentry: -ovl_inuse_unlock (workpath.dentry); +if (ufs->workdir_locked) +ovl_inuse_unlock (workpath.dentry); out_put_workpath:path_put (&workpath); out_unlock_upperdentry: -ovl_inuse_unlock (upperpath.dentry); +if (ufs->upperdir_locked) +ovl_inuse_unlock (upperpath.dentry); out_put_upperpath:path_put (&upperpath); out_free_config:
fs/overlayfs/util.c +23 -1
@@ -418,7 +418,7 @@ void ovl_inuse_unlock(struct dentry *dentry) } } -/* Called must hold OVL_I(inode)->oi_lock */ +/* Caller must hold OVL_I(inode)->lock */ static void ovl_cleanup_index (struct dentry *dentry) {struct inode *dir =ovl_indexdir (dentry->d_sb)->d_inode;
@@ -457,6 +457,9 @@ static void ovl_cleanup_index(struct dentry *dentry) err =PTR_ERR (index);if (!IS_ERR (index)) err =ovl_cleanup (dir, index); +else + index =NULL ; +inode_unlock (dir);if (err) goto fail;
@@ -545,3 +548,22 @@ void ovl_nlink_end(struct dentry *dentry, bool locked)mutex_unlock (&OVL_I (d_inode (dentry))->lock); } } + +int ovl_lock_rename_workdir (struct dentry *workdir,struct dentry *upperdir) +{ +/* Workdir should not be the same as upperdir */ +if (workdir == upperdir) + goto err; + +/* Workdir should not be subdir of upperdir and vice versa */ +if (lock_rename (workdir, upperdir) !=NULL ) + goto err_unlock; + +return 0 ; + +err_unlock: +unlock_rename (workdir, upperdir); +err: +pr_err ("overlayfs: failed to lock workdir+upperdir\n" ); +return -EIO ; +}
fs/userfaultfd.c +56 -10
87 lines not on this page · raw message
fs/xattr.c +1 -1
@@ -249,7 +249,7 @@ xattr_getsecurity(struct inode *inode, const char *name, void *value, }memcpy (value, buffer, len); out: -security_release_secctx (buffer, len); +kfree (buffer); out_noalloc:return len; }
include/asm-generic/percpu.h +22 -2
@@ -115,15 +115,35 @@ do { \ (__ret); \ }) -#define this_cpu_generic_read (pcp) \ +#define __this_cpu_generic_read_nopreempt (pcp) \ ({ \ typeof(pcp) __ret; \ preempt_disable_notrace(); \ - __ret = raw_cpu_generic_read(pcp); \
Lines of this file are not shown. View the raw message.
include/net/netlink.h +55 -18
73 lines not on this page · raw message
net/ipv4/route.c +26 -20
46 lines not on this page · raw message
net/l2tp/l2tp_eth.c +2 -49
51 lines not on this page · raw message
security/smack/smack_lsm.c +25 -30
55 lines not on this page · raw message
tools/testing/selftests/bpf/test_verifier.c +16 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.