Files
kernel_google_msm-4.14/kernel/locking/spinlock_debug.c
lucaswei 3eaaeb22db Merge android-4.14 (4.14.165) into android-msm-floral-4.14-lts
Merge 4.14.165 into android-4.14
    cuttlefish - enable CONFIG_NETFILTER_XT_MATCH_QUOTA2_LOG=y
    ANDROID: Enable HID_STEAM as y
Linux 4.14.165
    drm/i915/gen9: Clear residual context state on context switch
    netfilter: ipset: avoid null deref when IPSET_ATTR_LINENO is present
  * netfilter: arp_tables: init netns pointer in xt_tgchk_param struct
      net/ipv4/netfilter/arp_tables.c
    phy: cpcap-usb: Fix flakey host idling and enumerating of devices
    phy: cpcap-usb: Fix error path when no host driver is loaded
  * USB: Fix: Don't skip endpoint descriptors with maxpacket=0
      drivers/usb/core/config.c
  * HID: hiddev: fix mess in hiddev_open()
      drivers/hid/usbhid/hiddev.c
  * arm64: cpufeature: Avoid warnings due to unused symbols
      arch/arm64/kernel/cpufeature.c
    ath10k: fix memory leak
    rtl8xxxu: prevent leaking urb
    scsi: bfa: release allocated memory in case of error
    mwifiex: pcie: Fix memory leak in mwifiex_pcie_alloc_cmdrsp_buf
    mwifiex: fix possible heap overflow in mwifiex_process_country_ie()
  * tty: always relink the port
      drivers/tty/tty_port.c
  * tty: link tty and port before configuring it as console
      drivers/tty/serial/serial_core.c
      drivers/tty/tty_port.c
    staging: rtl8188eu: Add device code for TP-Link TL-WN727N v5.21
  * drm/dp_mst: correct the shifting in DP_REMOTE_I2C_READ
      drivers/gpu/drm/drm_dp_mst_topology.c
    drm/fb-helper: Round up bits_per_pixel if possible
  * Input: add safety guards to input_set_keycode()
      drivers/input/input.c
  * HID: hid-input: clear unmapped usages
      drivers/hid/hid-input.c
    staging: comedi: adv_pci1710: fix AI channels 16-31 for PCI-1713
    usb: musb: dma: Correct parameter passed to IRQ handler
    usb: musb: Disable pullup at init
    usb: musb: fix idling for suspend after disconnect interrupt
    USB: serial: option: add ZLP support for 0x1bc7/0x9010
    staging: vt6656: set usb_set_intfdata on driver fail.
    gpiolib: acpi: Add honor_wakeup module-option + quirk mechanism
    gpiolib: acpi: Turn dmi_system_id table into a generic quirk table
    can: can_dropped_invalid_skb(): ensure an initialized headroom in outgoing CAN sk_buffs
    can: mscan: mscan_rx_poll(): fix rx path lockup when returning from polling to irq mode
    can: gs_usb: gs_usb_probe(): use descriptors of current altsetting
  * HID: uhid: Fix returning EPOLLOUT from uhid_char_poll
      drivers/hid/uhid.c
  * HID: Fix slab-out-of-bounds read in hid_field_extract
      drivers/hid/hid-core.c
    tracing: Have stack tracer compile when MCOUNT_INSN_SIZE is not defined
    kernel/trace: Fix do not unregister tracepoints when register sched_migrate_task fail
    ALSA: hda/realtek - Set EAPD control to default for ALC222
    ALSA: hda/realtek - Add new codec supported for ALCS1200A
  * ALSA: usb-audio: Apply the sample rate quirk for Bose Companion 5
      sound/usb/quirks.c
    usb: chipidea: host: Disable port power only if previously enabled
  * chardev: Avoid potential use-after-free in 'chrdev_open()'
      fs/char_dev.c
    Merge remote-tracking branch 'origin/upstream-f2fs-stable-linux-4.14.y' into android-4.14
  * UPSTREAM: kcov: fix struct layout for kcov_remote_arg
      include/uapi/linux/kcov.h
    UPSTREAM: vhost, kcov: collect coverage from vhost_worker
  * UPSTREAM: usb, kcov: collect coverage from hub_event
      drivers/usb/core/hub.c
  * BACKPORT: kcov: remote coverage support
      include/linux/kcov.h
      include/linux/sched.h
      include/uapi/linux/kcov.h
  * UPSTREAM: kcov: improve CONFIG_ARCH_HAS_KCOV help text
      lib/Kconfig.debug
    UPSTREAM: kcov: convert kcov.refcount to refcount_t
    UPSTREAM: kcov: no need to check return value of debugfs_create functions
    UPSTREAM: kernel/kcov.c: mark write_comp_data() as notrace
    UPSTREAM: kernel/kcov.c: mark funcs in __sanitizer_cov_trace_pc() as notrace
  * BACKPORT: sched/core / kcov: avoid kcov_area during task switch
      include/linux/kcov.h
      include/linux/sched.h
      kernel/sched/core.c
    UPSTREAM: kcov: prefault the kcov_area
  * BACKPORT: kcov: test compiler capability in Kconfig and correct dependency
      lib/Kconfig.debug
      scripts/Makefile.gcc-plugins
      scripts/Makefile.kcov
  * UPSTREAM: gcc-plugins: fix build condition of SANCOV plugin
      scripts/Makefile.gcc-plugins
    UPSTREAM: kcov: fix comparison callback signature
    UPSTREAM: kcov: update documentation
  * BACKPORT: Makefile: support flag -fsanitizer-coverage=trace-cmp
      Makefile
      lib/Kconfig.debug
      scripts/Makefile.kcov
  * BACKPORT: kcov: support comparison operands collection
      include/linux/kcov.h
      include/uapi/linux/kcov.h
    UPSTREAM: kcov: remove pointless current != NULL check
    Merge 4.14.164 into android-4.14
Linux 4.14.164
    vlan: fix memory leak in vlan_dev_set_egress_priority
  * net: sch_prio: When ungrafting, replace with FIFO
      net/sched/sch_prio.c
    vlan: vlan_changelink() should propagate errors
    vxlan: fix tos value before xmit
  * tcp: fix "old stuff" D-SACK causing SACK to be treated as D-SACK
      net/ipv4/tcp_input.c
    sctp: free cmd->obj.chunk for the unprocessed SCTP_CMD_REPLY
    USB: serial: option: add Telit ME910G1 0x110a composition
  * USB: core: fix check for duplicate endpoints
      drivers/usb/core/config.c
    pkt_sched: fq: do not accept silly TCA_FQ_QUANTUM
    net: usb: lan78xx: fix possible skb leak
    net: stmmac: dwmac-sunxi: Allow all RGMII modes
    net: stmmac: dwmac-sun8i: Allow all RGMII modes
    net: dsa: mv88e6xxx: Preserve priority when setting CPU port.
  * macvlan: do not assume mac_header is set in macvlan_broadcast()
      include/linux/if_ether.h
    gtp: fix bad unlock balance in gtp_encap_enable_socket
    mmc: block: propagate correct returned value in mmc_rpmb_ioctl
    mmc: core: Prevent bus reference leak in mmc_blk_init()
    mmc: block: Fix bug when removing RPMB chardev
    mmc: block: Delete mmc_access_rpmb()
    mmc: block: Convert RPMB to a character device
    PCI/switchtec: Read all 64 bits of part_event_bitmap
  * bpf: Fix passing modified ctx to ld/abs/ind instruction
      kernel/bpf/verifier.c
  * bpf: reject passing modified ctx to helper functions
      kernel/bpf/verifier.c
    hv_netvsc: Fix unwanted rx_table reset
    llc2: Fix return statement of llc_stat_ev_rx_null_dsap_xid_c (and _test_c)
    parisc: Fix compiler warnings in debug_core.c
  * block: fix memleak when __blk_rq_map_user_iov() is failed
      block/blk-map.c
    s390/dasd: fix memleak in path handling error case
    s390/dasd/cio: Interpret ccw_device_get_mdc return value correctly
    net: stmmac: RX buffer size must be 16 byte aligned
    net: stmmac: Do not accept invalid MTU values
  * fs: avoid softlockups in s_inodes iterators
      fs/drop_caches.c
      fs/inode.c
      fs/notify/fsnotify.c
      fs/quota/dquot.c
    perf/x86/intel: Fix PT PMI handling
  * kconfig: don't crash on NULL expressions in expr_eq()
      scripts/kconfig/expr.c
    regulator: rn5t618: fix module aliases
    ASoC: wm8962: fix lambda value
  * rfkill: Fix incorrect check to avoid NULL pointer dereference
      net/rfkill/core.c
    net: usb: lan78xx: Fix error message format specifier
    bnx2x: Fix logic to get total no. of PFs per engine
    bnx2x: Do not handle requests from VFs after parity
    powerpc: Ensure that swiotlb buffer is allocated from low memory
    samples: bpf: fix syscall_tp due to unused syscall
    samples: bpf: Replace symbol compare of trace_event
    ARM: dts: am437x-gp/epos-evm: fix panel compatible
    bpf, mips: Limit to 33 tail calls
    ARM: dts: bcm283x: Fix critical trip point
    ASoC: topology: Check return value for soc_tplg_pcm_create()
    spi: spi-cavium-thunderx: Add missing pci_release_regions()
    ARM: dts: Cygnus: Fix MDIO node address/size cells
    netfilter: nf_tables: validate NFT_SET_ELEM_INTERVAL_END
    netfilter: uapi: Avoid undefined left-shift in xt_sctp.h
    ARM: vexpress: Set-up shared OPP table instead of individual for each CPU
    efi/gop: Fix memory leak in __gop_query32/64()
    efi/gop: Return EFI_SUCCESS if a usable GOP was found
    efi/gop: Return EFI_NOT_FOUND if there are no usable GOPs
    x86/efi: Update e820 with reserved EFI boot services data to fix kexec breakage
    libtraceevent: Fix lib installation with O=
    mwifiex: Fix heap overflow in mmwifiex_process_tdls_action_frame()
  * netfilter: ctnetlink: netns exit must wait for callbacks
      net/netfilter/nf_conntrack_netlink.c
    locking/spinlock/debug: Fix various data races
    USB: dummy-hcd: increase max number of devices to 32
    USB: dummy-hcd: use usb_urb_dir_in instead of usb_pipein
    UPSTREAM: USB: dummy-hcd: use usb_urb_dir_in instead of usb_pipein
    UPSTREAM: USB: dummy-hcd: increase max number of devices to 32
    UPSTREAM: USB: dummy-hcd: Fix failure to give back unlinked URBs
    UPSTREAM: USB: dummy-hcd: bandwidth limits for non-bulk transfers
  * BACKPORT: perf_event: Add support for LSM and SELinux checks
      include/linux/lsm_hooks.h
      include/linux/perf_event.h
      include/linux/security.h
      kernel/events/core.c
      kernel/trace/trace_event_perf.c
      security/security.c
      security/selinux/hooks.c
      security/selinux/include/classmap.h
      security/selinux/include/objsec.h
    ANDROID: cuttlefish_defconfig: remove 80211_HWSIM
    docs: fs-verity: mention statx() support
  * f2fs: support STATX_ATTR_VERITY
      fs/f2fs/file.c
  * ext4: support STATX_ATTR_VERITY
      fs/ext4/inode.c
  * statx: define STATX_ATTR_VERITY
      include/linux/stat.h
      include/uapi/linux/stat.h
    docs: fs-verity: document first supported kernel version
  * f2fs: add support for IV_INO_LBLK_64 encryption policies
      fs/f2fs/super.c
  * ext4: add support for IV_INO_LBLK_64 encryption policies
      fs/ext4/ext4.h
      fs/ext4/super.c
  * fscrypt: add support for IV_INO_LBLK_64 policies
      fs/crypto/crypto.c
      fs/crypto/fscrypt_private.h
      fs/crypto/keyring.c
      fs/crypto/keysetup.c
      fs/crypto/policy.c
      include/linux/fscrypt.h
      include/uapi/linux/fscrypt.h
  * fscrypt: avoid data race on fscrypt_mode::logged_impl_name
      fs/crypto/fscrypt_private.h
      fs/crypto/keysetup.c
  * fscrypt: zeroize fscrypt_info before freeing
      fs/crypto/keysetup.c
  * fscrypt: remove struct fscrypt_ctx
      fs/crypto/bio.c
      fs/crypto/crypto.c
      fs/crypto/fscrypt_private.h
      include/linux/fscrypt.h
  * fscrypt: invoke crypto API for ESSIV handling
      fs/crypto/crypto.c
      fs/crypto/fscrypt_private.h
      fs/crypto/keysetup.c
      fs/crypto/keysetup_v1.c
    Merge 4.14.163 into android-4.14
  * Revert "BACKPORT: perf_event: Add support for LSM and SELinux checks"
      include/linux/lsm_hooks.h
      include/linux/perf_event.h
      include/linux/security.h
      kernel/events/core.c
      kernel/trace/trace_event_perf.c
      security/security.c
      security/selinux/hooks.c
      security/selinux/include/classmap.h
      security/selinux/include/objsec.h
Linux 4.14.163
    perf/x86/intel/bts: Fix the use of page_private()
    xen/blkback: Avoid unmapping unmapped grant pages
    s390/smp: fix physical to logical CPU map for SMT
  * net: add annotations on hh->hh_len lockless accesses
      include/net/neighbour.h
      net/core/neighbour.c
      net/ethernet/eth.c
    arm64: dts: meson: odroid-c2: Disable usb_otg bus to avoid power failed warning
    ath9k_htc: Discard undersized packets
    ath9k_htc: Modify byte order for an error message
    rxrpc: Fix possible NULL pointer access in ICMP handling
    selftests: rtnetlink: add addresses with fixed life time
    powerpc/pseries/hvconsole: Fix stack overread via udbg
  * drm/mst: Fix MST sideband up-reply failure handling
      drivers/gpu/drm/drm_dp_mst_topology.c
    scsi: qedf: Do not retry ELS request if qedf_alloc_cmd fails
  * fix compat handling of FICLONERANGE, FIDEDUPERANGE and FS_IOC_FIEMAP
      fs/compat_ioctl.c
    tty: serial: msm_serial: Fix lockup for sysrq and oops
    dt-bindings: clock: renesas: rcar-usb2-clock-sel: Fix typo in example
    media: usb: fix memory leak in af9005_identify_state
    regulator: ab8500: Remove AB8505 USB regulator
    media: flexcop-usb: ensure -EIO is returned on error condition
  * Bluetooth: Fix memory leak in hci_connect_le_scan
      net/bluetooth/hci_conn.c
  * Bluetooth: delete a stray unlock
      net/bluetooth/l2cap_core.c
    Bluetooth: btusb: fix PM leak in error case of setup
    platform/x86: pmc_atom: Add Siemens CONNECT X300 to critclk_systems DMI table
    xfs: don't check for AG deadlock for realtime files in bunmapi
    scsi: qla2xxx: Drop superfluous INIT_WORK of del_work
    nfsd4: fix up replay_matches_cache()
  * PM / devfreq: Check NULL governor in available_governors_show
      drivers/devfreq/devfreq.c
  * arm64: Revert support for execute-only user mappings
      arch/arm64/include/asm/pgtable-prot.h
      arch/arm64/include/asm/pgtable.h
      arch/arm64/mm/fault.c
      mm/mmap.c
    ftrace: Avoid potential division by zero in function profiler
  * exit: panic before exit_mm() on global init exit
      kernel/exit.c
    ALSA: firewire-motu: Correct a typo in the clock proc string
    ALSA: cs4236: fix error return comparison of an unsigned integer
    tracing: Have the histogram compare functions convert to u64 first
  * tracing: Fix lock inversion in trace_event_enable_tgid_record()
      kernel/trace/trace.c
      kernel/trace/trace_events.c
  * gpiolib: fix up emulated open drain outputs
      drivers/gpio/gpiolib.c
    ata: ahci_brcm: Fix AHCI resources management
    ata: ahci_brcm: Allow optional reset controller to be used
    ata: libahci_platform: Export again ahci_platform_<en/dis>able_phys()
  * compat_ioctl: block: handle BLKREPORTZONE/BLKRESETZONE
      block/compat_ioctl.c
  * compat_ioctl: block: handle Persistent Reservations
      block/compat_ioctl.c
  * dmaengine: Fix access to uninitialized dma_slave_caps
      include/linux/dmaengine.h
  * locks: print unsigned ino in /proc/locks
      fs/locks.c
  * pstore/ram: Write new dumps to start of recycled zones
      fs/pstore/ram.c
  * memcg: account security cred as well to kmemcg
      kernel/cred.c
  * mm/zsmalloc.c: fix the migrated zspage statistics.
      mm/zsmalloc.c
    media: cec: avoid decrementing transmit_queue_sz if it is 0
    media: cec: CEC 2.0-only bcast messages were ignored
    media: pulse8-cec: fix lost cec_transmit_attempt_done() call
    MIPS: Avoid VDSO ABI breakage due to global register variable
    drm/sun4i: hdmi: Remove duplicate cleanup calls
    ALSA: ice1724: Fix sleep-in-atomic in Infrasonic Quartet support code
  * drm: limit to INT_MAX in create_blob ioctl
      drivers/gpu/drm/drm_property.c
  * taskstats: fix data-race
      kernel/taskstats.c
    xfs: fix mount failure crash on invalid iclog memory access
    PM / hibernate: memory_bm_find_bit(): Tighten node optimisation
    xen/balloon: fix ballooned page accounting without hotplug enabled
    xen-blkback: prevent premature module unload
    IB/mlx4: Follow mirror sequence of device add during device removal
    s390/cpum_sf: Avoid SBD overflow condition in irq handler
    s390/cpum_sf: Adjust sampling interval to avoid hitting sample limits
    md: raid1: check rdev before reference in raid1_sync_request func
  * net: make socket read/write_iter() honor IOCB_NOWAIT
      net/socket.c
    usb: gadget: fix wrong endpoint desc
    drm/nouveau: Move the declaration of struct nouveau_conn_atom up a bit
    scsi: libsas: stop discovering if oob mode is disconnected
    scsi: iscsi: qla4xxx: fix double free in probe
    scsi: qla2xxx: Don't call qlt_async_event twice
    scsi: lpfc: Fix memory leak on lpfc_bsg_write_ebuf_set func
    rxe: correctly calculate iCRC for unaligned payloads
    RDMA/cma: add missed unregister_pernet_subsys in init failure
  * PM / devfreq: Don't fail devfreq_dev_release if not in list
      drivers/devfreq/devfreq.c
    iio: adc: max9611: Fix too short conversion time delay
    nvme_fc: add module to ops template to allow module references
  * UPSTREAM: selinux: sidtab reverse lookup hash table
      security/selinux/Kconfig
      security/selinux/include/security.h
      security/selinux/selinuxfs.c
      security/selinux/ss/context.h
      security/selinux/ss/policydb.c
      security/selinux/ss/services.c
      security/selinux/ss/services.h
      security/selinux/ss/sidtab.c
      security/selinux/ss/sidtab.h
  * UPSTREAM: selinux: avoid atomic_t usage in sidtab
      security/selinux/ss/sidtab.c
      security/selinux/ss/sidtab.h
  * UPSTREAM: selinux: check sidtab limit before adding a new entry
      security/selinux/ss/sidtab.c
  * UPSTREAM: selinux: fix context string corruption in convert_context()
      security/selinux/ss/services.c
  * BACKPORT: selinux: overhaul sidtab to fix bug and improve performance
      security/selinux/ss/mls.c
      security/selinux/ss/mls.h
      security/selinux/ss/services.c
      security/selinux/ss/sidtab.c
      security/selinux/ss/sidtab.h
  * UPSTREAM: selinux: refactor mls_context_to_sid() and make it stricter
      security/selinux/ss/mls.c
      security/selinux/ss/mls.h
      security/selinux/ss/services.c
  * UPSTREAM: selinux: Cleanup printk logging in services
      security/selinux/ss/services.c
  * UPSTREAM: scsi: ilog2: create truly constant version for sparse
      include/linux/log2.h
  * BACKPORT: selinux: use separate table for initial SID lookup
      security/selinux/ss/policydb.c
      security/selinux/ss/services.c
      security/selinux/ss/services.h
      security/selinux/ss/sidtab.c
      security/selinux/ss/sidtab.h
  * UPSTREAM: selinux: make "selinux_policycap_names[]" const char *
      security/selinux/include/security.h
      security/selinux/ss/services.c
  * UPSTREAM: selinux: refactor sidtab conversion
      security/selinux/ss/services.c
      security/selinux/ss/sidtab.c
      security/selinux/ss/sidtab.h
  * BACKPORT: selinux: wrap AVC state
      security/selinux/avc.c
      security/selinux/hooks.c
      security/selinux/include/avc.h
      security/selinux/include/avc_ss.h
      security/selinux/include/security.h
      security/selinux/netlabel.c
      security/selinux/selinuxfs.c
      security/selinux/ss/services.c
  * UPSTREAM: selinux: wrap selinuxfs state
      security/selinux/selinuxfs.c
  * UPSTREAM: selinux: rename the {is,set}_enforcing() functions
      security/selinux/avc.c
      security/selinux/hooks.c
      security/selinux/include/security.h
      security/selinux/selinuxfs.c
      security/selinux/ss/services.c
      security/selinux/ss/status.c
  * BACKPORT: selinux: wrap global selinux state
      security/selinux/avc.c
      security/selinux/hooks.c
      security/selinux/ibpkey.c
      security/selinux/include/avc.h
      security/selinux/include/avc_ss.h
      security/selinux/include/conditional.h
      security/selinux/include/objsec.h
      security/selinux/include/security.h
      security/selinux/netif.c
      security/selinux/netlabel.c
      security/selinux/netnode.c
      security/selinux/netport.c
      security/selinux/selinuxfs.c
      security/selinux/ss/avtab.c
      security/selinux/ss/avtab.h
      security/selinux/ss/ebitmap.c
      security/selinux/ss/ebitmap.h
      security/selinux/ss/hashtab.c
      security/selinux/ss/hashtab.h
      security/selinux/ss/mls.c
      security/selinux/ss/mls.h
      security/selinux/ss/services.c
      security/selinux/ss/services.h
      security/selinux/ss/status.c
  * UPSTREAM: selinux: Use kmem_cache for hashtab_node
      security/selinux/ss/hashtab.c
      security/selinux/ss/hashtab.h
      security/selinux/ss/services.c
  * BACKPORT: perf_event: Add support for LSM and SELinux checks
      include/linux/lsm_hooks.h
      include/linux/perf_event.h
      include/linux/security.h
      kernel/events/core.c
      kernel/trace/trace_event_perf.c
      security/security.c
      security/selinux/hooks.c
      security/selinux/include/classmap.h
      security/selinux/include/objsec.h
  * UPSTREAM: binder: Add binder_proc logging to binderfs
      drivers/android/binder.c
      drivers/android/binder_internal.h
  * UPSTREAM: binder: Make transaction_log available in binderfs
      drivers/android/binder.c
      drivers/android/binder_internal.h
  * UPSTREAM: binder: Add stats, state and transactions files
      drivers/android/binder.c
      drivers/android/binder_internal.h
    UPSTREAM: binder: add a mount option to show global stats
    UPSTREAM: binder: Validate the default binderfs device names.
  * UPSTREAM: binder: Add default binder devices through binderfs when configured
      drivers/android/binder.c
      drivers/android/binder_internal.h
  * UPSTREAM: binder: fix CONFIG_ANDROID_BINDER_DEVICES
      drivers/android/binder.c
  * UPSTREAM: android: binder: use kstrdup instead of open-coding it
      drivers/android/binder.c
  * UPSTREAM: binderfs: remove separate device_initcall()
      drivers/android/binder.c
      drivers/android/binder_internal.h
    BACKPORT: binderfs: respect limit on binder control creation
    UPSTREAM: binderfs: switch from d_add() to d_instantiate()
    UPSTREAM: binderfs: drop lock in binderfs_binder_ctl_create
    UPSTREAM: binderfs: kill_litter_super() before cleanup
    UPSTREAM: binderfs: rework binderfs_binder_device_create()
    UPSTREAM: binderfs: rework binderfs_fill_super()
    UPSTREAM: binderfs: prevent renaming the control dentry
    UPSTREAM: binderfs: remove outdated comment
    UPSTREAM: binderfs: fix error return code in binderfs_fill_super()
    UPSTREAM: binderfs: handle !CONFIG_IPC_NS builds
    BACKPORT: binderfs: reserve devices for initial mount
    UPSTREAM: binderfs: rename header to binderfs.h
    BACKPORT: binderfs: implement "max" mount option
    UPSTREAM: binderfs: make each binderfs mount a new instance
    UPSTREAM: binderfs: remove wrong kern_mount() call
  * BACKPORT: binder: implement binderfs
      drivers/android/Kconfig
      drivers/android/Makefile
      drivers/android/binder.c
      drivers/android/binder_internal.h
      include/uapi/linux/magic.h
  * UPSTREAM: binder: remove BINDER_DEBUG_ENTRY()
      drivers/android/binder.c
  * UPSTREAM: seq_file: Introduce DEFINE_SHOW_ATTRIBUTE() helper macro
      include/linux/seq_file.h
  * UPSTREAM: exit: panic before exit_mm() on global init exit
      kernel/exit.c
    Merge 4.14.162 into android-4.14
Linux 4.14.162
    spi: fsl: use platform_get_irq() instead of of_irq_to_resource()
    gtp: avoid zero size hashtable
    gtp: fix an use-after-free in ipv4_pdp_find()
    gtp: fix wrong condition in gtp_genl_dump_pdp()
  * tcp: do not send empty skb from tcp_write_xmit()
      net/ipv4/tcp_output.c
  * tcp/dccp: fix possible race __inet_lookup_established()
      include/linux/rculist_nulls.h
      include/net/inet_hashtables.h
      include/net/sock.h
      net/ipv4/inet_diag.c
      net/ipv4/inet_hashtables.c
      net/ipv4/tcp_ipv4.c
      net/ipv6/inet6_hashtables.c
    gtp: do not allow adding duplicate tid and ms_addr pdp context
  * sit: do not confirm neighbor when do pmtu update
      net/ipv6/sit.c
  * vti: do not confirm neighbor when do pmtu update
      net/ipv4/ip_vti.c
      net/ipv6/ip6_vti.c
  * tunnel: do not confirm neighbor when do pmtu update
      net/ipv4/ip_tunnel.c
      net/ipv6/ip6_tunnel.c
  * net/dst: add new function skb_dst_update_pmtu_no_confirm
      include/net/dst.h
    gtp: do not confirm neighbor when do pmtu update
    ip6_gre: do not confirm neighbor when do pmtu update
  * net: add bool confirm_neigh parameter for dst_ops.update_pmtu
      include/net/dst.h
      include/net/dst_ops.h
      net/ipv4/inet_connection_sock.c
      net/ipv4/route.c
      net/ipv4/xfrm4_policy.c
      net/ipv6/inet6_connection_sock.c
      net/ipv6/route.c
      net/ipv6/xfrm6_policy.c
    vhost/vsock: accept only packets with the right dst_cid
  * udp: fix integer overflow while computing available space in sk_rcvbuf
      net/ipv4/udp.c
  * ptp: fix the race between the release of ptp_clock and cdev
      include/linux/posix-clock.h
      kernel/time/posix-clock.c
    net/mlxfw: Fix out-of-memory error in mfa2 flash burning
    net: ena: fix napi handler misbehavior when the napi budget is zero
    pinctrl: baytrail: Really serialize all register accesses
    tty/serial: atmel: fix out of range clock divider handling
    spi: fsl: don't map irq during probe
  * hrtimer: Annotate lockless access to timer->state
      include/linux/hrtimer.h
      kernel/time/hrtimer.c
  * net: icmp: fix data-race in cmp_global_allow()
      net/ipv4/icmp.c
  * net: add a READ_ONCE() in skb_peek_tail()
      include/linux/skbuff.h
  * inetpeer: fix data-race in inet_putpeer / inet_putpeer
      net/ipv4/inetpeer.c
    netfilter: bridge: make sure to pull arp header in br_nf_forward_arp()
    6pack,mkiss: fix possible deadlock
  * netfilter: ebtables: compat: reject all padding in matches/watchers
      net/bridge/netfilter/ebtables.c
  * filldir[64]: remove WARN_ON_ONCE() for bad directory entries
      fs/readdir.c
  * Make filldir[64]() verify the directory entry filename is valid
      fs/readdir.c
    perf strbuf: Remove redundant va_end() in strbuf_addv()
  * bonding: fix active-backup transition after link failure
      drivers/net/bonding/bond_main.c
    ALSA: hda - Downgrade error message for single-cmd fallback
  * netfilter: nf_queue: enqueue skbs with NULL dst
      net/netfilter/nf_queue.c
  * net, sysctl: Fix compiler warning when only cBPF is present
      net/core/sysctl_net_core.c
    x86/mce: Fix possibly incorrect severity calculation on AMD
    userfaultfd: require CAP_SYS_PTRACE for UFFD_FEATURE_EVENT_FORK
  * kernel: sysctl: make drop_caches write-only
      kernel/sysctl.c
    ocfs2: fix passing zero to 'PTR_ERR' warning
    s390/cpum_sf: Check for SDBT and SDB consistency
  * libfdt: define INT32_MAX and UINT32_MAX in libfdt_env.h
      include/linux/libfdt_env.h
    s390/zcrypt: handle new reply code FILTERED_BY_HYPERVISOR
    perf regs: Make perf_reg_name() return "unknown" instead of NULL
    perf script: Fix brstackinsn for AUXTRACE
    cdrom: respect device capabilities during opening action
  * scripts/kallsyms: fix definitely-lost memory leak
      scripts/kallsyms.c
    apparmor: fix unsigned len comparison with less than zero
    gpio: mpc8xxx: Don't overwrite default irq_set_type callback
    scsi: target: iscsi: Wait for all commands to finish before freeing a session
    scsi: iscsi: Don't send data to unbound connection
    scsi: NCR5380: Add disconnect_mask module parameter
    scsi: scsi_debug: num_tgts must be >= 0
  * scsi: ufs: Fix error handing during hibern8 enter
      drivers/scsi/ufs/ufshcd.c
    scsi: pm80xx: Fix for SATA device discovery
  * HID: Improve Windows Precision Touchpad detection.
      drivers/hid/hid-core.c
    libnvdimm/btt: fix variable 'rc' set but not used
    HID: logitech-hidpp: Silence intermittent get_battery_capacity errors
    bcache: at least try to shrink 1 node in bch_mca_scan()
    clk: pxa: fix one of the pxa RTC clocks
    scsi: atari_scsi: sun3_scsi: Set sg_tablesize to 1 instead of SG_NONE
    powerpc/security: Fix wrong message when RFI Flush is disable
    powerpc/pseries/cmm: Implement release() function for sysfs device
  * scsi: ufs: fix potential bug which ends in system hang
      drivers/scsi/ufs/ufshcd.c
    scsi: lpfc: fix: Coverity: lpfc_cmpl_els_rsp(): Null pointer dereferences
  * fs/quota: handle overflows of sysctl fs.quota.* and report as unsigned long
      fs/quota/dquot.c
      include/linux/quota.h
    irqchip: ingenic: Error out if IRQ domain creation failed
    irqchip/irq-bcm7038-l1: Enable parent IRQ if necessary
  * clk: qcom: Allow constant ratio freq tables for rcg
      drivers/clk/qcom/clk-rcg2.c
      drivers/clk/qcom/common.c
  * f2fs: fix to update dir's i_pino during cross_rename
      fs/f2fs/namei.c
    scsi: lpfc: Fix duplicate unreg_rpi error in port offline flow
  * scsi: tracing: Fix handling of TRANSFER LENGTH == 0 for READ(6) and WRITE(6)
      drivers/scsi/scsi_trace.c
  * jbd2: Fix statistics for the number of logged blocks
      fs/jbd2/commit.c
  * ext4: update direct I/O read lock pattern for IOCB_NOWAIT
      fs/ext4/inode.c
    powerpc/book3s64/hash: Add cond_resched to avoid soft lockup warning
    powerpc/security/book3s64: Report L1TF status in sysfs
    clocksource/drivers/asm9260: Add a check for of_clk_get
    dma-debug: add a schedule point in debug_dma_dump_mappings()
    powerpc/tools: Don't quote $objdump in scripts
    powerpc/pseries: Don't fail hash page table insert for bolted mapping
    powerpc/pseries: Mark accumulate_stolen_time() as notrace
    scsi: csiostor: Don't enable IRQs too early
    scsi: lpfc: Fix SLI3 hba in loop mode not discovering devices
    scsi: target: compare full CHAP_A Algorithm strings
    iommu/tegra-smmu: Fix page tables in > 4 GiB memory
    Input: atmel_mxt_ts - disable IRQ across suspend
    scsi: lpfc: Fix locking on mailbox command completion
    scsi: mpt3sas: Fix clear pending bit in ioctl status
    scsi: lpfc: Fix discovery failures when target device connectivity bounces
  * ANDROID: serdev: Fix platform device support
      drivers/tty/serdev/core.c
    Merge 4.14.161 into android-4.14
Linux 4.14.161
    perf probe: Fix to show function entry line as probe-able
    nbd: fix shutdown and recv work deadlock v2
    mmc: sdhci-of-esdhc: fix P2020 errata handling
    mmc: sdhci: Update the tuning failed messages to pr_debug level
    mmc: sdhci-of-esdhc: Revert "mmc: sdhci-of-esdhc: add erratum A-009204 support"
    powerpc/irq: fix stack overflow verification
    x86/MCE/AMD: Allow Reserved types to be overwritten in smca_banks[]
    x86/MCE/AMD: Do not use rdmsr_safe_on_cpu() in smca_configure()
    KVM: arm64: Ensure 'params' is initialised when looking up sys register
  * ext4: unlock on error in ext4_expand_extra_isize()
      fs/ext4/inode.c
  * ext4: check for directory entries too close to block end
      fs/ext4/dir.c
  * ext4: fix ext4_empty_dir() for directories with holes
      fs/ext4/namei.c
    staging: comedi: gsc_hpdi: check dma_alloc_coherent() return value
    platform/x86: hp-wmi: Make buffer for HPWMI_FEATURE2_QUERY 128 bytes
    intel_th: pci: Add Elkhart Lake SOC support
    intel_th: pci: Add Comet Lake PCH-V support
    USB: EHCI: Do not return -EPIPE when hub is disconnected
    usbip: Fix error path of vhci_recv_ret_submit()
    usbip: Fix receive error in vhci-hcd when using scatter-gather
    btrfs: abort transaction after failed inode updates in create_subvol
    btrfs: return error pointer from alloc_test_extent_buffer
    s390/ftrace: fix endless recursion in function_graph tracer
  * usb: xhci: Fix build warning seen with CONFIG_PM=n
      drivers/usb/host/xhci-pci.c
    mmc: mediatek: fix CMD_TA to 2 for MT8173 HS200/HS400 mode
    Revert "mmc: sdhci: Fix incorrect switch to HS mode"
    btrfs: don't prematurely free work in scrub_missing_raid56_worker()
    btrfs: don't prematurely free work in reada_start_machine_worker()
  * net: phy: initialise phydev speed and duplex sanely
      drivers/net/phy/phy_device.c
    mips: fix build when "48 bits virtual memory" is enabled
    libtraceevent: Fix memory leakage in copy_filter_type
    crypto: vmx - Avoid weird build failures
    mac80211: consider QoS Null frames for STA_NULLFUNC_ACKED
    crypto: sun4i-ss - Fix 64-bit size_t warnings on sun4i-ss-hash.c
    crypto: sun4i-ss - Fix 64-bit size_t warnings
    fbtft: Make sure string is NULL terminated
    iwlwifi: check kasprintf() return value
    x86/insn: Add some Intel instructions to the opcode map
    spi: st-ssc4: add missed pm_runtime_disable
    btrfs: don't prematurely free work in run_ordered_work()
    btrfs: don't prematurely free work in end_workqueue_fn()
    mmc: tmio: Add MMC_CAP_ERASE to allow erase/discard/trim requests
    crypto: virtio - deal with unsupported input sizes
    spi: tegra20-slink: add missed clk_unprepare
    iwlwifi: mvm: fix unaligned read of rx_pkt_status
    x86/crash: Add a forward declaration of struct kimage
  * cpufreq: Register drivers only after CPU devices have been registered
      drivers/cpufreq/cpufreq.c
    parport: load lowlevel driver if ports not found
    s390/disassembler: don't hide instruction addresses
    ASoC: Intel: kbl_rt5663_rt5514_max98927: Add dmic format constraint
    ASoC: rt5677: Mark reg RT5677_PWR_ANLG2 as volatile
    spi: pxa2xx: Add missed security checks
    EDAC/ghes: Fix grain calculation
    media: si470x-i2c: add missed operations in remove
    media: pvrusb2: Fix oops on tear-down when radio support is not present
    fsi: core: Fix small accesses and unaligned offsets via sysfs
    ath10k: fix get invalid tx rate for Mesh metric
    perf probe: Filter out instances except for inlined subroutine and subprogram
    perf probe: Skip end-of-sequence and non statement lines
    perf probe: Fix to show calling lines of inlined functions
    perf probe: Return a better scope DIE if there is no best scope
    perf probe: Skip overlapped location on searching variables
    perf parse: If pmu configuration fails free terms
    drm/amdgpu: fix potential double drop fence reference
    perf probe: Fix to probe a function which has no entry pc
    libsubcmd: Use -O0 with DEBUG=1
    perf probe: Fix to show inlined function callsite without entry_pc
    perf probe: Fix to show ranges of variables in functions without entry_pc
    perf probe: Fix to probe an inline function which has no entry pc
    perf probe: Walk function lines in lexical blocks
    perf probe: Fix to list probe event with correct line number
    perf probe: Fix to find range-only function instance
    rtlwifi: fix memory leak in rtl92c_set_fw_rsvdpagepkt()
  * ALSA: timer: Limit max amount of slave instances
      sound/core/timer.c
    spi: img-spfi: fix potential double release
    bnx2x: Fix PF-VF communication over multi-cos queues.
  * rfkill: allocate static minor
      include/linux/miscdevice.h
      net/rfkill/core.c
  * media: v4l2-core: fix touch support in v4l_g_fmt
      drivers/media/v4l2-core/v4l2-ioctl.c
    media: rcar_drif: fix a memory disclosure
    ixgbe: protect TX timestamping from API misuse
    pinctrl: amd: fix __iomem annotation in amd_gpio_irq_handler()
  * Bluetooth: Fix advertising duplicated flags
      net/bluetooth/hci_request.c
    iio: dln2-adc: fix iio_triggered_buffer_postenable() position
    pinctrl: sh-pfc: sh7734: Fix duplicate TCLK1_B
  * loop: fix no-unmap write-zeroes request behavior
      drivers/block/loop.c
    libata: Ensure ata_port probe has completed before detach
    s390/mm: add mm_pxd_folded() checks to pxd_free()
    s390/time: ensure get_clock_monotonic() returns monotonic values
    phy: qcom-usb-hs: Fix extcon double register after power cycle
  * net: dsa: LAN9303: select REGMAP when LAN9303 enable
      drivers/net/dsa/Kconfig
    gpu: host1x: Allocate gather copy for host1x
    RDMA/qedr: Fix memory leak in user qp and mr
    net: phy: dp83867: enable robust auto-mdix
  * arm64: psci: Reduce the waiting time for cpu_psci_cpu_kill()
      arch/arm64/kernel/psci.c
    x86/ioapic: Prevent inconsistent state when moving an interrupt
    rtl8xxxu: fix RTL8723BU connection failure issue after warm reboot
    drm/gma500: fix memory disclosures due to uninitialized bytes
    x86/mce: Lower throttling MCE messages' priority to warning
  * Bluetooth: hci_core: fix init for HCI_USER_CHANNEL
      net/bluetooth/hci_core.c
  * Bluetooth: missed cpu_to_le16 conversion in hci_init4_req
      net/bluetooth/hci_core.c
    iio: adc: max1027: Reset the device at probe time
  * usb: usbfs: Suppress problematic bind and unbind uevents.
      drivers/usb/core/devio.c
    perf report: Add warning when libunwind not compiled in
    perf test: Report failure for mmap events
    drm/bridge: dw-hdmi: Restore audio when setting a mode
    x86/mm: Use the correct function type for native_set_fixmap()
    extcon: sm5502: Reset registers during initialization
    media: ti-vpe: vpe: fix a v4l2-compliance failure about invalid sizeimage
    media: ti-vpe: vpe: ensure buffers are cleaned up properly in abort cases
    media: ti-vpe: vpe: fix a v4l2-compliance failure causing a kernel panic
    media: ti-vpe: vpe: Make sure YUYV is set as default format
    media: ti-vpe: vpe: fix a v4l2-compliance failure about frame sequence number
    media: ti-vpe: vpe: fix a v4l2-compliance warning about invalid pixel format
    media: ti-vpe: vpe: Fix Motion Vector vpdma stride
    media: cx88: Fix some error handling path in 'cx8800_initdev()'
    mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring
    block: Fix writeback throttling W=1 compiler warnings
    samples: pktgen: fix proc_cmd command result check logic
    drm/bridge: dw-hdmi: Refuse DDC/CI transfers on the internal I2C controller
    media: cec-funcs.h: add status_req checks
    media: flexcop-usb: fix NULL-ptr deref in flexcop_usb_transfer_init()
    regulator: max8907: Fix the usage of uninitialized variable in max8907_regulator_probe()
    hwrng: omap3-rom - Call clk_disable_unprepare() on exit only if not idled
    usb: renesas_usbhs: add suspend event support in gadget mode
    selftests/bpf: Correct path to include msg + path
  * pinctrl: devicetree: Avoid taking direct reference to device name string
      drivers/pinctrl/devicetree.c
    ath10k: fix offchannel tx failure when no ath10k_mac_tx_frm_has_freq
    media: venus: core: Fix msm8996 frequency table
    tools/power/cpupower: Fix initializer override in hsw_ext_cstates
    media: ov6650: Fix stored crop rectangle not in sync with hardware
    media: ov6650: Fix stored frame format not in sync with hardware
    media: i2c: ov2659: Fix missing 720p register config
    media: ov6650: Fix crop rectangle alignment not passed back
    media: i2c: ov2659: fix s_stream return value
    media: am437x-vpfe: Setting STD to current value is not an error
    IB/iser: bound protection_sg size by data_sg size
    libertas: fix a potential NULL pointer dereference
    rtlwifi: prevent memory leak in rtl_usb_probe
    staging: rtl8188eu: fix possible null dereference
    staging: rtl8192u: fix multiple memory leaks on error path
  * spi: Add call to spi_slave_abort() function when spidev driver is released
      drivers/spi/spidev.c
    iio: light: bh1750: Resolve compiler warning and make code more readable
    drm/bridge: analogix-anx78xx: silence -EPROBE_DEFER warnings
  * drm: mst: Fix query_payload ack reply struct
      include/drm/drm_dp_mst_helper.h
    ALSA: hda/ca0132 - Avoid endless loop
    ALSA: hda/ca0132 - Keep power on during processing DSP response
  * ALSA: pcm: Avoid possible info leaks from PCM stream buffers
      sound/core/pcm_native.c
    Btrfs: fix removal logic of the tree mod log that leads to use-after-free issues
    btrfs: handle ENOENT in btrfs_uuid_tree_iterate
    btrfs: do not leak reloc root if we fail to read the fs root
    btrfs: skip log replay on orphaned roots
    btrfs: do not call synchronize_srcu() in inode_tree_del
    btrfs: don't double lock the subvol_sem for rename exchange
    sctp: fully initialize v4 addr in some functions
    qede: Fix multicast mac configuration
    net: usb: lan78xx: Fix suspend/resume PHY register access error
    net: qlogic: Fix error paths in ql_alloc_large_buffers()
    net: nfc: nci: fix a possible sleep-in-atomic-context bug in nci_uart_tty_receive()
    net: hisilicon: Fix a BUG trigered by wrong bytes_compl
  * net: dst: Force 4-byte alignment of dst_metrics
      include/net/dst.h
  * mod_devicetable: fix PHY module format
      include/linux/mod_devicetable.h
    fjes: fix missed check in fjes_acpi_add
  * af_packet: set defaule value for tmo
      net/packet/af_packet.c
    ANDROID: cuttlefish_defconfig: Disable TRANSPARENT_HUGEPAGE

Change-Id: If5fe1dee627f430a68a27040c29f1015fd7c5ed1
Signed-off-by: lucaswei <lucaswei@google.com>
2020-02-14 11:04:53 +08:00

239 lines
5.9 KiB
C

/*
* Copyright 2005, Red Hat, Inc., Ingo Molnar
* Released under the General Public License (GPL).
*
* This file contains the spinlock/rwlock implementations for
* DEBUG_SPINLOCK.
*/
#include <linux/spinlock.h>
#include <linux/nmi.h>
#include <linux/interrupt.h>
#include <linux/debug_locks.h>
#include <linux/delay.h>
#include <linux/export.h>
#include <linux/bug.h>
#include <soc/qcom/watchdog.h>
void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name,
struct lock_class_key *key)
{
#ifdef CONFIG_DEBUG_LOCK_ALLOC
/*
* Make sure we are not reinitializing a held lock:
*/
debug_check_no_locks_freed((void *)lock, sizeof(*lock));
lockdep_init_map(&lock->dep_map, name, key, 0);
#endif
lock->raw_lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED;
lock->magic = SPINLOCK_MAGIC;
lock->owner = SPINLOCK_OWNER_INIT;
lock->owner_cpu = -1;
}
EXPORT_SYMBOL(__raw_spin_lock_init);
void __rwlock_init(rwlock_t *lock, const char *name,
struct lock_class_key *key)
{
#ifdef CONFIG_DEBUG_LOCK_ALLOC
/*
* Make sure we are not reinitializing a held lock:
*/
debug_check_no_locks_freed((void *)lock, sizeof(*lock));
lockdep_init_map(&lock->dep_map, name, key, 0);
#endif
lock->raw_lock = (arch_rwlock_t) __ARCH_RW_LOCK_UNLOCKED;
lock->magic = RWLOCK_MAGIC;
lock->owner = SPINLOCK_OWNER_INIT;
lock->owner_cpu = -1;
}
EXPORT_SYMBOL(__rwlock_init);
static void spin_dump(raw_spinlock_t *lock, const char *msg)
{
struct task_struct *owner = READ_ONCE(lock->owner);
if (owner == SPINLOCK_OWNER_INIT)
owner = NULL;
printk(KERN_EMERG "BUG: spinlock %s on CPU#%d, %s/%d\n",
msg, raw_smp_processor_id(),
current->comm, task_pid_nr(current));
printk(KERN_EMERG " lock: %pS, .magic: %08x, .owner: %s/%d, "
".owner_cpu: %d\n",
lock, READ_ONCE(lock->magic),
owner ? owner->comm : "<none>",
owner ? task_pid_nr(owner) : -1,
READ_ONCE(lock->owner_cpu));
#ifdef CONFIG_DEBUG_SPINLOCK_BITE_ON_BUG
msm_trigger_wdog_bite();
#elif defined(CONFIG_DEBUG_SPINLOCK_PANIC_ON_BUG)
BUG();
#endif
dump_stack();
}
static void spin_bug(raw_spinlock_t *lock, const char *msg)
{
if (!debug_locks_off())
return;
spin_dump(lock, msg);
}
#define SPIN_BUG_ON(cond, lock, msg) if (unlikely(cond)) spin_bug(lock, msg)
static inline void
debug_spin_lock_before(raw_spinlock_t *lock)
{
SPIN_BUG_ON(READ_ONCE(lock->magic) != SPINLOCK_MAGIC, lock, "bad magic");
SPIN_BUG_ON(READ_ONCE(lock->owner) == current, lock, "recursion");
SPIN_BUG_ON(READ_ONCE(lock->owner_cpu) == raw_smp_processor_id(),
lock, "cpu recursion");
}
static inline void debug_spin_lock_after(raw_spinlock_t *lock)
{
WRITE_ONCE(lock->owner_cpu, raw_smp_processor_id());
WRITE_ONCE(lock->owner, current);
}
static inline void debug_spin_unlock(raw_spinlock_t *lock)
{
SPIN_BUG_ON(lock->magic != SPINLOCK_MAGIC, lock, "bad magic");
SPIN_BUG_ON(!raw_spin_is_locked(lock), lock, "already unlocked");
SPIN_BUG_ON(lock->owner != current, lock, "wrong owner");
SPIN_BUG_ON(lock->owner_cpu != raw_smp_processor_id(),
lock, "wrong CPU");
WRITE_ONCE(lock->owner, SPINLOCK_OWNER_INIT);
WRITE_ONCE(lock->owner_cpu, -1);
}
/*
* We are now relying on the NMI watchdog to detect lockup instead of doing
* the detection here with an unfair lock which can cause problem of its own.
*/
void do_raw_spin_lock(raw_spinlock_t *lock)
{
debug_spin_lock_before(lock);
arch_spin_lock(&lock->raw_lock);
debug_spin_lock_after(lock);
}
int do_raw_spin_trylock(raw_spinlock_t *lock)
{
int ret = arch_spin_trylock(&lock->raw_lock);
if (ret)
debug_spin_lock_after(lock);
#ifndef CONFIG_SMP
/*
* Must not happen on UP:
*/
SPIN_BUG_ON(!ret, lock, "trylock failure on UP");
#endif
return ret;
}
void do_raw_spin_unlock(raw_spinlock_t *lock)
{
debug_spin_unlock(lock);
arch_spin_unlock(&lock->raw_lock);
}
static void rwlock_bug(rwlock_t *lock, const char *msg)
{
if (!debug_locks_off())
return;
printk(KERN_EMERG "BUG: rwlock %s on CPU#%d, %s/%d, %p\n",
msg, raw_smp_processor_id(), current->comm,
task_pid_nr(current), lock);
#ifdef CONFIG_DEBUG_SPINLOCK_BITE_ON_BUG
msm_trigger_wdog_bite();
#elif defined(CONFIG_DEBUG_SPINLOCK_PANIC_ON_BUG)
BUG();
#endif
dump_stack();
}
#define RWLOCK_BUG_ON(cond, lock, msg) if (unlikely(cond)) rwlock_bug(lock, msg)
void do_raw_read_lock(rwlock_t *lock)
{
RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic");
arch_read_lock(&lock->raw_lock);
}
int do_raw_read_trylock(rwlock_t *lock)
{
int ret = arch_read_trylock(&lock->raw_lock);
#ifndef CONFIG_SMP
/*
* Must not happen on UP:
*/
RWLOCK_BUG_ON(!ret, lock, "trylock failure on UP");
#endif
return ret;
}
void do_raw_read_unlock(rwlock_t *lock)
{
RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic");
arch_read_unlock(&lock->raw_lock);
}
static inline void debug_write_lock_before(rwlock_t *lock)
{
RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic");
RWLOCK_BUG_ON(lock->owner == current, lock, "recursion");
RWLOCK_BUG_ON(lock->owner_cpu == raw_smp_processor_id(),
lock, "cpu recursion");
}
static inline void debug_write_lock_after(rwlock_t *lock)
{
WRITE_ONCE(lock->owner_cpu, raw_smp_processor_id());
WRITE_ONCE(lock->owner, current);
}
static inline void debug_write_unlock(rwlock_t *lock)
{
RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic");
RWLOCK_BUG_ON(lock->owner != current, lock, "wrong owner");
RWLOCK_BUG_ON(lock->owner_cpu != raw_smp_processor_id(),
lock, "wrong CPU");
WRITE_ONCE(lock->owner, SPINLOCK_OWNER_INIT);
WRITE_ONCE(lock->owner_cpu, -1);
}
void do_raw_write_lock(rwlock_t *lock)
{
debug_write_lock_before(lock);
arch_write_lock(&lock->raw_lock);
debug_write_lock_after(lock);
}
int do_raw_write_trylock(rwlock_t *lock)
{
int ret = arch_write_trylock(&lock->raw_lock);
if (ret)
debug_write_lock_after(lock);
#ifndef CONFIG_SMP
/*
* Must not happen on UP:
*/
RWLOCK_BUG_ON(!ret, lock, "trylock failure on UP");
#endif
return ret;
}
void do_raw_write_unlock(rwlock_t *lock)
{
debug_write_unlock(lock);
arch_write_unlock(&lock->raw_lock);
}