63 Commits

Author SHA1 Message Date
Sultan Alsawaf
3c155937e3 string: Use faster alternatives when constant arguments are used
When strcpy, strcat, and strcmp are used with a literal string, they can
be optimized to memcpy or memcmp calls. These alternatives are faster
since knowing the length of a string argument beforehand allows
traversal through the string word at a time without being concerned
about looking for the terminating zero character. In some cases, the
replaced calls to memcpy or memcmp can even be optimized out completely
for a significant speed up.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2024-08-13 23:01:44 +05:30
Lucas Wei
65e475187b Merge android-4.9-q (4.9.279) into android-msm-pixel-4.9-sc-lts
Merge 4.9.279 into android-4.9-q
Linux 4.9.279
    spi: mediatek: Fix fifo transfer
    can: raw: raw_setsockopt(): fix raw_rcv panic for sock UAF
  * Revert "Bluetooth: Shutdown controller after workqueues are flushed or cancelled"
      net/bluetooth/hci_core.c
  * net: Fix zero-copy head len calculation.
      net/core/skbuff.c
  * r8152: Fix potential PM refcount imbalance
      drivers/net/usb/r8152.c
    regulator: rt5033: Fix n_voltages settings for BUCK and LDO
    btrfs: mark compressed range uptodate only if all bio succeed
    Merge 4.9.278 into android-4.9-q
Linux 4.9.278
    sis900: Fix missing pci_disable_device() in probe and remove
    tulip: windbond-840: Fix missing pci_disable_device() in probe and remove
    net/mlx5: Fix flow table chaining
  * net: llc: fix skb_over_panic
      include/net/llc_pdu.h
    mlx4: Fix missing error code in mlx4_load_one()
    tipc: fix sleeping in tipc accept routine
    netfilter: nft_nat: allow to specify layer 4 protocol NAT only
  * netfilter: conntrack: adjust stop timestamp to real expiry value
      net/netfilter/nf_conntrack_core.c
  * cfg80211: Fix possible memory leak in function cfg80211_bss_update
      net/wireless/scan.c
    x86/asm: Ensure asm/proto.h can be included stand-alone
    nfc: nfcsim: fix use after free during module unload
    NIU: fix incorrect error return, missed in previous revert
    can: esd_usb2: fix memory leak
    can: ems_usb: fix memory leak
    can: usb_8dev: fix memory leak
    ocfs2: issue zeroout to EOF blocks
    ocfs2: fix zero out valid data
    x86/kvm: fix vcpu-id indexed array sizes
    ARM: ensure the signal page contains defined contents
  * lib/string.c: add multibyte memset functions
      include/linux/string.h
      lib/string.c
    ARM: dts: versatile: Fix up interrupt controller node names
    hfs: add lock nesting notation to hfs_find_init
    hfs: fix high memory mapping in hfs_bnode_read
    hfs: add missing clean-up in hfs_fill_super
  * sctp: move 198 addresses from unusable to private scope
      include/net/sctp/constants.h
    net/802/garp: fix memleak in garp_request_join()
    net/802/mrp: fix memleak in mrp_request_join()
  * workqueue: fix UAF in pwq_unbound_release_workfn()
      kernel/workqueue.c
  * af_unix: fix garbage collect vs MSG_PEEK
      net/unix/af_unix.c
  * net: split out functions related to registering inflight socket files
      include/net/af_unix.h
      net/Makefile
      net/unix/Kconfig
      net/unix/Makefile
      net/unix/af_unix.c
      net/unix/garbage.c
      net/unix/scm.c
      net/unix/scm.h
    tipc: Fix backport of b77413446408fdd256599daf00d5be72b5f3e7c6
    iommu/amd: Fix backport of 140456f994195b568ecd7fc2287a34eadffef3ca
    Merge 4.9.277 into android-4.9-q
Linux 4.9.277
    btrfs: compression: don't try to compress if we don't have enough pages
    iio: accel: bma180: Fix BMA25x bandwidth register values
    iio: accel: bma180: Use explicit member assignment
    net: bcmgenet: ensure EXT_ENERGY_DET_MASK is clear
    media: ngene: Fix out-of-bounds bug in ngene_command_config_free_buf()
  * tracing: Fix bug in rb_per_cpu_empty() that might cause deadloop.
      kernel/trace/ring_buffer.c
    USB: serial: cp210x: add ID for CEL EM3588 USB ZigBee stick
    USB: serial: cp210x: fix comments for GE CS1000
    USB: serial: option: add support for u-blox LARA-R6 family
    usb: renesas_usbhs: Fix superfluous irqs happen after usb_pkt_pop()
    usb: max-3421: Prevent corruption of freed memory
    USB: usb-storage: Add LaCie Rugged USB3-FW to IGNORE_UAS
  * usb: hub: Disable USB 3 device initiated lpm if exit latency is too high
      drivers/usb/core/hub.c
    KVM: PPC: Book3S: Fix H_RTAS rets buffer overflow
  * xhci: Fix lost USB 2 remote wake
      drivers/usb/host/xhci-hub.c
    ALSA: sb: Fix potential ABBA deadlock in CSP driver
    s390/ftrace: fix ftrace_update_ftrace_func implementation
    Revert "MIPS: add PMD table accounting into MIPS'pmd_alloc_one"
  * proc: Avoid mixing integer types in mem_rw()
      fs/proc/base.c
  * Revert "USB: quirks: ignore remote wake-up on Fibocom L850-GL LTE modem"
      drivers/usb/core/quirks.c
    scsi: target: Fix protect handling in WRITE SAME(32)
    scsi: iscsi: Fix iface sysfs attr detection
    netrom: Decrease sock refcount when sock timers expire
    net: decnet: Fix sleeping inside in af_decnet
    net: fix uninit-value in caif_seqpkt_sendmsg
    s390/bpf: Perform r1 range checking before accessing jit->seen_reg[r1]
    spi: mediatek: fix fifo rx mode
    perf probe-file: Delete namelist in del_events() on the error path
    perf test bpf: Free obj_buf
    perf lzma: Close lzma stream on exit
    igb: Check if num of q_vectors is smaller than max before array access
    iavf: Fix an error handling path in 'iavf_probe()'
    e1000e: Fix an error handling path in 'e1000_probe()'
    fm10k: Fix an error handling path in 'fm10k_probe()'
    igb: Fix an error handling path in 'igb_probe()'
    ixgbe: Fix an error handling path in 'ixgbe_probe()'
  * ipv6: tcp: drop silly ICMPv6 packet too big messages
      net/ipv4/tcp_output.c
      net/ipv6/tcp_ipv6.c
  * tcp: annotate data races around tp->mtu_info
      net/ipv4/tcp_ipv4.c
      net/ipv6/tcp_ipv6.c
  * net: validate lwtstate->data before returning from skb_tunnel_info()
      include/net/dst_metadata.h
    net: ti: fix UAF in tlan_remove_one
    net: qcom/emac: fix UAF in emac_remove
    net: moxa: fix UAF in moxart_mac_probe
    net: bcmgenet: Ensure all TX/RX queues DMAs are disabled
  * net: bridge: sync fdb to new unicast-filtering ports
      net/bridge/br_if.c
  * net: ipv6: fix return value of ip6_skb_dst_mtu
      include/net/ip6_route.h
      net/ipv6/xfrm6_output.c
  * sched/fair: Fix CFS bandwidth hrtimer expiry type
      kernel/sched/fair.c
    scsi: aic7xxx: Fix unintentional sign extension issue on left shift of u8
    rtc: max77686: Do not enforce (incorrect) interrupt trigger type
  * kbuild: mkcompile_h: consider timestamp if KBUILD_BUILD_TIMESTAMP is set
      scripts/mkcompile_h
  * thermal/core: Correct function name thermal_zone_device_unregister()
      drivers/thermal/thermal_core.c
    arm64: dts: juno: Update SCPI nodes as per the YAML schema
    ARM: dts: stm32: fix RCC node name on stm32f429 MCU
    ARM: imx: pm-imx5: Fix references to imx5_cpu_suspend_info
    ARM: dts: imx6: phyFLEX: Fix UART hardware flow control
    ARM: dts: BCM63xx: Fix NAND nodes names
    ARM: brcmstb: dts: fix NAND nodes names
    reset: ti-syscon: fix to_ti_syscon_reset_data macro
    ARM: dts: rockchip: Fix power-controller node names for rk3288
    ARM: dts: rockchip: fix pinctrl sleep nodename for rk3036-kylin and rk3288
  * ANDROID: selinux: modify RTM_GETNEIGH{TBL}
      security/selinux/include/classmap.h
      security/selinux/include/security.h
      security/selinux/nlmsgtab.c
      security/selinux/ss/policydb.c
      security/selinux/ss/policydb.h
      security/selinux/ss/services.c
    Merge 4.9.276 into android-4.9-q
Linux 4.9.276
  * seq_file: disallow extremely large seq buffer allocations
      fs/seq_file.c
    MIPS: vdso: Invalid GIC access through VDSO
    mips: disable branch profiling in boot/decompress.o
    mips: always link byteswap helpers into decompressor
    scsi: be2iscsi: Fix an error handling path in beiscsi_dev_probe()
    ARM: dts: am335x: align ti,pindir-d0-out-d1-in property with dt-shema
    memory: fsl_ifc: fix leak of private memory on probe failure
    memory: fsl_ifc: fix leak of IO mapping on probe failure
  * reset: bail if try_module_get() fails
      drivers/reset/core.c
    ARM: dts: r8a7779, marzen: Fix DU clock names
  * rtc: fix snprintf() checking in is_rtc_hctosys()
      drivers/rtc/rtc-proc.c
    ARM: dts: exynos: fix PWM LED max brightness on Odroid XU4
    ARM: dts: exynos: fix PWM LED max brightness on Odroid XU/XU3
    hexagon: use common DISCARDS macro
    ALSA: isa: Fix error return code in snd_cmi8330_probe()
    x86/fpu: Limit xstate copy size in xstateregs_set()
    ubifs: Set/Clear I_LINKABLE under i_lock for whiteout inode
    nfs: fix acl memory leak of posix_acl_create()
    watchdog: aspeed: fix hardware timeout calculation
    um: fix error return code in winch_tramp()
    um: fix error return code in slip_open()
  * power: supply: rt5033_battery: Fix device tree enumeration
      drivers/power/supply/Kconfig
    PCI/sysfs: Fix dsm_label_utf16s_to_utf8s() buffer overrun
    virtio_console: Assure used length from device is limited
    virtio-blk: Fix memory leak among suspend/resume procedure
    ACPI: AMBA: Fix resource name in /proc/iomem
    pwm: tegra: Don't modify HW state in .remove callback
    power: supply: ab8500: add missing MODULE_DEVICE_TABLE
    power: supply: charger-manager: add missing MODULE_DEVICE_TABLE
    ceph: remove bogus checks and WARN_ONs from ceph_set_page_dirty
    orangefs: fix orangefs df output.
    x86/fpu: Return proper error codes from user access functions
    watchdog: Fix possible use-after-free by calling del_timer_sync()
    watchdog: sc520_wdt: Fix possible use-after-free in wdt_turnoff()
    watchdog: Fix possible use-after-free in wdt_startup()
    ARM: 9087/1: kprobes: test-thumb: fix for LLVM_IAS=1
    power: reset: gpio-poweroff: add missing MODULE_DEVICE_TABLE
    power: supply: ab8500: Avoid NULL pointers
    pwm: spear: Don't modify HW state in .remove callback
    lib/decompress_unlz4.c: correctly handle zero-padding around initrds.
  * i2c: core: Disable client irq on reboot/shutdown
      drivers/i2c/i2c-core.c
    ALSA: hda: Add IRQ check for platform_get_irq()
    backlight: lm3630a: Fix return code of .update_status() callback
    powerpc/boot: Fixup device-tree on little endian
    usb: gadget: hid: fix error return code in hid_bind()
  * usb: gadget: f_hid: fix endianness issue with descriptors
      drivers/usb/gadget/function/f_hid.c
  * ALSA: bebob: add support for ToneWeal FW66
      sound/firewire/Kconfig
  * ASoC: soc-core: Fix the error return code in snd_soc_of_parse_audio_routing()
      sound/soc/soc-core.c
    selftests/powerpc: Fix "no_handler" EBB selftest
    ALSA: ppc: fix error return code in snd_pmac_probe()
    gpio: zynq: Check return value of pm_runtime_get_sync
    powerpc/ps3: Add dma_mask to ps3_dma_region
    ALSA: sb: Fix potential double-free of CSP mixer elements
    s390/sclp_vt220: fix console name to match device
    mfd: da9052/stmpe: Add and modify MODULE_DEVICE_TABLE
    scsi: iscsi: Add iscsi_cls_conn refcount helpers
    fs/jfs: Fix missing error code in lmLogInit()
    tty: serial: 8250: serial_cs: Fix a memory leak in error handling path
    scsi: lpfc: Fix "Unexpected timeout" error in direct attach topology
  * Revert "ALSA: bebob/oxfw: fix Kconfig entry for Mackie d.2 Pro"
      sound/firewire/Kconfig
    misc/libmasm/module: Fix two use after free in ibmasm_init_one
    tty: serial: fsl_lpuart: fix the potential risk of division or modulo by zero
  * fscrypt: don't ignore minor_hash when hash is 0
      fs/crypto/fname.c
    tracing: Do not reference char * as a string in histograms
  * scsi: core: Fix bad pointer dereference when ehandler kthread is invalid
      drivers/scsi/hosts.c
    KVM: X86: Disable hardware breakpoints unconditionally before kvm_x86->run()
    KVM: x86: Use guest MAXPHYADDR from CPUID.0x8000_0008 iff TDP is enabled
  * smackfs: restrict bytes count in smk_set_cipso()
      security/smack/smackfs.c
    jfs: fix GPF in diFree
    media: uvcvideo: Fix pixel format change for Elgato Cam Link 4K
    media: gspca/sunplus: fix zero-length control requests
    media: gspca/sq905: fix control-request direction
    media: zr364xx: fix memory leak in zr364xx_start_readpipe
    media: dtv5100: fix control-request directions
    dm btree remove: assign new_root only when removal succeeds
    ipack/carriers/tpci200: Fix a double free in tpci200_pci_probe
  * seq_buf: Fix overflow in seq_buf_putmem_hex()
      lib/seq_buf.c
    power: supply: ab8500: Fix an old bug
    ipmi/watchdog: Stop watchdog timer when the current action is 'none'
    qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
    ASoC: tegra: Set driver_name=tegra for all machine drivers
    ata: ahci_sunxi: Disable DIPM
  * mmc: core: clear flags before allowing to retune
      drivers/mmc/core/core.c
  * mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode
      drivers/mmc/host/sdhci.c
      drivers/mmc/host/sdhci.h
    pinctrl/amd: Add device HID for new AMD GPIO controller
    powerpc/barrier: Avoid collision with clang's __lwsync macro
    mac80211: fix memory corruption in EAPOL handling
    can: bcm: delay release of struct bcm_op after synchronize_rcu()
    can: gw: synchronize rcu operations before removing gw job entry
  * fuse: reject internal errno
      fs/fuse/dev.c
    sctp: add size validation when walking chunks
    Bluetooth: btusb: fix bt fiwmare downloading failure issue for qca btsoc.
  * Bluetooth: Shutdown controller after workqueues are flushed or cancelled
      net/bluetooth/hci_core.c
  * Bluetooth: Fix the HCI to MGMT status conversion table
      net/bluetooth/mgmt.c
    RDMA/cma: Fix rdma_resolve_route() memory leak
  * wireless: wext-spy: Fix out-of-bounds warning
      net/wireless/wext-spy.c
    sfc: error code if SRIOV cannot be disabled
    sfc: avoid double pci_remove of VFs
    RDMA/rxe: Don't overwrite errno from ib_umem_get()
    atm: nicstar: register the interrupt handler in the right place
    atm: nicstar: use 'dma_free_coherent' instead of 'kfree'
    MIPS: add PMD table accounting into MIPS'pmd_alloc_one
    cw1200: add missing MODULE_DEVICE_TABLE
    wl1251: Fix possible buffer overflow in wl1251_cmd_scan
    wlcore/wl12xx: Fix wl12xx get_mac error if device is in ELP
  * xfrm: Fix error reporting in xfrm_state_construct.
      net/xfrm/xfrm_user.c
  * selinux: use __GFP_NOWARN with GFP_NOWAIT in the AVC
      security/selinux/avc.c
    fjes: check return value after calling platform_get_resource()
    net: micrel: check return value after calling platform_get_resource()
    dm space maps: don't reset space map allocation cursor when committing
    RDMA/cxgb4: Fix missing error code in create_qp()
  * ipv6: use prandom_u32() for ID generation
      net/ipv6/output_core.c
    clk: tegra: Ensure that PLLU configuration is applied properly
    e100: handle eeprom as little endian
    udf: Fix NULL pointer dereference in udf_symlink function
    drm/virtio: Fix double free on probe failure
    reiserfs: add check for invalid 1st journal block
  * net: Treat __napi_schedule_irqoff() as __napi_schedule() on PREEMPT_RT
      net/core/dev.c
    atm: nicstar: Fix possible use-after-free in nicstar_cleanup()
    mISDN: fix possible use-after-free in HFC_cleanup()
    atm: iphase: fix possible use-after-free in ia_module_exit()
    hugetlb: clear huge pte during flush function on mips platform
    net: pch_gbe: Use proper accessors to BE data in pch_ptp_match()
  * scsi: core: Retry I/O for Notify (Enable Spinup) Required error
      drivers/scsi/scsi_lib.c
    mmc: vub3000: fix control-request direction
    selftests/vm/pkeys: fix alloc_random_pkey() to make it really, really random
    mm/huge_memory.c: don't discard hugepage if other processes are mapping it
    leds: ktd2692: Fix an error handling path
  * configfs: fix memleak in configfs_release_bin_file
      fs/configfs/file.c
    extcon: max8997: Add missing modalias string
    extcon: sm5502: Drop invalid register write in sm5502_reg_data
    phy: ti: dm816x: Fix the error handling path in 'dm816x_usb_phy_probe()
    scsi: mpt3sas: Fix error return value in _scsih_expander_add()
  * of: Fix truncation of memory sizes on 32-bit platforms
      drivers/of/fdt.c
      drivers/of/of_reserved_mem.c
    staging: gdm724x: check for overflow in gdm_lte_netif_rx()
    staging: gdm724x: check for buffer overflow in gdm_lte_multi_sdu_pkt()
    s390: appldata depends on PROC_SYSCTL
    scsi: FlashPoint: Rename si_flags field
    tty: nozomi: Fix the error handling path of 'nozomi_card_init()'
    char: pcmcia: error out if 'num_bytes_read' is greater than 4 in set_protocol()
    Input: hil_kbd - fix error return code in hil_dev_connect()
    iio: light: tcs3414: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: light: isl29125: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: prox: pulsed-light: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: humidity: am2315: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: gyro: bmg160: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: adc: vf610: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: adc: ti-ads1015: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: accel: stk8ba50: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: accel: stk8312: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: accel: kxcjk-1013: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: accel: bma220: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: accel: bma180: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: adis_buffer: do not return ints in irq handlers
    tty: nozomi: Fix a resource leak in an error handling function
    net: sched: fix warning in tcindex_alloc_perfect_hash
  * writeback: fix obtain a reference to a freeing memcg css
      fs/fs-writeback.c
  * Bluetooth: mgmt: Fix slab-out-of-bounds in tlv_data_is_valid
      net/bluetooth/mgmt.c
    i40e: Fix error handling in i40e_vsi_open
    vxlan: add missing rcu_read_lock() in neigh_reduce()
    net: ethernet: ezchip: fix error handling
    net: ethernet: ezchip: fix UAF in nps_enet_remove
    net: ethernet: aeroflex: fix UAF in greth_of_remove
    netfilter: nft_exthdr: check for IPv6 packet before further processing
  * netlabel: Fix memory leak in netlbl_mgmt_add_common
      net/netlabel/netlabel_mgmt.c
    ath10k: Fix an error code in ath10k_add_interface()
    brcmsmac: mac80211_if: Fix a resource leak in an error handling path
  * wireless: carl9170: fix LEDS build errors & warnings
      drivers/net/wireless/ath/carl9170/Kconfig
    drm: qxl: ensure surf.data is ininitialized
    RDMA/rxe: Fix failure during driver load
    ehea: fix error return code in ehea_restart_qps()
    net: pch_gbe: Propagate error from devm_gpio_request_one()
    ocfs2: fix snprintf() checking
    ACPI: sysfs: Fix a buffer overrun problem with description_show()
    crypto: nx - Fix RCU warning in nx842_OF_upd_status
    spi: spi-sun6i: Fix chipselect/clock bug
    hwmon: (max31790) Fix fan speed reporting for fan7..12
    hwmon: (max31722) Remove non-standard ACPI device IDs
    media: s5p-g2d: Fix a memory leak on ctx->fh.m2m_ctx
    mmc: usdhi6rol0: fix error return code in usdhi6_probe()
    media: siano: Fix out-of-bounds warnings in smscore_load_firmware_family2()
    media: tc358743: Fix error return code in tc358743_probe_of()
    pata_ep93xx: fix deferred probing
    pata_octeon_cf: avoid WARN_ON() in ata_host_activate()
    media: I2C: change 'RST' to "RSET" to fix multiple build errors
    pata_rb532_cf: fix deferred probing
    sata_highbank: fix deferred probing
    crypto: ux500 - Fix error return code in hash_hw_final()
    crypto: ixp4xx - dma_unmap the correct address
    media: s5p_cec: decrement usage count if disabled
    ia64: mca_drv: fix incorrect array size calculation
    ACPI: tables: Add custom DSDT file as makefile prerequisite
    platform/x86: toshiba_acpi: Fix missing error code in toshiba_acpi_setup_keyboard()
    ACPI: bus: Call kobject_put() in acpi_init() error path
    fs: dlm: fix memory leak when fenced
  * random32: Fix implicit truncation warning in prandom_seed_state()
      include/linux/prandom.h
    fs: dlm: cancel work sync othercon
  * block_dump: remove block_dump feature in mark_inode_dirty()
      fs/fs-writeback.c
    ACPI: processor idle: Fix up C-state latency if not ordered
    regulator: da9052: Ensure enough delay time for .set_voltage_time_sel
  * btrfs: disable build on platforms having page size 256K
      fs/btrfs/Kconfig
    btrfs: abort transaction if we fail to update the delayed inode
    media: siano: fix device register error path
  * media: dvb_net: avoid speculation from net slot
      drivers/media/dvb-core/dvb_net.c
  * crypto: shash - avoid comparing pointers to exported functions under CFI
      crypto/shash.c
      include/crypto/internal/hash.h
    mmc: via-sdmmc: add a check against NULL pointer dereference
    media: st-hva: Fix potential NULL pointer dereferences
    media: bt8xx: Fix a missing check bug in bt878_probe
  * media: v4l2-core: Avoid the dangling pointer in v4l2_fh_release
      drivers/media/v4l2-core/v4l2-fh.c
    crypto: qat - remove unused macro in FW loader
    crypto: qat - check return code of qat_hal_rd_rel_reg()
    media: pvrusb2: fix warning in pvr2_i2c_core_done
    media: cobalt: fix race condition in setting HPD
    media: cpia2: fix memory leak in cpia2_usb_probe
    crypto: nx - add missing MODULE_DEVICE_TABLE
    spi: omap-100k: Fix the length judgment problem
    spi: spi-topcliff-pch: Fix potential double free in pch_spi_process_messages()
    spi: spi-loopback-test: Fix 'tx_buf' might be 'rx_buf'
  * fuse: check connected before queueing on fpq->io
      fs/fuse/dev.c
  * seq_buf: Make trace_seq_putmem_hex() support data longer than 8
      lib/seq_buf.c
    ssb: sdio: Don't overwrite const buffer if block_write fails
    ath9k: Fix kernel NULL pointer dereference during ath_reset_internal()
    serial_cs: remove wrong GLOBETROTTER.cis entry
    serial_cs: Add Option International GSM-Ready 56K/ISDN modem
    serial: sh-sci: Stop dmaengine transfer in sci_stop_tx()
    iio: ltr501: ltr501_read_ps(): add missing endianness conversion
    iio: ltr501: ltr559: fix initialization of LTR501_ALS_CONTR
    iio: ltr501: mark register holding upper 8 bits of ALS_DATA{0,1} and PS_DATA as volatile, too
    s390/cio: dont call css_wait_for_slow_path() inside a lock
    SUNRPC: Should wake up the privileged task firstly.
    SUNRPC: Fix the batch tasks count wraparound.
  * ext4: fix avefreec in find_group_orlov
      fs/ext4/ialloc.c
  * ext4: remove check for zero nr_to_scan in ext4_es_scan()
      fs/ext4/extents_status.c
  * ext4: correct the cache_nr in tracepoint ext4_es_shrink_exit
      fs/ext4/extents_status.c
  * ext4: fix kernel infoleak via ext4_extent_header
      fs/ext4/extents.c
    btrfs: clear defrag status of a root if starting transaction fails
    ARM: dts: at91: sama5d4: fix pinctrl muxing
    Input: joydev - prevent use of not validated data in JSIOCSBTNMAP ioctl
  * iov_iter_fault_in_readable() should do nothing in xarray case
      lib/iov_iter.c
    ntfs: fix validity check for file name attribute
    USB: cdc-acm: blacklist Heimann USB Appset device
    usb: gadget: eem: fix echo command packet response issue
    net: can: ems_usb: fix use-after-free in ems_usb_disconnect()
    Input: usbtouchscreen - fix control-request directions
    media: dvb-usb: fix wrong definition
  * ALSA: usb-audio: fix rate on Ozone Z90 USB headset
      sound/usb/format.c
    Merge 4.9.275 into android-4.9-q
Linux 4.9.275
    xen/events: reset active flag for lateeoi events later
  * kthread: prevent deadlock when kthread_mod_delayed_work() races with kthread_cancel_delayed_work_sync()
      kernel/kthread.c
  * kthread_worker: split code for canceling the delayed work timer
      kernel/kthread.c
    drm/nouveau: fix dma_address check for CPU/GPU sync
    scsi: sr: Return appropriate error code when disk is ejected
  * mm, futex: fix shared futex pgoff on shmem huge page
      include/linux/hugetlb.h
      include/linux/pagemap.h
      kernel/futex.c
    mm: thp: replace DEBUG_VM BUG with VM_WARN when unmap fails for split
  * mm: add VM_WARN_ON_ONCE_PAGE() macro
      include/linux/mmdebug.h
  * include/linux/mmdebug.h: make VM_WARN* non-rvals
      include/linux/mmdebug.h

Bug: 196282886
Change-Id: I727851b06571f0e9d7751d10a59b1edae838882c
Signed-off-by: Lucas Wei <lucaswei@google.com>
2021-08-18 20:51:10 +08:00
Matthew Wilcox
fe0bc3fd86 lib/string.c: add multibyte memset functions
commit 3b3c4babd898715926d24ae10aa64778ace33aae upstream.

Patch series "Multibyte memset variations", v4.

A relatively common idiom we're missing is a function to fill an area of
memory with a pattern which is larger than a single byte.  I first
noticed this with a zram patch which wanted to fill a page with an
'unsigned long' value.  There turn out to be quite a few places in the
kernel which can benefit from using an optimised function rather than a
loop; sometimes text size, sometimes speed, and sometimes both.  The
optimised PowerPC version (not included here) improves performance by
about 30% on POWER8 on just the raw memset_l().

Most of the extra lines of code come from the three testcases I added.

This patch (of 8):

memset16(), memset32() and memset64() are like memset(), but allow the
caller to fill the destination with a value larger than a single byte.
memset_l() and memset_p() allow the caller to use unsigned long and
pointer values respectively.

Link: http://lkml.kernel.org/r/20170720184539.31609-2-willy@infradead.org
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: David Miller <davem@davemloft.net>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Russell King <rmk+kernel@armlinux.org.uk>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Nobuhiro Iwamatsu (CIP) <nobuhiro1.iwamatsu@toshiba.co.jp>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-04 11:58:02 +02:00
Lucas Wei
28ab10340e Merge android-4.9-q (4.9.258) into android-msm-pixel-4.9-lts
Merge 4.9.258 into android-4.9-q
Linux 4.9.258
    kvm: check tlbs_dirty directly
    scsi: qla2xxx: Fix crash during driver load on big endian machines
    xen-blkback: fix error handling in xen_blkbk_map()
    xen-scsiback: don't "handle" error by BUG()
    xen-netback: don't "handle" error by BUG()
    xen-blkback: don't "handle" error by BUG()
    xen/arm: don't ignore return errors from set_phys_to_machine
    Xen/gntdev: correct error checking in gntdev_map_grant_pages()
    Xen/gntdev: correct dev_bus_addr handling in gntdev_map_grant_pages()
    Xen/x86: also check kernel mapping in set_foreign_p2m_mapping()
    Xen/x86: don't bail early from clear_foreign_p2m_mapping()
  * tracing: Avoid calling cc-option -mrecord-mcount for every Makefile
      Makefile
      scripts/Makefile.build
  * tracing: Fix SKIP_STACK_VALIDATION=1 build due to bad merge with -mrecord-mcount
      scripts/Makefile.build
  * trace: Use -mcount-record for dynamic ftrace
      scripts/Makefile.build
    x86/build: Disable CET instrumentation in the kernel for 32-bit too
    vsock: fix locking in vsock_shutdown()
    vsock/virtio: update credit only if socket is not closed
  * net: watchdog: hold device global xmit lock during tx disable
      include/linux/netdevice.h
    net/vmw_vsock: improve locking in vsock_connect_timeout()
    usb: dwc3: ulpi: Replace CPU-based busyloop with Protocol-based one
    usb: dwc3: ulpi: fix checkpatch warning
    h8300: fix PREEMPTION build, TI_PRE_COUNT undefined
  * netfilter: conntrack: skip identical origin tuple in same zone only
      net/netfilter/nf_conntrack_core.c
    xen/netback: avoid race in xenvif_rx_ring_slots_available()
    netfilter: xt_recent: Fix attempt to update deleted entry
  * bpf: Check for integer overflow when using roundup_pow_of_two()
      kernel/bpf/stackmap.c
  * memblock: do not start bottom-up allocations with kernel_end
      mm/memblock.c
    ARM: dts: lpc32xx: Revert set default clock rate of HCLK PLL
  * ovl: skip getxattr of security labels
      fs/overlayfs/copy_up.c
  * tracing: Check length before giving out the filter buffer
      kernel/trace/trace.c
  * tracing: Do not count ftrace events in top level enable output
      kernel/trace/trace_events.c
    squashfs: add more sanity checks in xattr id lookup
    squashfs: add more sanity checks in inode lookup
    squashfs: add more sanity checks in id lookup
  * futex: Cure exit race
      kernel/futex.c
  * futex: Change locking rules
      kernel/futex.c
  * futex: Ensure the correct return value from futex_lock_pi()
      kernel/futex.c
  * memcg: fix a crash in wb_workfn when a device disappears
      fs/fs-writeback.c
      include/linux/backing-dev.h
      include/trace/events/writeback.h
      mm/backing-dev.c
  * include/trace/events/writeback.h: fix -Wstringop-truncation warnings
      include/trace/events/writeback.h
  * lib/string: Add strscpy_pad() function
      include/linux/string.h
      lib/string.c
    SUNRPC: Handle 0 length opaque XDR object data properly
  * SUNRPC: Move simple_get_bytes and simple_get_netobj into private header
      include/linux/sunrpc/xdr.h
    iwlwifi: mvm: guard against device removal in reprobe
    iwlwifi: pcie: add a NULL check in iwl_pcie_txq_unmap
    iwlwifi: mvm: take mutex for calling iwl_mvm_get_sync_time()
  * af_key: relax availability checks for skb size calculation
      net/key/af_key.c
    remoteproc: qcom_q6v5_mss: Validate MBA firmware size before load
  * fgraph: Initialize tracing_graph_pause at task creation
      include/linux/ftrace.h
  * mm: memcontrol: fix NULL pointer crash in test_clear_page_writeback()
      include/linux/memcontrol.h
      mm/page-writeback.c
    Merge 4.9.257 into android-4.9-q
Linux 4.9.257
    ALSA: hda/realtek - Fix typo of pincfg for Dell quirk
    iommu/vt-d: Do not use flush-queue when caching-mode is on
    ACPI: thermal: Do not call acpi_thermal_check() directly
  * Input: xpad - sync supported devices with fork on GitHub
      drivers/input/joystick/xpad.c
    x86/apic: Add extra serialization for non-serializing MSRs
  * x86/build: Disable CET instrumentation in the kernel
      Makefile
    mm: thp: fix MADV_REMOVE deadlock on shmem THP
    mm: hugetlb: remove VM_BUG_ON_PAGE from page_huge_active
    mm: hugetlb: fix a race between isolating and freeing page
  * mm: hugetlbfs: fix cannot migrate the fallocated HugeTLB page
      include/linux/hugetlb.h
    ARM: footbridge: fix dc21285 PCI configuration accessors
  * mmc: core: Limit retries when analyse of SDIO tuples fails
      drivers/mmc/core/sdio_cis.c
    cifs: report error instead of invalid when revalidating a dentry fails
  * xhci: fix bounce buffer usage for non-sg list case
      drivers/usb/host/xhci-ring.c
    kretprobe: Avoid re-registration of the same kretprobe earlier
    mac80211: fix station rate table updates on assoc
    usb: dwc2: Fix endpoint direction check in ep_from_windex
    USB: usblp: don't call usb_set_interface if there's a single alt
    USB: gadget: legacy: fix an error code in eth_bind()
  * elfcore: fix building with clang
      include/linux/elfcore.h
      kernel/Makefile
    net: lapb: Copy the skb before sending a packet
    Input: i8042 - unbreak Pegatron C15B
    USB: serial: option: Adding support for Cinterion MV31
    USB: serial: cp210x: add new VID/PID for supporting Teraoka AD2000
    USB: serial: cp210x: add pid/vid for WSDA-200-USB
  * stable: clamp SUBLEVEL in 4.4 and 4.9
      Makefile
    objtool: Don't fail on missing symbol table
    scsi: ibmvfc: Set default timeout to avoid crash during migration
    mac80211: fix fast-rx encryption check
    scsi: libfc: Avoid invoking response handler twice if ep is already completed
  * futex: Handle faults correctly for PI futexes
      kernel/futex.c
  * futex: Simplify fixup_pi_state_owner()
      kernel/futex.c
  * futex: Use pi_state_update_owner() in put_pi_state()
      kernel/futex.c
  * rtmutex: Remove unused argument from rt_mutex_proxy_unlock()
      kernel/futex.c
      kernel/locking/rtmutex.c
      kernel/locking/rtmutex_common.h
  * futex: Provide and use pi_state_update_owner()
      kernel/futex.c
  * futex: Replace pointless printk in fixup_owner()
      kernel/futex.c
  * futex: Avoid violating the 10th rule of futex
      kernel/futex.c
      kernel/locking/rtmutex.c
      kernel/locking/rtmutex_common.h
  * futex: Rework inconsistent rt_mutex/futex_q state
      kernel/futex.c
  * futex: Remove rt_mutex_deadlock_account_*()
      kernel/locking/rtmutex.c
      kernel/locking/rtmutex.h
  * futex,rt_mutex: Provide futex specific rt_mutex API
      kernel/futex.c
      kernel/locking/rtmutex.c
      kernel/locking/rtmutex_common.h
  * net_sched: reject silly cell_log in qdisc_get_rtab()
      net/sched/sch_api.c
    ibmvnic: Ensure that CRQ entry read are correctly ordered
    net: dsa: bcm_sf2: put device node before return
    Merge 4.9.256 into android-4.9-q
Linux 4.9.256
    Merge 4.9.255 into android-4.9-q
Linux 4.9.255
    NFC: fix possible resource leak
    NFC: fix resource leak when target index is invalid
    iommu/vt-d: Don't dereference iommu_device if IOMMU_API is not built
    iommu/vt-d: Gracefully handle DMAR units with no supported address widths
    can: dev: prevent potential information leak in can_fill_info()
    mac80211: pause TX while changing interface type
    iwlwifi: pcie: reschedule in long-running memory reads
    iwlwifi: pcie: use jiffies for memory read spin time limit
    RDMA/cxgb4: Fix the reported max_recv_sge value
  * xfrm: Fix oops in xfrm_replay_advance_bmp
      net/xfrm/xfrm_input.c
    netfilter: nft_dynset: add timeout extension to template
    ARM: imx: build suspend-imx6.S with arm instruction set
    mt7601u: fix rx buffer refcounting
    mt7601u: fix kernel crash unplugging the device
  * leds: trigger: fix potential deadlock with libata
      drivers/leds/led-triggers.c
    KVM: x86: get smi pending status correctly
    KVM: x86/pmu: Fix HW_REF_CPU_CYCLES event pseudo-encoding in intel_arch_events[]
  * futex: Prevent exit livelock
      kernel/futex.c
  * futex: Provide distinct return value when owner is exiting
      kernel/futex.c
  * futex: Add mutex around futex exit
      include/linux/futex.h
      include/linux/sched.h
      kernel/futex.c
  * futex: Provide state handling for exec() as well
      kernel/futex.c
  * futex: Sanitize exit state handling
      kernel/futex.c
  * futex: Mark the begin of futex exit explicitly
      include/linux/futex.h
      kernel/exit.c
      kernel/futex.c
  * futex: Set task::futex_state to DEAD right after handling futex exit
      kernel/exit.c
      kernel/futex.c
  * futex: Split futex_mm_release() for exit/exec
      include/linux/futex.h
      kernel/fork.c
      kernel/futex.c
  * exit/exec: Seperate mm_release()
      fs/exec.c
      include/linux/sched.h
      kernel/exit.c
      kernel/fork.c
  * futex: Replace PF_EXITPIDONE with a state
      include/linux/futex.h
      include/linux/sched.h
      kernel/exit.c
      kernel/futex.c
  * futex: Move futex exit handling into futex code
      include/linux/compat.h
      include/linux/futex.h
      kernel/fork.c
      kernel/futex.c
  * y2038: futex: Move compat implementation into futex.c
      include/linux/futex.h
      kernel/Makefile
      kernel/futex.c
    net: usb: qmi_wwan: added support for Thales Cinterion PLSx3 modem family
  * wext: fix NULL-ptr-dereference with cfg80211's lack of commit()
      net/wireless/wext-core.c
    ACPI: sysfs: Prefer "compatible" modalias

Bug: 181732917
Change-Id: Ice169f5980390199db8f86d42e944cdf5f37c562
Signed-off-by: Lucas Wei <lucaswei@google.com>
2021-03-12 14:56:50 +08:00
Tobin C. Harding
316c6cc08d lib/string: Add strscpy_pad() function
[ Upstream commit 458a3bf82df4fe1f951d0f52b1e0c1e9d5a88a3b ]

We have a function to copy strings safely and we have a function to copy
strings and zero the tail of the destination (if source string is
shorter than destination buffer) but we do not have a function to do
both at once.  This means developers must write this themselves if they
desire this functionality.  This is a chore, and also leaves us open to
off by one errors unnecessarily.

Add a function that calls strscpy() then memset()s the tail to zero if
the source string is shorter than the destination buffer.

Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Tobin C. Harding <tobin@kernel.org>
Signed-off-by: Shuah Khan <shuah@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-02-23 13:59:14 +01:00
Joel Fernandes
06e9c9aa18 BACKPORT: rss_stat: Add support to detect RSS updates of external mm
When a process updates the RSS of a different process, the rss_stat
tracepoint appears in the context of the process doing the update. This
can confuse userspace that the RSS of process doing the update is
updated, while in reality a different process's RSS was updated.

This issue happens in reclaim paths such as with direct reclaim or
background reclaim.

This patch adds more information to the tracepoint about whether the mm
being updated belongs to the current process's context (curr field). We
also include a hash of the mm pointer so that the process who the mm
belongs to can be uniquely identified (mm_id field).

Also vsprintf.c is refactored a bit to allow reuse of hashing code.

Change-Id: I5bac4aa221cea0d123fdb6fcc15dede6130e9c22
Reported-by: Ioannis Ilkos <ilkos@google.com>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Joel Fernandes <joelaf@google.com>
2019-11-19 20:31:29 +00:00
Robin Peng
ad18574239 Merge android-4.9 (4.9.178) into android-msm-pixel-4.9-lts
Merge 4.9.178 into android-4.9
Linux 4.9.178
    KVM: x86: Skip EFER vs. guest CPUID checks for host-initiated writes
    ALSA: hda/realtek - Fix for Lenovo B50-70 inverted internal microphone bug
  * ext4: fix data corruption caused by overlapping unaligned and aligned IO
      fs/ext4/file.c
  * ext4: zero out the unused memory region in the extent tree block
      fs/ext4/extents.c
  * fs/writeback.c: use rcu_barrier() to wait for inflight wb switches going into workqueue when umount
      fs/fs-writeback.c
  * writeback: synchronize sync(2) against cgroup writeback membership switches
      fs/fs-writeback.c
      include/linux/backing-dev-defs.h
      mm/backing-dev.c
  * fib_rules: fix error in backport of e9919a24d302 ("fib_rules: return 0...")
      net/core/fib_rules.c
    crypto: arm/aes-neonbs - don't access already-freed walk.iv
    crypto: salsa20 - don't access already-freed walk.iv
  * crypto: gcm - fix incompatibility between "gcm" and "gcm_base"
      crypto/gcm.c
  * crypto: gcm - Fix error return code in crypto_gcm_create_common()
      crypto/gcm.c
    ipmi:ssif: compare block number correctly for multi-part return messages
    bcache: never set KEY_PTRS of journal key to 0 in journal_reclaim()
    bcache: fix a race between cache register and cacheset unregister
    Btrfs: do not start a transaction at iterate_extent_inodes()
  * ext4: fix ext4_show_options for file systems w/o journal
      fs/ext4/super.c
  * ext4: actually request zeroing of inode table after grow
      fs/ext4/ioctl.c
  * jbd2: check superblock mapped prior to committing
      fs/jbd2/journal.c
    tty/vt: fix write/write race in ioctl(KDSKBSENT) handler
    mfd: max77620: Fix swapped FPS_PERIOD_MAX_US values
    mfd: da9063: Fix OTP control register names to match datasheets for DA9063/63L
    ocfs2: fix ocfs2 read inode data panic in ocfs2_iget
  * mm/mincore.c: make mincore() more conservative
      mm/mincore.c
    ASoC: RT5677-SPI: Disable 16Bit SPI Transfers
    ASoC: max98090: Fix restore of DAPM Muxes
    ALSA: hda/realtek - EAPD turn on later
    ALSA: hda/hdmi - Consider eld_valid when reporting jack event
    ALSA: hda/hdmi - Read the pin sense from register when repolling
  * ALSA: usb-audio: Fix a memory leak bug
      sound/usb/mixer.c
    crypto: x86/crct10dif-pcl - fix use via crypto_shash_digest()
    crypto: crct10dif-generic - fix use via crypto_shash_digest()
    crypto: vmx - fix copy-paste error in CTR mode
    crypto: chacha20poly1305 - set cra_name correctly
    sched/x86: Save [ER]FLAGS on context switch
  * arm64: Clear OSDLR_EL1 on CPU boot
      arch/arm64/kernel/debug-monitors.c
  * arm64: compat: Reduce address limit
      arch/arm64/include/asm/processor.h
    power: supply: axp288_charger: Fix unchecked return value
    ARM: exynos: Fix a leaked reference by adding missing of_node_put
    objtool: Fix function fallthrough detection
    x86/speculation/mds: Improve CPU buffer clear documentation
    x86/speculation/mds: Revert CPU buffer clear on double fault exit
    PCI: hv: Fix a memory leak in hv_eject_device_work()
  * locking/rwsem: Prevent decrement of reader count before increment
      kernel/locking/rwsem-xadd.c
  * net: core: another layer of lists, around PF_MEMALLOC skb handling
      include/linux/list.h
  * UPSTREAM: fib_rules: fix error in backport of e9919a24d302 ("fib_rules: return 0...")
      net/core/fib_rules.c
  * UPSTREAM: bpf: relax inode permission check for retrieving bpf program
      kernel/bpf/inode.c
    Merge 4.9.177 into android-4.9
Linux 4.9.177
    powerpc/booke64: set RI in default MSR
    powerpc/lib: fix book3s/32 boot failure due to code patching
    drivers/virt/fsl_hypervisor.c: prevent integer overflow in ioctl
    drivers/virt/fsl_hypervisor.c: dereferencing error pointers in ioctl
  * bonding: fix arp_validate toggling in active-backup mode
      drivers/net/bonding/bond_options.c
  * ipv4: Fix raw socket lookup for local traffic
      net/ipv4/raw.c
  * vrf: sit mtu should not be updated when vrf netdev is the link
      net/ipv6/sit.c
    vlan: disable SIOCSHWTSTAMP in container
  * packet: Fix error path in packet_init
      net/packet/af_packet.c
    net: ucc_geth - fix Oops when changing number of buffers in the ring
  * fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied
      net/core/fib_rules.c
  * bridge: Fix error path for kobject_init_and_add()
      net/bridge/br_if.c
    powerpc/64s: Include cpu header
    x86/vdso: Pass --eh-frame-hdr to the linker
    x86/vdso: Drop implicit common-page-size linker flag
    x86: vdso: Use $LD instead of $CC to link
    Revert "x86: vdso: Use $LD instead of $CC to link"
    Revert "x86/vdso: Drop implicit common-page-size linker flag"
    Don't jump to compute_result state from check_result state
    rtlwifi: rtl8723ae: Fix missing break in switch statement
  * ALSA: pcm: remove SNDRV_PCM_IOCTL1_INFO internal command
      include/sound/pcm.h
      sound/core/pcm_lib.c
      sound/core/pcm_native.c
    cw1200: fix missing unlock on error in cw1200_hw_scan()
    Input: synaptics-rmi4 - fix possible double free
    spi: ST ST95HF NFC: declare missing of table
    spi: Micrel eth switch: declare missing of table
    gpu: ipu-v3: dp: fix CSC handling
    selftests/net: correct the return value for run_netsocktests
    drm/sun4i: Set device driver data at bind time for use in unbind
    s390: ctcm: fix ctcm_new_device error return code
    MIPS: perf: ath79: Fix perfcount IRQ assignment
    ipvs: do not schedule icmp errors from tunnels
    selftests: netfilter: check icmp pkttoobig errors are set as related
  * init: initialize jump labels before command line option parsing
      init/main.c
    tools lib traceevent: Fix missing equality check for strcmp
    KVM: x86: avoid misreporting level-triggered irqs as edge-triggered in tracing
  * x86/reboot, efi: Use EFI reboot for Acer TravelMate X514-51T
      include/linux/efi.h
    mISDN: Check address length before reading address family
    s390/3270: fix lockdep false positive on view->lock
    mac80211: fix unaligned access in mesh table hash function
    s390/dasd: Fix capacity calculation for large volumes
    libnvdimm/btt: Fix a kmemdup failure check
  * HID: input: add mapping for "Toggle Display" key
      drivers/hid/hid-input.c
  * HID: input: add mapping for keyboard Brightness Up/Down/Toggle keys
      drivers/hid/hid-input.c
  * HID: input: add mapping for Expose/Overview key
      drivers/hid/hid-input.c
    libnvdimm/namespace: Fix a potential NULL pointer dereference
    iio: adc: xilinx: fix potential use-after-free on remove
    USB: serial: fix unthrottle races
    platform/x86: sony-laptop: Fix unintentional fall-through
  * bpf: convert htab map to hlist_nulls
      include/linux/list_nulls.h
      include/linux/rculist_nulls.h
      kernel/bpf/hashtab.c
  * bpf: fix struct htab_elem layout
      kernel/bpf/hashtab.c
  * netfilter: compat: initialize all fields in xt_init
      net/netfilter/x_tables.c
    ANDROID: cuttlefish_defconfig: Disable DEVTMPFS
    ANDROID: Move from clang r349610 to r353983c.
    Merge upstream-f2fs-stable-linux-4.9.y into android-4.9
    Merge 4.9.176 into android-4.9
Linux 4.9.176
    x86/cpu/bugs: Use __initconst for 'const' init data
    x86: stop exporting msr-index.h to userland
    x86/speculation/mds: Fix documentation typo
    Documentation: Correct the possible MDS sysfs values
    x86/mds: Add MDSUM variant to the MDS documentation
    x86/speculation/mds: Add 'mitigations=' support for MDS
    x86/speculation: Support 'mitigations=' cmdline option
  * cpu/speculation: Add 'mitigations=' cmdline option
      include/linux/cpu.h
      kernel/cpu.c
    x86/speculation/mds: Print SMT vulnerable on MSBDS with mitigations off
    x86/speculation/mds: Fix comment
    x86/speculation/mds: Add SMT warning message
    x86/speculation: Move arch_smt_update() call to after mitigation decisions
    x86/speculation/mds: Add mds=full,nosmt cmdline option
    Documentation: Add MDS vulnerability documentation
    Documentation: Move L1TF to separate directory
    x86/speculation/mds: Add mitigation mode VMWERV
  * x86/speculation/mds: Add sysfs reporting for MDS
      drivers/base/cpu.c
      include/linux/cpu.h
    x86/speculation/mds: Add mitigation control for MDS
    x86/speculation/mds: Conditionally clear CPU buffers on idle entry
    x86/kvm/vmx: Add MDS protection when L1D Flush is not active
    x86/speculation/mds: Clear CPU buffers on exit to user
    x86/speculation/mds: Add mds_clear_cpu_buffers()
    x86/kvm: Expose X86_FEATURE_MD_CLEAR to guests
    x86/speculation/mds: Add BUG_MSBDS_ONLY
    x86/speculation/mds: Add basic bug infrastructure for MDS
    x86/speculation: Consolidate CPU whitelists
    x86/msr-index: Cleanup bit defines
    kvm: x86: Report STIBP on GET_SUPPORTED_CPUID
    x86/speculation: Provide IBPB always command line options
    x86/speculation: Add seccomp Spectre v2 user space protection mode
    x86/speculation: Enable prctl mode for spectre_v2_user
  * x86/speculation: Add prctl() control for indirect branch speculation
      include/linux/sched.h
      include/uapi/linux/prctl.h
    x86/speculation: Prevent stale SPEC_CTRL msr content
    x86/speculation: Prepare arch_smt_update() for PRCTL mode
    x86/speculation: Split out TIF update
    x86/speculation: Prepare for conditional IBPB in switch_mm()
    x86/speculation: Avoid __switch_to_xtra() calls
    x86/process: Consolidate and simplify switch_to_xtra() code
    x86/speculation: Prepare for per task indirect branch speculation control
    x86/speculation: Add command line control for indirect branch speculation
    x86/speculation: Unify conditional spectre v2 print functions
    x86/speculataion: Mark command line parser data __initdata
    x86/speculation: Mark string arrays const correctly
    x86/speculation: Reorder the spec_v2 code
    x86/l1tf: Show actual SMT state
  * x86/speculation: Rework SMT state change
      include/linux/sched/smt.h
      kernel/cpu.c
  * sched: Add sched_smt_active()
      include/linux/sched/smt.h
      kernel/sched/core.c
      kernel/sched/sched.h
    x86/Kconfig: Select SCHED_SMT if SMP enabled
    x86/speculation: Reorganize speculation control MSRs update
    x86/speculation: Rename SSBD update functions
    x86/speculation: Disable STIBP when enhanced IBRS is in use
    x86/speculation: Move STIPB/IBPB string conditionals out of cpu_show_common()
    x86/speculation: Remove unnecessary ret variable in cpu_show_common()
    x86/speculation: Clean up spectre_v2_parse_cmdline()
    x86/speculation: Update the TIF_SSBD comment
    x86/speculation/l1tf: Drop the swap storage limit restriction when l1tf=off
    x86/speculation: Propagate information about RSB filling mitigation to sysfs
  * x86/speculation: Enable cross-hyperthread spectre v2 STIBP mitigation
      kernel/cpu.c
  * x86/speculation: Apply IBPB more strictly to avoid cross-process data leak
      include/linux/ptrace.h
      kernel/ptrace.c
    Documentation/l1tf: Fix small spelling typo
    x86/cpu: Sanitize FAM6_ATOM naming
    x86/speculation: Remove SPECTRE_V2_IBRS in enum spectre_v2_mitigation
  * locking/atomics, asm-generic: Move some macros from <linux/bitops.h> to a new <linux/bits.h> file
      include/linux/bitops.h
      include/linux/bits.h
    x86/speculation: Simplify the CPU bug detection logic
  * bitops: avoid integer overflow in GENMASK(_ULL)
      include/linux/bitops.h
    x86/mm: Use WRITE_ONCE() when setting PTEs
    x86/microcode: Update the new microcode revision unconditionally
    x86/microcode: Make sure boot_cpu_data.microcode is up-to-date
    x86/microcode/intel: Check microcode revision before updating sibling threads
    x86/microcode/intel: Add a helper which gives the microcode revision
    x86/bugs: Fix the AMD SSBD usage of the SPEC_CTRL MSR
    x86/bugs: Switch the selection of mitigation from CPU vendor to CPU features
    x86/bugs: Add AMD's SPEC_CTRL MSR usage
    x86/bugs: Add AMD's variant of SSB_NO
    x86/cpufeatures: Hide AMD-specific speculation flags
    x86/MCE: Save microcode revision in machine check records
    Merge 4.9.175 into android-4.9
Linux 4.9.175
    timer/debug: Change /proc/timer_stats from 0644 to 0600
    ASoC: Intel: avoid Oops if DMA setup fails
    UAS: fix alignment of scatter/gather segments
  * Bluetooth: Align minimum encryption key size for LE and BR/EDR connections
      include/net/bluetooth/hci_core.h
      net/bluetooth/hci_conn.c
    Bluetooth: hidp: fix buffer overflow
    scsi: qla2xxx: Fix incorrect region-size setting in optrom SYSFS routines
  * usb-storage: Set virt_boundary_mask to avoid SG overflows
      drivers/usb/storage/scsiglue.c
    USB: serial: f81232: fix interrupt worker not stop
  * usb: dwc3: Fix default lpm_nyet_threshold value
      drivers/usb/dwc3/core.c
  * genirq: Prevent use-after-free and work list corruption
      kernel/irq/manage.c
    ARM: 8680/1: boot/compressed: fix inappropriate Thumb2 mnemonic for __nop
  * mm: add 'try_get_page()' helper function
      include/linux/mm.h
    iommu/amd: Set exclusion range correctly
    virtio-blk: limit number of hw queues by nr_cpu_ids
    drm/mediatek: fix possible object reference leak
    scsi: csiostor: fix missing data copy in csio_scsi_err_handler()
  * linux/kernel.h: Use parentheses around argument in u64_to_user_ptr()
      include/linux/kernel.h
    perf/x86/intel: Fix handling of wakeup_events for multi-entry PEBS
    drm/mediatek: Fix an error code in mtk_hdmi_dt_parse_pdata()
    ASoC: tlv320aic32x4: Fix Common Pins
    IB/hfi1: Eliminate opcode tests on mr deref
    ASoC: cs4270: Set auto-increment bit for register writes
    ASoC: nau8810: fix the issue of widget with prefixed name
  * ASoC:soc-pcm:fix a codec fixup issue in TDM case
      sound/soc/soc-pcm.c
    staging: greybus: power_supply: fix prop-descriptor request size
    ubsan: Fix nasty -Wbuiltin-declaration-mismatch GCC-9 warnings
    scsi: libsas: fix a race condition when smp task timeout
  * f2fs: fix to avoid accessing xattr across the boundary
      fs/f2fs/xattr.c
      fs/f2fs/xattr.h
  * f2fs: fix to avoid potential race on sbi->unusable_block_count access/update
      fs/f2fs/checkpoint.c
      fs/f2fs/segment.c
      fs/f2fs/super.c
  * f2fs: add tracepoint for f2fs_filemap_fault()
      fs/f2fs/file.c
      include/trace/events/f2fs.h
  * f2fs: introduce DATA_GENERIC_ENHANCE
      fs/f2fs/checkpoint.c
      fs/f2fs/data.c
      fs/f2fs/f2fs.h
      fs/f2fs/file.c
      fs/f2fs/gc.c
      fs/f2fs/inode.c
      fs/f2fs/node.c
      fs/f2fs/recovery.c
      fs/f2fs/segment.c
      fs/f2fs/segment.h
  * f2fs: fix to handle error in f2fs_disable_checkpoint()
      fs/f2fs/super.c
  * f2fs: remove redundant check in f2fs_file_write_iter()
      fs/f2fs/file.c
  * f2fs: fix to be aware of readonly device in write_checkpoint()
      fs/f2fs/checkpoint.c
  * f2fs: fix to skip recovery on readonly device
      fs/f2fs/checkpoint.c
      fs/f2fs/super.c
  * f2fs: fix to consider multiple device for readonly check
      fs/f2fs/f2fs.h
      fs/f2fs/super.c
  * f2fs: relocate chksum_offset for large_nat_bitmap feature
      fs/f2fs/checkpoint.c
      fs/f2fs/f2fs.h
  * f2fs: allow unfixed f2fs_checkpoint.checksum_offset
      fs/f2fs/checkpoint.c
      include/linux/f2fs_fs.h
  * f2fs: Replace spaces with tab
      fs/f2fs/acl.c
  * f2fs: insert space before the open parenthesis '('
      fs/f2fs/acl.c
  * f2fs: allow address pointer number of dnode aligning to specified size
      fs/f2fs/f2fs.h
      fs/f2fs/file.c
      fs/f2fs/gc.c
      fs/f2fs/node.c
      fs/f2fs/super.c
      include/linux/f2fs_fs.h
  * f2fs: introduce f2fs_read_single_page() for cleanup
      fs/f2fs/data.c
  * f2fs: mark is_extension_exist() inline
      fs/f2fs/namei.c
  * f2fs: fix to set FI_UPDATE_WRITE correctly
      fs/f2fs/data.c
  * f2fs: fix to avoid panic in f2fs_inplace_write_data()
      fs/f2fs/segment.c
  * f2fs: fix to do sanity check on valid block count of segment
      fs/f2fs/segment.h
  * f2fs: fix to do sanity check on valid node/block count
      fs/f2fs/super.c
  * f2fs: fix to avoid panic in do_recover_data()
      fs/f2fs/recovery.c
  * f2fs: fix to do sanity check on free nid
      fs/f2fs/node.c
  * f2fs: fix to do checksum even if inode page is uptodate
      fs/f2fs/inode.c
      fs/f2fs/node.c
  * f2fs: fix to avoid panic in f2fs_remove_inode_page()
      fs/f2fs/node.c
  * f2fs: fix to clear dirty inode in error path of f2fs_iget()
      fs/f2fs/inode.c
  * f2fs: remove new blank line of f2fs kernel message
      fs/f2fs/file.c
      fs/f2fs/super.c
  * f2fs: fix wrong __is_meta_io() macro
      fs/f2fs/checkpoint.c
      fs/f2fs/data.c
      fs/f2fs/f2fs.h
  * f2fs: fix to avoid panic in dec_valid_node_count()
      fs/f2fs/f2fs.h
  * f2fs: fix to avoid panic in dec_valid_block_count()
      fs/f2fs/f2fs.h
  * f2fs: fix to use inline space only if inline_xattr is enable
      fs/f2fs/f2fs.h
  * f2fs: fix to retrieve inline xattr space
      fs/f2fs/inline.c
  * f2fs: fix error path of recovery
      fs/f2fs/recovery.c
  * f2fs: fix to avoid deadloop in foreground GC
      fs/f2fs/gc.c
  * f2fs: data: fix warning Using plain integer as NULL pointer
      fs/f2fs/data.c
  * f2fs: add tracepoint for f2fs_file_write_iter()
      fs/f2fs/file.c
      include/trace/events/f2fs.h
  * f2fs: add comment for conditional compilation statement
      fs/f2fs/f2fs.h
  * f2fs: fix potential recursive call when enabling data_flush
      fs/f2fs/checkpoint.c
      fs/f2fs/data.c
  * f2fs: improve discard handling with multi-device volumes
      fs/f2fs/f2fs.h
      fs/f2fs/segment.c
  * f2fs: Reduce zoned block device memory usage
      fs/f2fs/f2fs.h
      fs/f2fs/segment.c
      fs/f2fs/super.c
  * f2fs: Fix use of number of devices
      fs/f2fs/data.c
      fs/f2fs/f2fs.h
      fs/f2fs/file.c
      fs/f2fs/gc.c
      fs/f2fs/segment.c
  * ANDROID: block/cfq-iosched: make group_idle per io cgroup tunable
      block/cfq-iosched.c
    Merge remote-tracking branch 'origin/upstream-f2fs-stable-linux-4.9.y' into android-4.9
    ANDROID: cuttlefish_defconfig: Enable CONFIG_CPUSETS and CONFIG_CGROUP_SCHEDTUNE
    ANDROID: Communicates LMK events to userland where they can be logged
    Merge 4.9.174 into android-4.9
Linux 4.9.174
    media: v4l2: i2c: ov7670: Fix PLL bypass register values
    x86/mce: Improve error message when kernel cannot recover, p2
  * selinux: never allow relabeling on context mounts
      security/selinux/hooks.c
    Input: snvs_pwrkey - initialize necessary driver data before enabling IRQ
    scsi: RDMA/srpt: Fix a credit leak for aborted commands
    staging: iio: adt7316: fix the dac write calculation
    staging: iio: adt7316: fix the dac read calculation
    staging: iio: adt7316: allow adt751x to use internal vref for all dacs
    perf/x86/amd: Update generic hardware cache events for Family 17h
    ARM: iop: don't use using 64-bit DMA masks
    ARM: orion: don't use using 64-bit DMA masks
    xsysace: Fix error handling in ace_setup
    sh: fix multiple function definition build errors
    hugetlbfs: fix memory leak for resv_map
    net: hns: Fix WARNING when remove HNS driver with SMMU enabled
    net: hns: Use NAPI_POLL_WEIGHT for hns driver
    net: hns: fix KASAN: use-after-free in hns_nic_net_xmit_hw()
    scsi: storvsc: Fix calculation of sub-channel count
  * scsi: core: add new RDAC LENOVO/DE_Series device
      drivers/scsi/scsi_devinfo.c
    vfio/pci: use correct format characters
    rtc: da9063: set uie_unsupported when relevant
  * debugfs: fix use-after-free on symlink traversal
      fs/debugfs/inode.c
    jffs2: fix use-after-free on symlink traversal
    net: stmmac: don't log oversized frames
    net: stmmac: fix dropping of multi-descriptor RX frames
    net: stmmac: don't overwrite discard_frame status
  * bonding: show full hw address in sysfs for slave entries
      drivers/net/bonding/bond_sysfs_slave.c
    net/mlx5: E-Switch, Fix esw manager vport indication for more vport commands
    igb: Fix WARN_ONCE on runtime suspend
    batman-adv: Reduce tt_global hash refcnt only for removed entry
    batman-adv: Reduce tt_local hash refcnt only for removed entry
    batman-adv: Reduce claim hash refcnt only for removed entry
    rtc: sh: Fix invalid alarm warning for non-enabled alarm
  * HID: debug: fix race condition with between rdesc_show() and device removal
      drivers/hid/hid-debug.c
    HID: logitech: check the return value of create_singlethread_workqueue
    nvme-loop: init nvmet_ctrl fatal_err_work when allocate
  * USB: core: Fix bug caused by duplicate interface PM usage counter
      drivers/usb/core/driver.c
      include/linux/usb.h
  * USB: core: Fix unterminated string returned by usb_string()
      drivers/usb/core/message.c
    usb: usbip: fix isoc packet num validation in get_pipe
    USB: w1 ds2490: Fix bug caused by improper use of altsetting array
    USB: yurex: Fix protection fault after device removal
    caif: reduce stack size with KASAN
  * arm64: mm: don't print out page table entries on EL0 faults
      arch/arm64/mm/fault.c
  * arm64: mm: print out correct page table entries
      arch/arm64/include/asm/system_misc.h
      arch/arm64/mm/fault.c
  * kasan: prevent compiler from optimizing away memset in tests
      lib/Makefile
  * arm64: proc: Set PTE_NG for table entries to avoid traversing them twice
      arch/arm64/mm/proc.S
    kasan: remove redundant initialization of variable 'real_size'
    kasan: avoid -Wmaybe-uninitialized warning
  * kasan: add a prototype of task_struct to avoid warning
      include/linux/kasan.h
    arm64: kasan: avoid bad virt_to_pfn()
    x86/unwind: Disable KASAN checks for non-current tasks
    mm/kasan: Switch to using __pa_symbol and lm_alias
    x86/suspend: fix false positive KASAN warning on suspend/resume
    net: phy: marvell: Fix buffer overrun with stats counters
    bnxt_en: Improve multicast address setup logic.
  * packet: validate msg_namelen in send directly
      net/packet/af_packet.c
  * ipv6: invert flowlabel sharing check in process and user mode
      net/ipv6/ip6_flowlabel.c
  * ipv6/flowlabel: wait rcu grace period before put_pid()
      net/ipv6/ip6_flowlabel.c
  * ipv4: ip_do_fragment: Preserve skb_iif during fragmentation
      net/ipv4/ip_output.c
    ALSA: line6: use dynamic buffers
  * ext4: don't bother checking for encryption key in ->mmap()
      fs/ext4/file.c
    ANDROID: cuttlefish 4.9: enable CONFIG_CRYPTO_AES_NI_INTEL=y
    Merge 4.9.173 into android-4.9
Linux 4.9.173
    vfio/type1: Limit DMA mappings per container
    leds: pca9532: fix a potential NULL pointer dereference
    kconfig/[mn]conf: handle backspace (^H) key
  * gpio: of: Fix of_gpiochip_add() error path
      drivers/gpio/gpiolib-of.c
    libata: fix using DMA buffers on stack
    scsi: zfcp: reduce flood of fcrscn1 trace records on multi-element RSCN
    ceph: fix use-after-free on symlink traversal
    usb: u132-hcd: fix resource leak
    scsi: qla4xxx: fix a potential NULL pointer dereference
    net: ethernet: ti: fix possible object reference leak
    net: ibm: fix possible object reference leak
    net: xilinx: fix possible object reference leak
    NFS: Fix a typo in nfs_init_timeout_values()
    staging: rtl8712: uninitialized memory in read_bbreg_hdl()
    net: ks8851: Set initial carrier state to down
    net: ks8851: Delay requesting IRQ until opened
    net: ks8851: Reassert reset pin if chip ID check fails
    net: ks8851: Dequeue RX packets explicitly
    ARM: dts: pfla02: increase phy reset duration
    usb: gadget: net2272: Fix net2272_dequeue()
    usb: gadget: net2280: Fix net2280_dequeue()
    usb: gadget: net2280: Fix overrun of OUT messages
    serial: ar933x_uart: Fix build failure with disabled console
    sc16is7xx: missing unregister/delete driver on error in sc16is7xx_init()
    netfilter: bridge: set skb transport_header before entering NF_INET_PRE_ROUTING
    netfilter: nft_set_rbtree: check for inactive element after flag mismatch
    qlcnic: Avoid potential NULL pointer dereference
    s390: limit brk randomization to 32MB
    ARM: dts: bcm283x: Fix hdmi hpd gpio pull
    media: vivid: check if the cec_adapter is valid
    usbnet: ipheth: fix potential null pointer dereference in ipheth_carrier_set
    usbnet: ipheth: prevent TX queue timeouts when device not ready
    Merge 4.9.172 into android-4.9
Linux 4.9.172
    Documentation: Add nospectre_v1 parameter
    powerpc/fsl: Add FSL_PPC_BOOK3E as supported arch for nospectre_v2 boot arg
  * net: IP6 defrag: use rbtrees in nf_conntrack_reasm.c
      net/ipv6/netfilter/nf_conntrack_reasm.c
  * net: IP6 defrag: use rbtrees for IPv6 defrag
      include/net/ipv6_frag.h
      net/ipv6/reassembly.c
  * ipv6: remove dependency of nf_defrag_ipv6 on ipv6 module
      include/net/ipv6.h
      include/net/ipv6_frag.h
      net/ipv6/netfilter/nf_conntrack_reasm.c
      net/ipv6/netfilter/nf_defrag_ipv6_hooks.c
      net/ipv6/reassembly.c
  * net: IP defrag: encapsulate rbtree defrag code into callable functions
      include/net/inet_frag.h
      net/ipv4/inet_fragment.c
      net/ipv4/ip_fragment.c
  * ipv6: frags: fix a lockdep false positive
      net/ipv6/reassembly.c
  * ipv4: set the tcp_min_rtt_wlen range from 0 to one day
      net/ipv4/sysctl_net_ipv4.c
    net: stmmac: move stmmac_check_ether_addr() to driver probe
    team: fix possible recursive locking when add slaves
    net: rds: exchange of 8K and 1M pool
    net/mlx5e: ethtool, Remove unsupported SFP EEPROM high pages query
    mlxsw: spectrum: Fix autoneg status in ethtool
  * ipv4: add sanity checks in ipv4_link_failure()
      net/ipv4/route.c
  * Revert "block/loop: Use global lock for ioctl() operation."
      drivers/block/loop.c
      drivers/block/loop.h
    tipc: check link name with right length in tipc_nl_compat_link_set
    tipc: check bearer name with right length in tipc_nl_compat_bearer_enable
    fm10k: Fix a potential NULL pointer dereference
  * netfilter: ebtables: CONFIG_COMPAT: drop a bogus WARN_ON
      net/bridge/netfilter/ebtables.c
    NFS: Forbid setting AF_INET6 to "struct sockaddr_in"->sin_family.
  * fs/proc/proc_sysctl.c: Fix a NULL pointer dereference
      fs/proc/proc_sysctl.c
    intel_th: gth: Fix an off-by-one in output unassigning
  * slip: make slhc_free() silently accept an error pointer
      drivers/net/slip/slhc.c
    tipc: handle the err returned from cmd header function
    vsock/virtio: fix kernel panic from virtio_transport_reset_no_sock
  * USB: Consolidate LPM checks to avoid enabling LPM twice
      drivers/usb/core/driver.c
      drivers/usb/core/hub.c
      drivers/usb/core/message.c
  * USB: Add new USB LPM helpers
      drivers/usb/core/driver.c
      drivers/usb/core/hub.c
      drivers/usb/core/message.c
      drivers/usb/core/sysfs.c
      drivers/usb/core/usb.h
    drm/vc4: Fix compilation error reported by kbuild test bot
    drm/vc4: Fix memory leak during gpu reset.
    ARM: 8857/1: efi: enable CP15 DMB instructions before cleaning the cache
    dmaengine: sh: rcar-dmac: With cyclic DMA residue 0 is valid
    Input: synaptics-rmi4 - write config register values to the right offset
    sunrpc: don't mark uninitialised items as VALID.
    nfsd: Don't release the callback slot unless it was actually held
    ceph: fix ci->i_head_snapc leak
    ceph: ensure d_name stability in ceph_dentry_hash()
  * sched/numa: Fix a possible divide-by-zero
      kernel/sched/fair.c
    IB/rdmavt: Fix frwr memory registration
  * trace: Fix preempt_enable_no_resched() abuse
      kernel/trace/ring_buffer.c
    MIPS: scall64-o32: Fix indirect syscall number load
  * tracing: Fix a memory leak by early error exit in trace_pid_write()
      kernel/trace/trace.c
    cifs: do not attempt cifs operation on smb2+ rename error
  * kbuild: simplify ld-option implementation
      scripts/Kbuild.include
    Merge 4.9.171 into android-4.9
Linux 4.9.171
  * kernel/sysctl.c: fix out-of-bounds access when setting file-max
      kernel/sysctl.c
    Revert "locking/lockdep: Add debug_locks check in __lock_downgrade()"
    i2c-hid: properly terminate i2c_hid_dmi_desc_override_table[] array
  * percpu: stop printing kernel addresses
      mm/percpu.c
  * ALSA: info: Fix racy addition/deletion of nodes
      sound/core/info.c
  * mm/vmstat.c: fix /proc/vmstat format for CONFIG_DEBUG_TLBFLUSH=y CONFIG_SMP=n
      mm/vmstat.c
    device_cgroup: fix RCU imbalance in error case
  * sched/fair: Limit sched_cfs_period_timer() loop to avoid hard lockup
      kernel/sched/fair.c
  * Revert "kbuild: use -Oz instead of -Os when using clang"
      Makefile
    perf/x86/amd: Add event map for AMD Family 17h
    mac80211: do not call driver wake_tx_queue op during reconfig
    rt2x00: do not increment sequence number while re-transmitting
  * kprobes: Fix error check when reusing optimized probes
      kernel/kprobes.c
    kprobes: Mark ftrace mcount handler functions nokprobe
  * x86/kprobes: Verify stack frame on kretprobe
      include/linux/kprobes.h
  * arm64: futex: Restore oldval initialization to work around buggy compilers
      arch/arm64/include/asm/futex.h
    crypto: x86/poly1305 - fix overflow during partial reduction
    Revert "svm: Fix AVIC incomplete IPI emulation"
    Revert "scsi: fcoe: clear FC_RP_STARTED flags when receiving a LOGO"
  * ALSA: core: Fix card races between register and disconnect
      sound/core/init.c
    staging: comedi: ni_usb6501: Fix possible double-free of ->usb_rx_buf
    staging: comedi: ni_usb6501: Fix use of uninitialized mutex
    staging: comedi: vmk80xx: Fix possible double-free of ->usb_rx_buf
    staging: comedi: vmk80xx: Fix use of uninitialized semaphore
    io: accel: kxcjk1013: restore the range after resume.
    iio: adc: at91: disable adc channel interrupt in timeout case
    iio: ad_sigma_delta: select channel when reading register
    iio/gyro/bmg160: Use millidegrees for temperature scale
    staging: iio: ad7192: Fix ad7193 channel address
    KVM: x86: Don't clear EFER during SMM transitions for 32-bit vCPU
    CIFS: keep FileInfo handle live during oplock break
    tpm/tpm_i2c_atmel: Return -E2BIG when the transfer is incomplete
  * modpost: file2alias: check prototype of handler
      scripts/mod/file2alias.c
  * modpost: file2alias: go back to simple devtable lookup
      scripts/mod/file2alias.c
  * mmc: sdhci: Fix data command CRC error handling
      drivers/mmc/host/sdhci.c
    crypto: crypto4xx - properly set IV after de- and encrypt
  * ipv4: ensure rcu_read_lock() in ipv4_link_failure()
      net/ipv4/route.c
  * ipv4: recompile ip options in ipv4_link_failure
      net/ipv4/route.c
    vhost: reject zero size iova range
    team: set slave to promisc if team is already in promisc mode
  * tcp: tcp_grow_window() needs to respect tcp_space()
      net/ipv4/tcp_input.c
    net: fou: do not use guehdr after iptunnel_pull_offloads in gue_udp_recv
  * net: bridge: multicast: use rcu to access port list from br_multicast_start_querier
      net/bridge/br_multicast.c
  * net: bridge: fix per-port af_packet sockets
      net/bridge/br_input.c
    net: atm: Fix potential Spectre v1 vulnerabilities
  * bonding: fix event handling for stacked bonds
      drivers/net/bonding/bond_main.c
  * UPSTREAM: usb: hcd: use correct device pointer for dma ops
      drivers/usb/core/hcd.c
    UPSTREAM: usb: host: ehci: use correct device pointer for dma ops
  * UPSTREAM: usb: separate out sysdev pointer from usb_bus
      drivers/usb/core/buffer.c
      drivers/usb/core/hcd.c
      drivers/usb/core/usb.c
      include/linux/usb.h
      include/linux/usb/hcd.h
    ANDROID: cuttlefish_defconfig: Enable CONFIG_XFRM_STATISTICS
    Merge 4.9.170 into android-4.9
Linux 4.9.170
  * appletalk: Fix compile regression
      include/linux/atalk.h
    net: stmmac: Set dma ring length before enabling the DMA
    tpm/tpm_crb: Avoid unaligned reads in crb_recv()
  * include/linux/swap.h: use offsetof() instead of custom __swapoffset macro
      include/linux/swap.h
  * lib/div64.c: off by one in shift
      lib/div64.c
  * appletalk: Fix use-after-free in atalk_proc_exit
      include/linux/atalk.h
    ARM: 8839/1: kprobe: make patch_lock a raw_spinlock_t
    lkdtm: Add tests for NULL pointer dereference
    soc/tegra: pmc: Drop locking from tegra_powergate_is_powered()
    iommu/dmar: Fix buffer overflow during PCI bus notification
    crypto: sha512/arm - fix crash bug in Thumb2 build
    crypto: sha256/arm - fix crash bug in Thumb2 build
  * kernel: hung_task.c: disable on suspend
      kernel/hung_task.c
    cifs: fallback to older infolevels on findfirst queryinfo retry
    ACPI / SBS: Fix GPE storm on recent MacBookPro's
    ARM: samsung: Limit SAMSUNG_PM_CHECK config option to non-Exynos platforms
    HID: i2c-hid: override HID descriptors for certain devices
    serial: uartps: console_setup() can't be placed to init section
  * f2fs: fix to do sanity check with current segment number
      fs/f2fs/super.c
    9p locks: add mount option for lock retry interval
    9p: do not trust pdu content for stat item size
    rsi: improve kernel thread handling to fix kernel panic
    gpio: pxa: handle corner case of unprobed device
  * ext4: prohibit fstrim in norecovery mode
      fs/ext4/ioctl.c
    fix incorrect error code mapping for OBJECTID_NOT_FOUND
    x86/hw_breakpoints: Make default case in hw_breakpoint_arch_parse() return an error
    iommu/vt-d: Check capability before disabling protected memory
    x86/cpu/cyrix: Use correct macros for Cyrix calls on Geode processors
    x86/hpet: Prevent potential NULL pointer dereference
    irqchip/mbigen: Don't clear eventid when freeing an MSI
    perf tests: Fix a memory leak in test__perf_evsel__tp_sched_test()
    perf tests: Fix a memory leak of cpu_map object in the openat_syscall_event_on_all_cpus test
    perf evsel: Free evsel->counts in perf_evsel__exit()
    perf hist: Add missing map__put() in error case
    perf top: Fix error handling in cmd_top()
    perf build-id: Fix memory leak in print_sdt_events()
    perf config: Fix a memory leak in collect_config()
    perf config: Fix an error in the config template documentation
    tools/power turbostat: return the exit status of a command
    thermal/int340x_thermal: fix mode setting
    thermal/int340x_thermal: Add additional UUIDs
    ALSA: opl3: fix mismatch between snd_opl3_drum_switch definition and declaration
    mmc: davinci: remove extraneous __init annotation
    IB/mlx4: Fix race condition between catas error reset and aliasguid flows
    ALSA: sb8: add a check for request_region
    ALSA: echoaudio: add a check for ioremap_nocache
  * ext4: report real fs size after failed resize
      fs/ext4/resize.c
  * ext4: add missing brelse() in add_new_gdb_meta_bg()
      fs/ext4/resize.c
  * perf/core: Restore mmap record type correctly
      kernel/events/core.c
    ARC: u-boot args: check that magic number is correct
    ANDROID: cuttlefish_defconfig: Enable L2TP/PPTP
  * ANDROID: Makefile: Properly resolve 4.9.169 merge
      Makefile
    Make arm64 serial port config compatible with crosvm
    Merge 4.9.169 into android-4.9
Linux 4.9.169
  * PCI: Add function 1 DMA alias quirk for Marvell 9170 SATA controller
      drivers/pci/quirks.c
    xtensa: fix return_address
  * sched/fair: Do not re-read ->h_load_next during hierarchical load calculation
      kernel/sched/fair.c
    xen: Prevent buffer overflow in privcmd ioctl
    parisc: Use cr16 interval timers unconditionally on qemu
  * arm64: futex: Fix FUTEX_WAKE_OP atomic ops with non-zero result value
      arch/arm64/include/asm/futex.h
    ARM: dts: at91: Fix typo in ISC_D0 on PC9
    virtio: Honour 'may_reduce_num' in vring_create_virtqueue
  * genirq: Respect IRQCHIP_SKIP_SET_WAKE in irq_chip_set_wake_parent()
      kernel/irq/chip.c
  * block: do not leak memory in bio_copy_user_iov()
      block/bio.c
    Btrfs: do not allow trimming when a fs is mounted with the nologreplay option
    ASoC: fsl_esai: fix channel swap issue when stream starts
  * include/linux/bitrev.h: fix constant bitrev
      include/linux/bitrev.h
    parisc: Detect QEMU earlier in boot process
    ALSA: seq: Fix OOB-reads from strlcpy
  * ip6_tunnel: Match to ARPHRD_TUNNEL6 for dev type
      net/ipv6/ip6_tunnel.c
  * net: ethtool: not call vzalloc for zero sized memory request
      net/core/ethtool.c
  * netns: provide pure entropy for net_hash_mix()
      include/net/net_namespace.h
      include/net/netns/hash.h
      net/core/net_namespace.c
    net/mlx5e: Add a lock on tir list
    bnxt_en: Improve RX consumer index validity check.
    bnxt_en: Reset device on RX buffer errors.
  * vrf: check accept_source_route on the original netdevice
      include/net/ip.h
      net/ipv4/ip_input.c
      net/ipv4/ip_options.c
    tcp: Ensure DCTCP reacts to losses
    sctp: initialize _pad of sockaddr_in before copying to user memory
    qmi_wwan: add Olicard 600
    openvswitch: fix flow actions reallocation
    net: rds: force to destroy connection if t_sock is NULL in rds_tcp_kill_sock().
    kcm: switch order of device registration to fix a crash
  * ipv6: sit: reset ip header pointer in ipip6_rcv
      net/ipv6/sit.c
  * ipv6: Fix dangling pointer when ipv6 fragment
      net/ipv6/ip6_output.c
  * tty: ldisc: add sysctl to prevent autoloading of ldiscs
      drivers/tty/Kconfig
      drivers/tty/tty_io.c
      drivers/tty/tty_ldisc.c
  * tty: mark Siemens R3964 line discipline as BROKEN
      drivers/char/Kconfig
  * arm64: kaslr: Reserve size of ARM64_MEMSTART_ALIGN in linear region
      arch/arm64/mm/init.c
    powerpc/security: Fix spectre_v2 reporting
    powerpc/fsl: Fix the flush of branch predictor.
    powerpc/fsl: Fixed warning: orphan section `__btb_flush_fixup'
    powerpc/fsl: Update Spectre v2 reporting
    powerpc/fsl: Enable runtime patching if nospectre_v2 boot arg is used
    powerpc/fsl: Flush branch predictor when entering KVM
    powerpc/fsl: Flush the branch predictor at each kernel entry (32 bit)
    powerpc/fsl: Flush the branch predictor at each kernel entry (64bit)
    powerpc/fsl: Add nospectre_v2 command line argument
    powerpc/fsl: Emulate SPRN_BUCSR register
    powerpc/fsl: Fix spectre_v2 mitigations reporting
    powerpc/fsl: Add macro to flush the branch predictor
    powerpc/fsl: Add infrastructure to fixup branch predictor flush
    powerpc/powernv: Query firmware for count cache flush settings
    powerpc/pseries: Query hypervisor for count cache flush settings
    powerpc/64s: Add support for software count cache flush
    powerpc/64s: Add new security feature flags for count cache flush
    powerpc/asm: Add a patch_site macro & helpers for patching instructions
    powerpc/fsl: Sanitize the syscall table for NXP PowerPC 32 bit platforms
    powerpc/fsl: Add barrier_nospec implementation for NXP PowerPC Book3E
    powerpc/64: Make meltdown reporting Book3S 64 specific
    powerpc/64: Call setup_barrier_nospec() from setup_arch()
    powerpc/64: Add CONFIG_PPC_BARRIER_NOSPEC
    powerpc/64: Make stf barrier PPC_BOOK3S_64 specific.
    powerpc/64: Disable the speculation barrier from the command line
    powerpc64s: Show ori31 availability in spectre_v1 sysfs file not v2
    powerpc/64s: Enhance the information in cpu_show_spectre_v1()
    powerpc/64: Use barrier_nospec in syscall entry
    powerpc: Use barrier_nospec in copy_from_user()
    powerpc/64s: Enable barrier_nospec based on firmware settings
    powerpc/64s: Patch barrier_nospec in modules
    powerpc: Avoid code patching freed init sections
    powerpc/64s: Add support for ori barrier_nospec patching
    powerpc/64s: Add barrier_nospec
    powerpc: Fix invalid use of register expressions
  * lib/string.c: implement a basic bcmp
      include/linux/string.h
      lib/string.c
    x86/vdso: Drop implicit common-page-size linker flag
    x86: vdso: Use $LD instead of $CC to link
  * kbuild: clang: choose GCC_TOOLCHAIN_DIR not on LD
      Makefile
    powerpc/tm: Limit TM code inside PPC_TRANSACTIONAL_MEM
    x86/power: Make restore_processor_context() sane
    x86/power/32: Move SYSENTER MSR restoration to fix_processor_context()
    x86/power/64: Use struct desc_ptr for the IDT in struct saved_context
    x86/power: Fix some ordering bugs in __restore_processor_context()
  * fscrypt: remove filesystem specific build config option
      fs/crypto/Kconfig
      fs/crypto/fscrypt_private.h
      fs/ext4/Kconfig
      fs/ext4/dir.c
      fs/ext4/ext4.h
      fs/ext4/inode.c
      fs/ext4/ioctl.c
      fs/ext4/namei.c
      fs/ext4/page-io.c
      fs/ext4/readpage.c
      fs/ext4/super.c
      fs/ext4/sysfs.c
      fs/f2fs/Kconfig
      fs/f2fs/f2fs.h
      fs/f2fs/super.c
      fs/f2fs/sysfs.c
      include/linux/fs.h
      include/linux/fscrypt.h
  * f2fs: use IS_ENCRYPTED() to check encryption status
      fs/f2fs/data.c
      fs/f2fs/dir.c
      fs/f2fs/f2fs.h
      fs/f2fs/file.c
      fs/f2fs/inode.c
      fs/f2fs/namei.c
  * ext4: use IS_ENCRYPTED() to check encryption status
      fs/ext4/dir.c
      fs/ext4/ext4.h
      fs/ext4/ext4_jbd2.h
      fs/ext4/extents.c
      fs/ext4/file.c
      fs/ext4/ialloc.c
      fs/ext4/inode.c
      fs/ext4/move_extent.c
      fs/ext4/namei.c
      fs/ext4/page-io.c
      fs/ext4/readpage.c
  * fscrypt: return -EXDEV for incompatible rename or link into encrypted dir
      fs/crypto/hooks.c
      fs/crypto/policy.c
      include/linux/fscrypt.h
  * fscrypt: remove CRYPTO_CTR dependency
      fs/crypto/Kconfig
  * fscrypt: add Adiantum support / removed speck
      fs/crypto/crypto.c
      fs/crypto/fname.c
      fs/crypto/fscrypt_private.h
      fs/crypto/keyinfo.c
      fs/crypto/policy.c
      include/uapi/linux/fs.h
  * ANDROID: Makefile: Add '-fsplit-lto-unit' to cfi-clang-flags
      Makefile
    Merge 4.9.168 into android-4.9
Linux 4.9.168
    ACPI / video: Extend chassis-type detection with a "Lunch Box" check
  * drm/dp/mst: Configure no_stop_bit correctly for remote i2c xfers
      drivers/gpu/drm/drm_dp_mst_topology.c
    dmaengine: tegra: avoid overflow of byte tracking
    x86/build: Mark per-CPU symbols as absolute explicitly for LLD
    wlcore: Fix memory leak in case wl12xx_fetch_firmware failure
  * selinux: do not override context on context mounts
      security/selinux/hooks.c
    x86/build: Specify elf_i386 linker emulation explicitly for i386 objects
    drm/nouveau: Stop using drm_crtc_force_disable
    regulator: act8865: Fix act8600_sudcdc_voltage_ranges setting
    media: s5p-jpeg: Check for fmt_ver_flag when doing fmt enumeration
    netfilter: physdev: relax br_netfilter dependency
    dmaengine: qcom_hidma: assign channel cookie correctly
    dmaengine: imx-dma: fix warning comparison of distinct pointer types
    hpet: Fix missing '=' character in the __setup() code of hpet_mmap_enable
    HID: intel-ish: ipc: handle PIMR before ish_wakeup also clear PISR busy_clear bit
    soc/tegra: fuse: Fix illegal free of IO base address
    hwrng: virtio - Avoid repeated init of completion
    media: mt9m111: set initial frame size other than 0x0
    powerpc/pseries: Perform full re-add of CPU for topology update post-migration
  * tty: increase the default flip buffer limit to 2*640K
      drivers/tty/tty_buffer.c
    ARM: avoid Cortex-A9 livelock on tight dmb loops
    mt7601u: bump supported EEPROM version
    soc: qcom: gsbi: Fix error handling in gsbi_probe()
    ARM: dts: lpc32xx: Remove leading 0x and 0s from bindings notation
    efi/memattr: Don't bail on zero VA if it equals the region's PA
    ASoC: fsl-asoc-card: fix object reference leaks in fsl_asoc_card_probe
    e1000e: fix cyclic resets at link up with active tx
    cdrom: Fix race condition in cdrom_sysctl_register
  * fbdev: fbmem: fix memory access if logo is bigger than the screen
      drivers/video/fbdev/core/fbmem.c
    iw_cxgb4: fix srqidx leak during connection abort
  * genirq: Avoid summation loops for /proc/stat
      include/linux/irqdesc.h
      kernel/irq/chip.c
      kernel/irq/internals.h
      kernel/irq/irqdesc.c
    bcache: improve sysfs_strtoul_clamp()
    bcache: fix input overflow to sequential_cutoff
    bcache: fix input overflow to cache set sysfs file io_error_halflife
  * usb: f_fs: Avoid crash due to out-of-scope stack ptr access
      drivers/usb/gadget/function/f_fs.c
  * ALSA: PCM: check if ops are defined before suspending PCM
      sound/core/pcm_native.c
    ARM: 8833/1: Ensure that NEON code always compiles with Clang
  * kprobes: Prohibit probing on bsearch()
      lib/bsearch.c
    ACPI / video: Refactor and fix dmi_is_desktop()
    iwlwifi: pcie: fix emergency path
    leds: lp55xx: fix null deref on firmware load failure
    HID: intel-ish-hid: avoid binding wrong ishtp_cl_device
  * vfs: fix preadv64v2 and pwritev64v2 compat syscalls with offset == -1
      fs/read_write.c
    media: mx2_emmaprp: Correct return type for mem2mem buffer helpers
    media: s5p-g2d: Correct return type for mem2mem buffer helpers
    media: s5p-jpeg: Correct return type for mem2mem buffer helpers
    media: sh_veu: Correct return type for mem2mem buffer helpers
    SoC: imx-sgtl5000: add missing put_device()
    perf test: Fix failure of 'evsel-tp-sched' test on s390
    scsi: megaraid_sas: return error when create DMA pool failed
    IB/mlx4: Increase the timeout for CM cache
    mlxsw: spectrum: Avoid -Wformat-truncation warnings
    e1000e: Fix -Wformat-truncation warnings
    mmc: omap: fix the maximum timeout setting
    iommu/io-pgtable-arm-v7s: Only kmemleak_ignore L2 tables
    ARM: 8840/1: use a raw_spinlock_t in unwind
    coresight: etm4x: Add support to enable ETMv4.2
  * scsi: core: replace GFP_ATOMIC with GFP_KERNEL in scsi_scan.c
      drivers/scsi/scsi_scan.c
    usb: chipidea: Grab the (legacy) USB PHY by phandle first
    crypto: crypto4xx - add missing of_node_put after of_device_is_available
    wil6210: check null pointer in _wil_cfg80211_merge_extra_ies
    tools lib traceevent: Fix buffer overflow in arg_eval
  * fs: fix guard_bio_eod to check for real EOD errors
      fs/buffer.c
  * jbd2: fix invalid descriptor block checksum
      fs/jbd2/commit.c
    cifs: Fix NULL pointer dereference of devname
    dm thin: add sanity checks to thin-pool and external snapshot creation
    cifs: use correct format characters
  * fs/file.c: initialize init_files.resize_wait
      fs/file.c
    f2fs: do not use mutex lock in atomic context
    ocfs2: fix a panic problem caused by o2cb_ctl
    mm/slab.c: kmemleak no scan alien caches
  * mm/vmalloc.c: fix kernel BUG at mm/vmalloc.c:512!
      mm/vmalloc.c
    mm/page_ext.c: fix an imbalance with kmemleak
  * mm/cma.c: cma_declare_contiguous: correct err handling
      mm/cma.c
    scsi: hisi_sas: Set PHY linkrate when disconnected
    enic: fix build warning without CONFIG_CPUMASK_OFFSTACK
  * sysctl: handle overflow for file-max
      kernel/sysctl.c
  * include/linux/relay.h: fix percpu annotation in struct rchan
      include/linux/relay.h
    gpio: gpio-omap: fix level interrupt idling
  * tracing: kdb: Fix ftdump to not sleep
      include/linux/ring_buffer.h
      kernel/trace/ring_buffer.c
      kernel/trace/trace.c
    h8300: use cc-cross-prefix instead of hardcoding h8300-unknown-linux-
    CIFS: fix POSIX lock leak and invalid ptr deref
  * i2c: core-smbus: prevent stack corruption on read I2C_BLOCK_DATA
      drivers/i2c/i2c-core.c
    mm: mempolicy: make mbind() return -EIO when MPOL_MF_STRICT is specified
    tty/serial: atmel: RS485 HD w/DMA: enable RX after TX is stopped
    tty/serial: atmel: Add is_half_duplex helper
  * lib/int_sqrt: optimize initial value compute
      lib/int_sqrt.c
  * ext4: cleanup bh release code in ext4_ind_remove_space()
      fs/ext4/indirect.c
  * arm64: debug: Ensure debug handlers check triggering exception level
      arch/arm64/kernel/probes/kprobes.c
  * arm64: debug: Don't propagate UNKNOWN FAR into si_code for debug signals
      arch/arm64/mm/fault.c
  * ext4: switch to fscrypt_prepare_setattr()
      fs/ext4/inode.c
  * ext4: switch to fscrypt_prepare_rename()
      fs/ext4/namei.c
  * ext4: switch to fscrypt_prepare_link()
      fs/ext4/namei.c
  * ext4: switch to fscrypt_file_open()
      fs/ext4/file.c
  * ext4, dax: set ext4_dax_aops for dax files
      fs/ext4/inode.c
    ANDROID: cuttlefish_defconfig: Enable CONFIG_OVERLAY_FS
    ANDROID: cuttlefish: enable CONFIG_NET_SCH_INGRESS=y
    Merge 4.9.167 into android-4.9
Linux 4.9.167
  * arm64: support keyctl() system call in 32-bit mode
      arch/arm64/Kconfig
  * Revert "USB: core: only clean up what we allocated"
      drivers/usb/core/config.c
  * xhci: Fix port resume done detection for SS ports with LPM enabled
      drivers/usb/host/xhci-ring.c
      drivers/usb/host/xhci.h
  * USB: gadget: f_hid: fix deadlock in f_hidg_write()
      drivers/usb/gadget/function/f_hid.c
    KVM: x86: Emulate MSR_IA32_ARCH_CAPABILITIES on AMD hosts
    KVM: Reject device ioctls from processes other than the VM's creator
    x86/smp: Enforce CONFIG_HOTPLUG_CPU when SMP=y
  * cpu/hotplug: Prevent crash when CPU bringup fails on CONFIG_HOTPLUG_CPU=n
      kernel/cpu.c
    perf intel-pt: Fix TSC slip
    usb: host: xhci-rcar: Add XHCI_TRUST_TX_LENGTH quirk
  * usb: common: Consider only available nodes for dr_mode
      drivers/usb/common/common.c
    gpio: adnp: Fix testing wrong value in adnp_gpio_direction_input
  * fs/proc/proc_sysctl.c: fix NULL pointer dereference in put_links
      fs/proc/proc_sysctl.c
    Disable kgdboc failed by echo space to /sys/module/kgdboc/parameters/kgdboc
    USB: serial: option: add Olicard 600
    USB: serial: option: set driver_info for SIM5218 and compatibles
    USB: serial: mos7720: fix mos_parport refcount imbalance on error path
    USB: serial: ftdi_sio: add additional NovaTech products
    USB: serial: cp210x: add new device id
    serial: sh-sci: Fix setting SCSCR_TIE while transferring data
    serial: max310x: Fix to avoid potential NULL pointer dereference
    staging: vt6655: Fix interrupt race condition on device start up.
    staging: vt6655: Remove vif check from vnt_interrupt
    staging: comedi: ni_mio_common: Fix divide-by-zero for DIO cmdtest
    tty: atmel_serial: fix a potential NULL pointer dereference
    scsi: zfcp: fix scsi_eh host reset with port_forced ERP for non-NPIV FCP devices
    scsi: zfcp: fix rport unblock if deleted SCSI devices on Scsi_Host
  * scsi: sd: Quiesce warning if device does not report optimal I/O size
      drivers/scsi/sd.c
  * scsi: sd: Fix a race between closing an sd device and sd I/O
      drivers/scsi/sd.c
  * fs/open.c: allow opening only regular files during execve()
      fs/open.c
  * ALSA: pcm: Don't suspend stream in unrecoverable PCM state
      sound/core/pcm_native.c
    ALSA: pcm: Fix possible OOB access in PCM oss plugins
    ALSA: seq: oss: Fix Spectre v1 vulnerability
  * ALSA: rawmidi: Fix potential Spectre v1 vulnerability
      sound/core/rawmidi.c
    net: dsa: qca8k: remove leftover phy accessors
    NFSv4.1 don't free interrupted slot on open
    powerpc: bpf: Fix generation of load/store DW instructions
    ARM: imx6q: cpuidle: fix bug that CPU might not wake up at expected time
    btrfs: raid56: properly unmap parity page in finish_parity_scrub()
    btrfs: remove WARN_ON in log_dir_items
  * tun: add a missing rcu_read_unlock() in error path
      drivers/net/tun.c
  * tun: properly test for IFF_UP
      drivers/net/tun.c
    mac8390: Fix mmio access size probe
  * sctp: get sctphdr by offset in sctp_compute_cksum
      include/net/sctp/checksum.h
    vxlan: Don't call gro_cells_destroy() before device is unregistered
  * tcp: do not use ipv6 header for ipv4 flow
      net/ipv6/tcp_ipv6.c
  * packets: Always register packet sk in the same order
      include/net/sock.h
      net/packet/af_packet.c
    net: rose: fix a possible stack overflow
  * net/packet: Set __GFP_NOWARN upon allocation in alloc_pg_vec
      net/packet/af_packet.c
    mISDN: hfcpci: Test both vendor & device ID for Digium HFC4S
    dccp: do not use ipv6 header for ipv4 flow
    stmmac: copy unicast mac address to MAC registers
  * cfg80211: size various nl80211 messages correctly
      net/wireless/nl80211.c
    video: fbdev: Set pixclock = 0 in goldfishfb
  * Bluetooth: Verify that l2cap_get_conf_opt provides large enough buffer
      net/bluetooth/l2cap_core.c
  * Bluetooth: Check L2CAP option sizes returned from l2cap_get_conf_opt
      net/bluetooth/l2cap_core.c
    UPSTREAM: virt_wifi: Remove REGULATORY_WIPHY_SELF_MANAGED
    Merge 4.9.166 into android-4.9
Linux 4.9.166
    ath10k: avoid possible string overflow
    power: supply: charger-manager: Fix incorrect return value
    pwm-backlight: Enable/disable the PWM before/after LCD enable toggle.
  * rtc: Fix overflow when converting time64_t to rtc_time
      drivers/rtc/rtc-lib.c
  * scsi: ufs: fix wrong command type of UTRD for UFSHCI v2.1
      drivers/scsi/ufs/ufshcd.c
  * USB: core: only clean up what we allocated
      drivers/usb/core/config.c
  * lib/int_sqrt: optimize small argument
      lib/int_sqrt.c
    serial: sprd: clear timeout interrupt only rather than all interrupts
  * arm64: traps: disable irq in die()
      arch/arm64/kernel/traps.c
  * Hang/soft lockup in d_invalidate with simultaneous calls
      fs/dcache.c
    serial: sprd: adjust TIMEOUT to a big value
  * tcp/dccp: drop SYN packets if accept queue is full
      include/net/inet_connection_sock.h
      net/ipv4/tcp_input.c
    ALSA: hda - Enforces runtime_resume after S3 and S4 for each codec
    ALSA: hda - Record the current power state before suspend/resume calls
    locking/lockdep: Add debug_locks check in __lock_downgrade()
  * Bluetooth: Fix decrementing reference count twice in releasing socket
      net/bluetooth/hci_sock.c
  * media: v4l2-ctrls.c/uvc: zero v4l2_event
      drivers/media/v4l2-core/v4l2-ctrls.c
  * ext4: brelse all indirect buffer in ext4_ind_remove_space()
      fs/ext4/indirect.c
  * ext4: fix data corruption caused by unaligned direct AIO
      fs/ext4/file.c
  * ext4: fix NULL pointer dereference while journal is aborted
      fs/ext4/ext4_jbd2.h
    objtool: Move objtool_file struct off the stack
  * futex: Ensure that futex address is aligned in handle_futex_death()
      kernel/futex.c
    MIPS: Fix kernel crash for R6 in jump label branch function
    MIPS: Ensure ELF appended dtb is relocated
    mips: loongson64: lemote-2f: Add IRQF_NO_SUSPEND to "cascade" irqaction.
    udf: Fix crash on IO error during truncate
    libceph: wait for latest osdmap in ceph_monc_blacklist_add()
    iommu/amd: fix sg->dma_address for sg->offset bigger than PAGE_SIZE
    drm/vmwgfx: Don't double-free the mode stored in par->set_mode
    mmc: pxamci: fix enum type confusion

Change-Id: I240c51a5bde3c2c7a9ada58c87d5d0966f26cb78
Signed-off-by: Robin Peng <robinpeng@google.com>
2019-07-02 15:35:29 +08:00
Nick Desaulniers
7eceaf5bbf lib/string.c: implement a basic bcmp
[ Upstream commit 5f074f3e192f10c9fade898b9b3b8812e3d83342 ]

A recent optimization in Clang (r355672) lowers comparisons of the
return value of memcmp against zero to comparisons of the return value
of bcmp against zero.  This helps some platforms that implement bcmp
more efficiently than memcmp.  glibc simply aliases bcmp to memcmp, but
an optimized implementation is in the works.

This results in linkage failures for all targets with Clang due to the
undefined symbol.  For now, just implement bcmp as a tailcail to memcmp
to unbreak the build.  This routine can be further optimized in the
future.

Other ideas discussed:

 * A weak alias was discussed, but breaks for architectures that define
   their own implementations of memcmp since aliases to declarations are
   not permitted (only definitions). Arch-specific memcmp
   implementations typically declare memcmp in C headers, but implement
   them in assembly.

 * -ffreestanding also is used sporadically throughout the kernel.

 * -fno-builtin-bcmp doesn't work when doing LTO.

Link: https://bugs.llvm.org/show_bug.cgi?id=41035
Link: https://code.woboq.org/userspace/glibc/string/memcmp.c.html#bcmp
Link: 8e16d73346
Link: https://github.com/ClangBuiltLinux/linux/issues/416
Link: http://lkml.kernel.org/r/20190313211335.165605-1-ndesaulniers@google.com
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reported-by: Nathan Chancellor <natechancellor@gmail.com>
Reported-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Suggested-by: James Y Knight <jyknight@google.com>
Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: David Laight <David.Laight@ACULAB.COM>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-04-17 08:36:39 +02:00
Petri Gynther
15daaf6e6a Merge 4.9.114 into android-msm-bluecross-4.9-lts
Linux 4.9.114
  * string: drop __must_check from strscpy() and restore strscpy() usages in cgroup
      include/linux/string.h
  * arm64: KVM: Add ARCH_WORKAROUND_2 discovery through ARCH_FEATURES_FUNC_ID
      arch/arm64/include/asm/kvm_host.h
  * arm64: KVM: Handle guest's ARCH_WORKAROUND_2 requests
      arch/arm64/kernel/asm-offsets.c
  * arm64: KVM: Add ARCH_WORKAROUND_2 support for guests
      arch/arm64/include/asm/kvm_asm.h
      arch/arm64/include/asm/kvm_host.h
  * arm64: KVM: Add HYP per-cpu accessors
      arch/arm64/include/asm/kvm_asm.h
  * arm64: ssbd: Add prctl interface for per-thread mitigation
      arch/arm64/kernel/Makefile
      arch/arm64/kernel/ssbd.c
  * arm64: ssbd: Introduce thread flag to control userspace mitigation
      arch/arm64/include/asm/thread_info.h
      arch/arm64/kernel/entry.S
  * arm64: ssbd: Restore mitigation status on CPU resume
      arch/arm64/include/asm/cpufeature.h
      arch/arm64/kernel/cpu_errata.c
      arch/arm64/kernel/suspend.c
  * arm64: ssbd: Skip apply_ssbd if not using dynamic mitigation
      arch/arm64/kernel/cpu_errata.c
      arch/arm64/kernel/entry.S
  * arm64: ssbd: Add global mitigation state accessor
      arch/arm64/include/asm/cpufeature.h
  * arm64: Add 'ssbd' command-line option
      arch/arm64/include/asm/cpufeature.h
      arch/arm64/kernel/cpu_errata.c
  * arm64: Add ARCH_WORKAROUND_2 probing
      arch/arm64/Kconfig
      arch/arm64/include/asm/cpucaps.h
      arch/arm64/kernel/cpu_errata.c
  * arm64: Add per-cpu infrastructure to call ARCH_WORKAROUND_2
      arch/arm64/kernel/cpu_errata.c
      arch/arm64/kernel/entry.S
  * arm64: Call ARCH_WORKAROUND_2 on transitions between EL0 and EL1
      arch/arm64/kernel/cpu_errata.c
      arch/arm64/kernel/entry.S
      include/linux/arm-smccc.h
  * arm/arm64: smccc: Add SMCCC-specific return codes
      include/linux/arm-smccc.h
  * KVM: arm64: Avoid storing the vcpu pointer on the stack
      arch/arm64/include/asm/kvm_asm.h
      arch/arm64/include/asm/kvm_host.h
      arch/arm64/kernel/asm-offsets.c
    KVM: arm/arm64: Do not use kern_hyp_va() with kvm_vgic_global_state
  * arm64: alternatives: Add dynamic patching feature
      arch/arm64/include/asm/alternative.h
      arch/arm64/kernel/alternative.c
    KVM: arm64: Stop save/restoring host tpidr_el1 on VHE
  * arm64: alternatives: use tpidr_el2 on VHE hosts
      arch/arm64/include/asm/alternative.h
      arch/arm64/include/asm/assembler.h
      arch/arm64/include/asm/percpu.h
      arch/arm64/kernel/alternative.c
      arch/arm64/kernel/cpufeature.c
  * KVM: arm64: Change hyp_panic()s dependency on tpidr_el2
      arch/arm64/include/asm/kvm_host.h
    KVM: arm/arm64: Convert kvm_host_cpu_state to a static per-cpu allocation
    KVM: arm64: Store vcpu on the stack during __guest_enter()
  * arm64: assembler: introduce ldr_this_cpu
      arch/arm64/include/asm/assembler.h
      arch/arm64/kernel/entry.S
    net/nfc: Avoid stalls when nfc_alloc_send_skb() returned NULL.
    rds: avoid unenecessary cong_update in loop transport
  * netfilter: ipv6: nf_defrag: drop skb dst before queueing
      net/ipv6/netfilter/nf_conntrack_reasm.c
    KEYS: DNS: fix parsing multiple options
    reiserfs: fix buffer overflow with long warning messages
  * netfilter: ebtables: reject non-bridge targets
      net/bridge/netfilter/ebtables.c
    net: lan78xx: Fix race in tx pending skb size calculation
    rtlwifi: rtl8821ae: fix firmware is not ready to run
    net: cxgb3_main: fix potential Spectre v1
    net/mlx5: Fix command interface race in polling mode
  * net/packet: fix use-after-free
      net/packet/af_packet.c
    vhost_net: validate sock before trying to put its fd
  * tcp: prevent bogus FRTO undos with non-SACK flows
      net/ipv4/tcp_input.c
  * tcp: fix Fast Open key endianness
      net/ipv4/sysctl_net_ipv4.c
    r8152: napi hangup fix after disconnect
    qmi_wwan: add support for the Dell Wireless 5821e module
    qed: Limit msix vectors in kdump kernel to the minimum required count.
    qed: Fix use of incorrect size in memcpy call.
    net: sungem: fix rx checksum support
  * net_sched: blackhole: tell upper qdisc about dropped packets
      net/sched/sch_blackhole.c
    net/mlx5: Fix wrong size allocation for QoS ETC TC regitster
    net/mlx5: Fix incorrect raw command length parsing
    net: dccp: switch rx_tstamp_last_feedback to monotonic clock
    net: dccp: avoid crash in ccid3_hc_rx_send_feedback()
    ipvlan: fix IFLA_MTU ignored on NEWLINK
    atm: zatm: Fix potential Spectre v1
    crypto: crypto4xx - fix crypto4xx_build_pdr, crypto4xx_build_sdr leak
    crypto: crypto4xx - remove bad list_del
    bcm63xx_enet: do not write to random DMA channel on BCM6345
    bcm63xx_enet: correct clock usage
    mtd: m25p80: consider max message size in m25p80_read
    ocfs2: ip_alloc_sem should be taken in ocfs2_get_block()
    ocfs2: subsystem.su_mutex is required while accessing the item->ci_parent
    x86/paravirt: Make native_save_fl() extern inline
    x86/asm: Add _ASM_ARG* constants for argument registers to <asm/asm.h>
  * compiler-gcc.h: Add __attribute__((gnu_inline)) to all inline declarations
      include/linux/compiler-gcc.h
  * compiler, clang: always inline when CONFIG_OPTIMIZE_INLINING is disabled
      include/linux/compiler-clang.h
      include/linux/compiler-gcc.h
  * compiler, clang: properly override 'inline' for clang
      include/linux/compiler-clang.h
  * compiler, clang: suppress warning for unused static inline functions
      include/linux/compiler-clang.h
    MIPS: Use async IPIs for arch_trigger_cpumask_backtrace()

Change-Id: I83785f84fccfa763d5fb528af71b35aca438ae5f
Signed-off-by: Petri Gynther <pgynther@google.com>
2018-09-20 14:56:02 -07:00
Tejun Heo
5c067898fe string: drop __must_check from strscpy() and restore strscpy() usages in cgroup
commit 08a77676f9c5fc69a681ccd2cd8140e65dcb26c7 upstream.

e7fd37ba1217 ("cgroup: avoid copying strings longer than the buffers")
converted possibly unsafe strncpy() usages in cgroup to strscpy().
However, although the callsites are completely fine with truncated
copied, because strscpy() is marked __must_check, it led to the
following warnings.

  kernel/cgroup/cgroup.c: In function ‘cgroup_file_name’:
  kernel/cgroup/cgroup.c:1400:10: warning: ignoring return value of ‘strscpy’, declared with attribute warn_unused_result [-Wunused-result]
     strscpy(buf, cft->name, CGROUP_FILE_NAME_MAX);
	       ^

To avoid the warnings, 50034ed49645 ("cgroup: use strlcpy() instead of
strscpy() to avoid spurious warning") switched them to strlcpy().

strlcpy() is worse than strlcpy() because it unconditionally runs
strlen() on the source string, and the only reason we switched to
strlcpy() here was because it was lacking __must_check, which doesn't
reflect any material differences between the two function.  It's just
that someone added __must_check to strscpy() and not to strlcpy().

These basic string copy operations are used in variety of ways, and
one of not-so-uncommon use cases is safely handling truncated copies,
where the caller naturally doesn't care about the return value.  The
__must_check doesn't match the actual use cases and forces users to
opt for inferior variants which lack __must_check by happenstance or
spread ugly (void) casts.

Remove __must_check from strscpy() and restore strscpy() usages in
cgroup.

Signed-off-by: Tejun Heo <tj@kernel.org>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Chris Metcalf <cmetcalf@ezchip.com>
[backport only the string.h portion to remove build warnings starting to show up - gregkh]
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-22 14:27:42 +02:00
Daniel Mentz
9c715ce859 Merge LA.UM.7.3.9.08.00.00.385.245 via branch qcom-msm-4.9 into android-msm-bluecross-4.9
Merge Qualcomm's LA.UM.7.3.9.08.00.00.385.245

Conflicts:
	Makefile
	arch/arm64/Makefile
	arch/arm64/boot/dts/qcom/pfk_ecryptfs.h
	arch/arm64/include/asm/signal32.h
	arch/arm64/kernel/vdso/gettimeofday.S
	block/bio.c
	block/blk-core.c
	block/blk-merge.c
	drivers/crypto/msm/ice.c
	drivers/input/touchscreen/Makefile
	drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c
	drivers/media/platform/msm/camera/cam_isp/cam_isp_context.h
	drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c
	drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c
	drivers/power/supply/power_supply_sysfs.c
	drivers/power/supply/qcom/Makefile
	drivers/scsi/ufs/ufs-qcom-ice.c
	drivers/scsi/ufs/ufshcd.c
	drivers/video/console/dummycon.c
	fs/crypto/Kconfig
	fs/crypto/Makefile
	fs/crypto/fscrypt_private.h
	fs/crypto/keyinfo.c
	fs/direct-io.c
	fs/ext4/inode.c
	fs/ext4/page-io.c
	fs/f2fs/data.c
	fs/f2fs/f2fs.h
	fs/f2fs/file.c
	fs/f2fs/node.c
	fs/f2fs/super.c
	include/linux/blkdev.h
	include/linux/f2fs_fs.h
	include/linux/fscrypt.h
	include/linux/fscrypt_notsupp.h
	include/linux/fscrypt_supp.h
	include/linux/pfk.h
	include/linux/power_supply.h
	include/linux/security.h
	include/linux/tcp.h
	include/uapi/linux/fs.h
	kernel/sched/cpufreq_schedutil.c
	kernel/sched/fair.c
	net/ipv4/tcp.c
	scripts/Kbuild.include
	security/Kconfig
	security/pfe/Kconfig
	security/pfe/Makefile
	security/pfe/pfk.c
	security/pfe/pfk_internal.h
	security/pfe/pfk_kc.c
	security/pfe/pfk_kc.h
	security/security.c
	security/selinux/include/objsec.h

Change-Id: I7601101b4be54a5f662908bc51d1f60793346885
2018-04-19 17:20:26 -07:00
Blagovest Kolenichev
e06a1054bd Merge android-4.9.84 (a9d0273) into msm-4.9
* refs/heads/tmp-a9d0273:
  Linux 4.9.84
  crypto: s5p-sss - Fix kernel Oops in AES-ECB mode
  KVM: nVMX: invvpid handling improvements
  KVM: VMX: clean up declaration of VPID/EPT invalidation types
  KVM: async_pf: Fix #DF due to inject "Page not Present" and "Page Ready" exceptions simultaneously
  x86/microcode/AMD: Change load_microcode_amd()'s param to bool to fix preemptibility bug
  usb: phy: msm add regulator dependency
  arm64: fix warning about swapper_pg_dir overflow
  idle: i7300: add PCI dependency
  spi: bcm-qspi: shut up warning about cfi header inclusion
  binfmt_elf: compat: avoid unused function warning
  arm64: sunxi: always enable reset controller
  drm/i915: hide unused intel_panel_set_backlight function
  kasan: rework Kconfig settings
  clk: meson: gxbb: fix build error without RESET_CONTROLLER
  ISDN: eicon: reduce stack size of sig_ind function
  tw5864: use dev_warn instead of WARN to shut up warning
  em28xx: only use mt9v011 if camera support is enabled
  go7007: add MEDIA_CAMERA_SUPPORT dependency
  tc358743: fix register i2c_rd/wr functions
  shmem: fix compilation warnings on unused functions
  KVM: add X86_LOCAL_APIC dependency
  Input: tca8418_keypad - hide gcc-4.9 -Wmaybe-uninitialized warning
  drm/nouveau: hide gcc-4.9 -Wmaybe-uninitialized
  rbd: silence bogus -Wmaybe-uninitialized warning
  drm: exynos: mark pm functions as __maybe_unused
  security/keys: BIG_KEY requires CONFIG_CRYPTO
  cw1200: fix bogus maybe-uninitialized warning
  reiserfs: avoid a -Wmaybe-uninitialized warning
  ALSA: hda/ca0132 - fix possible NULL pointer use
  arm64: Kconfig: select COMPAT_BINFMT_ELF only when BINFMT_ELF is set
  scsi: advansys: fix uninitialized data access
  x86/vm86: Fix unused variable warning if THP is disabled
  x86/platform: Add PCI dependency for PUNIT_ATOM_DEBUG
  dmaengine: zx: fix build warning
  x86: add MULTIUSER dependency for KVM
  thermal: fix INTEL_SOC_DTS_IOSF_CORE dependencies
  x86/build: Silence the build with "make -s"
  tools build: Add tools tree support for 'make -s'
  x86/fpu/math-emu: Fix possible uninitialized variable use
  arm64: define BUG() instruction without CONFIG_BUG
  gpio: xgene: mark PM functions as __maybe_unused
  x86/ras/inject: Make it depend on X86_LOCAL_APIC=y
  scsi: advansys: fix build warning for PCI=n
  video: fbdev: via: remove possibly unused variables
  perf: xgene: Include module.h
  PCI: Change pci_host_common_probe() visibility
  usb: musb: fix compilation warning on unused function
  platform/x86: intel_mid_thermal: Fix suspend handlers unused warning
  gpio: intel-mid: Fix build warning when !CONFIG_PM
  PCI: vmd: Fix suspend handlers defined-but-not-used warning
  perf/x86: Shut up false-positive -Wmaybe-uninitialized warning
  vmxnet3: prevent building with 64K pages
  clk: sunxi-ng: fix build error without CONFIG_RESET_CONTROLLER
  shmem: avoid maybe-uninitialized warning
  drm/i915: fix intel_backlight_device_register declaration
  crypto: talitos - fix Kernel Oops on hashing an empty file
  powerpc/64s: Improve RFI L1-D cache flush fallback
  powerpc/64s: Simple RFI macro conversions
  powerpc/64s: Fix conversion of slb_miss_common to use RFI_TO_USER/KERNEL
  hippi: Fix a Fix a possible sleep-in-atomic bug in rr_close
  xen: XEN_ACPI_PROCESSOR is Dom0-only
  platform/x86: dell-laptop: Fix keyboard max lighting for Dell Latitude E6410
  x86/mm/kmmio: Fix mmiotrace for page unaligned addresses
  mm/early_ioremap: Fix boot hang with earlyprintk=efi,keep
  usb: dwc3: of-simple: fix missing clk_disable_unprepare
  usb: dwc3: gadget: Wait longer for controller to end command processing
  dmaengine: jz4740: disable/unprepare clk if probe fails
  drm/armada: fix leak of crtc structure
  xfrm: Fix stack-out-of-bounds with misconfigured transport mode policies.
  spi: sun4i: disable clocks in the remove function
  ASoC: rockchip: disable clock on error
  clk: fix a panic error caused by accessing NULL pointer
  dmaengine: at_hdmac: fix potential NULL pointer dereference in atc_prep_dma_interleaved
  dmaengine: ioat: Fix error handling path
  gianfar: Disable EEE autoneg by default
  509: fix printing uninitialized stack memory when OID is empty
  net: ethernet: arc: fix error handling in emac_rockchip_probe
  brcmfmac: Avoid build error with make W=1
  btrfs: Fix possible off-by-one in btrfs_search_path_in_tree
  net_sched: red: Avoid illegal values
  net_sched: red: Avoid devision by zero
  gianfar: fix a flooded alignment reports because of padding issue.
  ARM: dts: Fix elm interrupt compiler warning
  s390/dasd: prevent prefix I/O error
  powerpc/perf: Fix oops when grouping different pmu events
  m68k: add missing SOFTIRQENTRY_TEXT linker section
  ipvlan: Add the skb->mark as flow4's member to lookup route
  scripts/kernel-doc: Don't fail with status != 0 if error encountered with -none
  sctp: only update outstanding_bytes for transmitted queue when doing prsctp_prune
  RDMA/cma: Make sure that PSN is not over max allowed
  i40iw: Correct ARP index mask
  pinctrl: sunxi: Fix A64 UART mux value
  pinctrl: sunxi: Fix A80 interrupt pin bank
  media: s5k6aa: describe some function parameters
  perf bench numa: Fixup discontiguous/sparse numa nodes
  perf top: Fix window dimensions change handling
  ARM: dts: am437x-cm-t43: Correct the dmas property of spi0
  ARM: dts: am4372: Correct the interrupts_properties of McASP
  ARM: dts: logicpd-somlv: Fix wl127x pinmux
  ARM: dts: logicpd-som-lv: Fix gpmc addresses for NAND and enet
  ARM: dts: Fix omap4 hang with GPS connected to USB by using wakeupgen
  ARM: AM33xx: PRM: Remove am33xx_pwrdm_read_prev_pwrst function
  ARM: OMAP2+: Fix SRAM virt to phys translation for save_secure_ram_context
  usb: build drivers/usb/common/ when USB_SUPPORT is set
  usbip: keep usbip_device sockfd state in sync with tcp_socket
  staging: iio: ad5933: switch buffer mode to software
  staging: iio: adc: ad7192: fix external frequency setting
  binder: check for binder_thread allocation failure in binder_poll()
  staging: android: ashmem: Fix a race condition in pin ioctls
  dn_getsockoptdecnet: move nf_{get/set}sockopt outside sock lock
  arm64: dts: add #cooling-cells to CPU nodes
  ARM: 8743/1: bL_switcher: add MODULE_LICENSE tag
  video: fbdev/mmp: add MODULE_LICENSE
  ASoC: ux500: add MODULE_LICENSE tag
  crypto: hash - prevent using keyed hashes without setting key
  crypto: hash - annotate algorithms taking optional key
  net: avoid skb_warn_bad_offload on IS_ERR
  rds: tcp: atomically purge entries from rds_tcp_conn_list during netns delete
  netfilter: xt_RATEEST: acquire xt_rateest_mutex for hash insert
  netfilter: xt_cgroup: initialize info->priv in cgroup_mt_check_v1()
  netfilter: on sockopt() acquire sock lock only in the required scope
  netfilter: ipt_CLUSTERIP: fix out-of-bounds accesses in clusterip_tg_check()
  netfilter: x_tables: avoid out-of-bounds reads in xt_request_find_{match|target}
  netfilter: x_tables: fix int overflow in xt_alloc_table_info()
  kcov: detect double association with a single task
  KVM: x86: fix escape of guest dr6 to the host
  blk_rq_map_user_iov: fix error override
  staging: android: ion: Switch from WARN to pr_warn
  staging: android: ion: Add __GFP_NOWARN for system contig heap
  crypto: x86/twofish-3way - Fix %rbp usage
  selinux: skip bounded transition processing if the policy isn't loaded
  selinux: ensure the context is NUL terminated in security_context_to_sid_core()
  Provide a function to create a NUL-terminated string from unterminated data
  ptr_ring: fail early if queue occupies more than KMALLOC_MAX_SIZE
  drm: Require __GFP_NOFAIL for the legacy drm_modeset_lock_all
  blktrace: fix unlocked registration of tracepoints
  sctp: set frag_point in sctp_setsockopt_maxseg correctly
  xfrm: check id proto in validate_tmpl()
  xfrm: Fix stack-out-of-bounds read on socket policy lookup.
  mm,vmscan: Make unregister_shrinker() no-op if register_shrinker() failed.
  xfrm: skip policies marked as dead while rehashing
  cfg80211: check dev_set_name() return value
  kcm: Only allow TCP sockets to be attached to a KCM mux
  kcm: Check if sk_user_data already set in kcm_attach
  vhost: use mutex_lock_nested() in vhost_dev_lock_vqs()
  ANDROID: sdcardfs: Hold i_mutex for i_size_write
  UPSTREAM: ANDROID: binder: synchronize_rcu() when using POLLFREE.
  BACKPORT, FROMGIT: crypto: speck - add test vectors for Speck64-XTS
  BACKPORT, FROMGIT: crypto: speck - add test vectors for Speck128-XTS
  BACKPORT, FROMGIT: crypto: arm/speck - add NEON-accelerated implementation of Speck-XTS
  FROMGIT: crypto: speck - export common helpers
  BACKPORT, FROMGIT: crypto: speck - add support for the Speck block cipher
  f2fs: updates on v4.16-rc1
  Linux 4.9.83
  media: r820t: fix r820t_write_reg for KASAN
  ARM: dts: Delete bogus reference to the charlcd
  arm: dts: mt2701: Add reset-cells
  ARM: dts: s5pv210: add interrupt-parent for ohci
  arm64: dts: msm8916: Add missing #phy-cells
  ARM: pxa/tosa-bt: add MODULE_LICENSE tag
  ARM: dts: exynos: fix RTC interrupt for exynos5410
  vfs: don't do RCU lookup of empty pathnames
  x86: fix build warnign with 32-bit PAE
  x86/cpu: Change type of x86_cache_size variable to unsigned int
  x86/spectre: Fix an error message
  x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping
  selftests/x86/mpx: Fix incorrect bounds with old _sigfault
  x86/speculation: Add <asm/msr-index.h> dependency
  nospec: Move array_index_nospec() parameter checking into separate macro
  x86/speculation: Fix up array_index_nospec_mask() asm constraint
  selftests/x86: Do not rely on "int $0x80" in single_step_syscall.c
  selftests/x86: Do not rely on "int $0x80" in test_mremap_vdso.c
  selftests/x86/pkeys: Remove unused functions
  x86/speculation: Clean up various Spectre related details
  X86/nVMX: Properly set spec_ctrl and pred_cmd before merging MSRs
  KVM/x86: Reduce retpoline performance impact in slot_handle_level_range(), by always inlining iterator helper methods
  x86/speculation: Correct Speculation Control microcode blacklist again
  x86/speculation: Update Speculation Control microcode blacklist
  compiler-gcc.h: Introduce __optimize function attribute
  x86/entry/64/compat: Clear registers for compat syscalls, to reduce speculation attack surface
  arm: spear13xx: Fix spics gpio controller's warning
  arm: spear13xx: Fix dmas cells
  arm: spear600: Add missing interrupt-parent of rtc
  ARM: dts: nomadik: add interrupt-parent for clcd
  ARM: dts: STi: Add gpio polarity for "hdmi,hpd-gpio" property
  ARM: lpc3250: fix uda1380 gpio numbers
  arm64: dts: msm8916: Correct ipc references for smsm
  s390: fix handling of -1 in set{,fs}[gu]id16 syscalls
  ocfs2: try a blocking lock before return AOP_TRUNCATED_PAGE
  PM / devfreq: Propagate error from devfreq_add_device()
  cpufreq: powernv: Dont assume distinct pstate values for nominal and pmin
  RDMA/rxe: Fix a race condition related to the QP error state
  kselftest: fix OOM in memory compaction test
  IB/mlx4: Fix incorrectly releasing steerable UD QPs when have only ETH ports
  IB/qib: Fix comparison error with qperf compare/swap test
  powerpc: fix build errors in stable tree
  dm: correctly handle chained bios in dec_pending()
  usb: Move USB_UHCI_BIG_ENDIAN_* out of USB_SUPPORT
  mvpp2: fix multicast address filter
  ALSA: seq: Fix racy pool initializations
  ALSA: usb-audio: add implicit fb quirk for Behringer UFX1204
  ALSA: hda/realtek: PCI quirk for Fujitsu U7x7
  ALSA: hda/realtek - Enable Thinkpad Dock device for ALC298 platform
  ALSA: usb-audio: Fix UAC2 get_ctl request with a RANGE attribute
  ALSA: hda - Fix headset mic detection problem for two Dell machines
  mtd: nand: vf610: set correct ooblayout
  9p/trans_virtio: discard zero-length reply
  Btrfs: fix unexpected -EEXIST when creating new inode
  Btrfs: fix btrfs_evict_inode to handle abnormal inodes correctly
  Btrfs: fix extent state leak from tree log
  Btrfs: fix crash due to not cleaning up tree log block's dirty bits
  Btrfs: fix deadlock in run_delalloc_nocow
  target/iscsi: avoid NULL dereference in CHAP auth error path
  rtlwifi: rtl8821ae: Fix connection lost problem correctly
  console/dummy: leave .con_font_get set to NULL
  video: fbdev: atmel_lcdfb: fix display-timings lookup
  PCI: keystone: Fix interrupt-controller-node lookup
  MIPS: Fix typo BIG_ENDIAN to CPU_BIG_ENDIAN
  mm: Fix memory size alignment in devm_memremap_pages_release()
  mm: hide a #warning for COMPILE_TEST
  ext4: correct documentation for grpid mount option
  ext4: save error to disk in __ext4_grp_locked_error()
  ext4: fix a race in the ext4 shutdown path
  jbd2: fix sphinx kernel-doc build warnings
  mbcache: initialize entry->e_referenced in mb_cache_entry_create()
  rtc-opal: Fix handling of firmware error codes, prevent busy loops
  drm/radeon: adjust tested variable
  drm/radeon: Add dpm quirk for Jet PRO (v2)
  scsi: smartpqi: allow static build ("built-in")
  BACKPORT: tee: shm: Potential NULL dereference calling tee_shm_register()
  BACKPORT: tee: shm: don't put_page on null shm->pages
  BACKPORT: tee: shm: make function __tee_shm_alloc static
  BACKPORT: tee: optee: check type of registered shared memory
  BACKPORT: tee: add start argument to shm_register callback
  BACKPORT: tee: optee: fix header dependencies
  BACKPORT: tee: shm: inline tee_shm_get_id()
  BACKPORT: tee: use reference counting for tee_context
  BACKPORT: tee: optee: enable dynamic SHM support
  BACKPORT: tee: optee: add optee-specific shared pool implementation
  BACKPORT: tee: optee: store OP-TEE capabilities in private data
  BACKPORT: tee: optee: add registered buffers handling into RPC calls
  BACKPORT: tee: optee: add registered shared parameters handling
  BACKPORT: tee: optee: add shared buffer registration functions
  BACKPORT: tee: optee: add page list manipulation functions
  BACKPORT: tee: optee: Update protocol definitions
  BACKPORT: tee: shm: add page accessor functions
  BACKPORT: tee: shm: add accessors for buffer size and page offset
  BACKPORT: tee: add register user memory
  BACKPORT: tee: flexible shared memory pool creation
  BACKPORT: optee: support asynchronous supplicant requests
  BACKPORT: tee: add TEE_IOCTL_PARAM_ATTR_META
  BACKPORT: tee: add tee_param_is_memref() for driver use
  UPSTREAM: tcp: fix access to sk->sk_state in tcp_poll()
  BACKPORT: tcp: fix potential double free issue for fastopen_req
  BACKPORT: xfrm: Fix return value check of copy_sec_ctx.
  time: Fix ktime_get_raw() incorrect base accumulation
  FROMLIST: coresight: ETM: Add support for ARM Cortex-A73
  FROMLIST: coresight: tmc: implementing TMC-ETR AUX space API
  UPSTREAM: coresight: etm_perf: Fix using uninitialised work
  UPSTREAM: coresight: fix kernel panic caused by invalid CPU
  UPSTREAM: coresight: Fix disabling of CoreSight TPIU
  UPSTREAM: coresight: perf: Add a missing call to etm_free_aux
  UPSTREAM: coresight: tmc: Remove duplicate memset
  UPSTREAM: coresight: tmc: Get rid of mode parameter for helper routines
  UPSTREAM: coresight: tmc: Cleanup operation mode handling
  UPSTREAM: coresight: reset "enable_sink" flag when need be
  sched/fair: prevent possible infinite loop in sched_group_energy
  ANDROID: qtaguid: Fix the UAF probelm with tag_ref_tree
  UPSTREAM: ANDROID: binder: remove waitqueue when thread exits.
  ANDROID: sdcardfs: Protect set_top
  ANDROID: fsnotify: Notify lower fs of open
  Revert "ANDROID: sdcardfs: notify lower file of opens"
  ANDROID: sdcardfs: Use lower getattr times/size
  ANDROID: sched: EAS: check energy_aware() before calling select_energy_cpu_brute() in up-migrate path
  UPSTREAM: eventpoll.h: add missing epoll event masks
  BACKPORT: thermal/drivers/hisi: Add support for hi3660 SoC
  BACKPORT: thermal/drivers/hisi: Prepare to add support for other hisi platforms
  BACKPORT: thermal/drivers/hisi: Add platform prefix to function name
  BACKPORT: thermal/drivers/hisi: Put platform code together
  BACKPORT: thermal/drivers/hisi: Use round up step value
  BACKPORT: thermal/drivers/hisi: Move the clk setup in the corresponding functions
  BACKPORT: thermal/drivers/hisi: Remove mutex_lock in the code
  BACKPORT: thermal/drivers/hisi: Remove thermal data back pointer
  BACKPORT: thermal/drivers/hisi: Convert long to int
  BACKPORT: thermal/drivers/hisi: Rename and remove unused field
  BACKPORT: thermal/drivers/hisi: Remove costly sensor inspection
  BACKPORT: thermal/drivers/hisi: Fix configuration register setting
  BACKPORT: thermal/drivers/hisi: Encapsulate register writes into helpers
  BACKPORT: thermal/drivers/hisi: Remove pointless lock
  BACKPORT: thermal/drivers/hisi: Remove the multiple sensors support
  BACKPORT: thermal: hisilicon: constify thermal_zone_of_device_ops structures
  ANDROID: xattr: Pass EOPNOTSUPP to permission2
  ANDROID: sdcardfs: Move default_normal to superblock
  UPSTREAM: tcp: fix a request socket leak
  UPSTREAM: tcp: fix possible deadlock in TCP stack vs BPF filter
  UPSTREAM: tcp: Add a tcp_filter hook before handle ack packet
  FROMLIST: arm64: kpti: Fix the interaction between ASID switching and software PAN
  FROMLIST: arm64: Move post_ttbr_update_workaround to C code
  fscrypt: updates on 4.15-rc4
  ANDROID: uid_sys_stats: fix the comment
  BACKPORT: optee: fix invalid of_node_put() in optee_driver_init()
  BACKPORT: tee: optee: sync with new naming of interrupts
  BACKPORT: tee: indicate privileged dev in gen_caps
  BACKPORT: tee: optee: interruptible RPC sleep
  BACKPORT: tee: optee: add const to tee_driver_ops and tee_desc structures
  BACKPORT: tee: tee_shm: Constify dma_buf_ops structures.
  BACKPORT: tee: add forward declaration for struct device
  BACKPORT: tee: optee: fix uninitialized symbol 'parg'
  BACKPORT: tee.txt: standardize document format
  BACKPORT: tee: add ARM_SMCCC dependency
  clocksource: arch_timer: make virtual counter access configurable
  arm64: issue isb when trapping CNTVCT_EL0 access
  BACKPORT: arm64: Add CNTFRQ_EL0 trap handler
  BACKPORT: arm64: Add CNTVCT_EL0 trap handler
  ANDROID: sdcardfs: Fix missing break on default_normal
  ANDROID: arm64: kaslr: fixup Falkor workaround for 4.9
  ANDROID: usb: f_fs: Prevent gadget unbind if it is already unbound
  arm64: Kconfig: Reword UNMAP_KERNEL_AT_EL0 kconfig entry
  arm64: use RET instruction for exiting the trampoline
  UPSTREAM: arm64: kaslr: Put kernel vectors address in separate data page
  UPSTREAM: arm64: mm: Introduce TTBR_ASID_MASK for getting at the ASID in the TTBR
  UPSTREAM: arm64: Kconfig: Add CONFIG_UNMAP_KERNEL_AT_EL0
  UPSTREAM: arm64: entry: Add fake CPU feature for unmapping the kernel at EL0
  UPSTREAM: arm64: tls: Avoid unconditional zeroing of tpidrro_el0 for native tasks
  UPSTREAM: arm64: erratum: Work around Falkor erratum #E1003 in trampoline code
  UPSTREAM: arm64: entry: Hook up entry trampoline to exception vectors
  UPSTREAM: arm64: entry: Explicitly pass exception level to kernel_ventry macro
  UPSTREAM: arm64: mm: Map entry trampoline into trampoline and kernel page tables
  UPSTREAM: arm64: entry: Add exception trampoline page for exceptions from EL0
  UPSTREAM: arm64: mm: Invalidate both kernel and user ASIDs when performing TLBI
  UPSTREAM: arm64: mm: Add arm64_kernel_unmapped_at_el0 helper
  UPSTREAM: arm64: mm: Allocate ASIDs in pairs
  UPSTREAM: arm64: mm: Fix and re-enable ARM64_SW_TTBR0_PAN
  UPSTREAM: arm64: mm: Rename post_ttbr0_update_workaround
  UPSTREAM: arm64: mm: Move ASID from TTBR0 to TTBR1
  UPSTREAM: arm64: mm: Temporarily disable ARM64_SW_TTBR0_PAN
  UPSTREAM: arm64: mm: Use non-global mappings for kernel space
  UPSTREAM: arm64: factor out entry stack manipulation
  ANDROID: sdcardfs: Add default_normal option
  ANDROID: sdcardfs: notify lower file of opens
  blkdev: Refactoring block io latency histogram codes
  UPSTREAM: netfilter: conntrack: use power efficient workqueue
  ANDROID: binder: Remove obsolete proc waitqueue.
  UPSTREAM: arm64: setup: introduce kaslr_offset()
  UPSTREAM: kcov: fix comparison callback signature
  UPSTREAM: kcov: support comparison operands collection
  UPSTREAM: kcov: remove pointless current != NULL check
  UPSTREAM: kcov: support compat processes
  UPSTREAM: kcov: simplify interrupt check
  UPSTREAM: kcov: make kcov work properly with KASLR enabled
  UPSTREAM: kcov: add more missing includes
  BACKPORT: irq: Make the irqentry text section unconditional
  UPSTREAM: kasan: make get_wild_bug_type() static
  UPSTREAM: kasan: separate report parts by empty lines
  UPSTREAM: kasan: improve double-free report format
  UPSTREAM: kasan: print page description after stacks
  UPSTREAM: kasan: improve slab object description
  UPSTREAM: kasan: change report header
  UPSTREAM: kasan: simplify address description logic
  UPSTREAM: kasan: change allocation and freeing stack traces headers
  UPSTREAM: kasan: unify report headers
  UPSTREAM: kasan: introduce helper functions for determining bug type
  BACKPORT: kasan: report only the first error by default
  UPSTREAM: kasan: fix races in quarantine_remove_cache()
  UPSTREAM: kasan: resched in quarantine_remove_cache()
  UPSTREAM: kasan, sched/headers: Uninline kasan_enable/disable_current()
  UPSTREAM: kasan: drain quarantine of memcg slab objects
  UPSTREAM: kasan: eliminate long stalls during quarantine reduction
  UPSTREAM: kasan: support panic_on_warn
  ANDROID: dma-buf/sw_sync: Rename active_list to link
  ANDROID: initramfs: call free_initrd() when skipping init
  BACKPORT: Documentation: tee subsystem and op-tee driver
  BACKPORT: tee: add OP-TEE driver
  BACKPORT: tee: generic TEE subsystem
  BACKPORT: dt/bindings: add bindings for optee
  BACKPORT: schedutil: Reset cached freq if it is not in sync with next_freq
  sched: EAS/WALT: Don't take into account of running task's util
  sched: EAS/WALT: take into account of waking task's load
  sched: EAS: upmigrate misfit current task
  sched: avoid pushing tasks to an offline CPU
  sched: Extend active balance to accept 'push_task' argument
  sched: walt: Correct WALT window size initialization
  sched: WALT: account cumulative window demand
  sched: EAS/WALT: finish accounting prior to task_tick
  sched/fair: prevent meaningless active migration
  sched: walt: Leverage existing helper APIs to apply invariance
  UPSTREAM: net: xfrm: allow clearing socket xfrm policies.
  UPSTREAM: time: Clean up CLOCK_MONOTONIC_RAW time handling
  UPSTREAM: arm64: vdso: fix clock_getres for 4GiB-aligned res
  f2fs: updates on 4.15-rc1
  UPSTREAM: android: binder: fix type mismatch warning
  BACKPORT: arm64: Use __pa_symbol for empty_zero_page
  UPSTREAM: arm64: Use __pa_symbol for kernel symbols
  UPSTREAM: mm: Introduce lm_alias
  FROMLIST: binder: fix proc->files use-after-free
  BACKPORT: xfrm: Clear sk_dst_cache when applying per-socket policy.
  sched: WALT: fix potential overflow
  sched: Update task->on_rq when tasks are moving between runqueues
  sched: WALT: fix window mis-alignment
  sched: EAS: kill incorrect nohz idle cpu kick
  sched: EAS: fix incorrect energy delta calculation due to rounding error
  sched: EAS/WALT: use cr_avg instead of prev_runnable_sum
  sched: WALT: fix broken cumulative runnable average accounting
  sched: deadline: WALT: account cumulative runnable avg
  ANDROID: binder: clarify deferred thread work.
  BACKPORT: net/tcp-fastopen: Add new API support
  UPSTREAM: net: Remove __sk_dst_reset() in tcp_v6_connect()
  UPSTREAM: net/tcp-fastopen: refactor cookie check logic
  sched: compute task utilisation with WALT consistently
  FROMLIST: arm64: Avoid aligning normal memory pointers in __memcpy_{to,from}io
  UPSTREAM: security: bpf: replace include of linux/bpf.h with forward declarations
  UPSTREAM: selinux: bpf: Add addtional check for bpf object file receive
  UPSTREAM: selinux: bpf: Add selinux check for eBPF syscall operations
  BACKPORT: security: bpf: Add LSM hooks for bpf object related syscall
  BACKPORT: bpf: Add file mode configuration into bpf maps
  cpufreq: Drop schedfreq governor
  ANDROID: Revert "arm64: move ELF_ET_DYN_BASE to 4GB / 4MB"
  ANDROID: Revert "arm: move ELF_ET_DYN_BASE to 4MB"
  sched: EAS: Fix the condition to distinguish energy before/after
  sched: EAS: update trg_cpu to backup_cpu if no energy saving for target_cpu
  sched/fair: consider task utilization in group_max_util()
  sched/fair: consider task utilization in group_norm_util()
  sched/fair: enforce EAS mode
  sched/fair: ignore backup CPU when not valid
  sched/fair: trace energy_diff for non boosted tasks
  UPSTREAM: sched/fair: Sync task util before slow-path wakeup
  UPSTREAM: sched/core: Add missing update_rq_clock() call in set_user_nice()
  UPSTREAM: sched/core: Add missing update_rq_clock() call for task_hot()
  UPSTREAM: sched/core: Add missing update_rq_clock() in detach_task_cfs_rq()
  UPSTREAM: sched/core: Add missing update_rq_clock() in post_init_entity_util_avg()
  UPSTREAM: sched/fair: Fix task group initialization
  cpufreq/sched: Consider max cpu capacity when choosing frequencies
  cpufreq/sched: Use cpu max freq rather than policy max
  sched/fair: remove erroneous RCU_LOCKDEP_WARN from start_cpu()
  FROMLIST: ALSA: usx2y: Suppress kernel warning at page allocation failures
  FROMLIST: kbuild: clang: fix build failures with sparse check
  Revert "Revert "BACKPORT: efi/libstub/arm64: Set -fpie when building the EFI stub""
  BACKPORT: efi/libstub: Unify command line param parsing
  ANDROID: sched/walt: Fix divide by zero error in cpufreq notifier
  ANDROID: binder: show high watermark of alloc->pages.
  ANDROID: binder: Add thread->process_todo flag.
  ANDROID: sched/fair: Select correct capacity state for energy_diff
  ANDROID: cpufreq-dt: Set sane defaults for schedutil rate limits
  BACKPORT: cpufreq: schedutil: Use policy-dependent transition delays
  Revert "BACKPORT: efi/libstub/arm64: Set -fpie when building the EFI stub"
  FROMLIST: android: binder: Fix null ptr dereference in debug msg
  FROMLIST: android: binder: Change binder_shrinker to static
  UPSTREAM: arm64: compat: Remove leftover variable declaration
  ANDROID: HACK: arm64: use -mno-implicit-float instead of -mgeneral-regs-only
  ANDROID: Kbuild, LLVMLinux: allow overriding clang target triple
  CHROMIUM: arm64: Disable asm-operand-width warning for clang
  CHROMIUM: kbuild: clang: Disable the 'duplicate-decl-specifier' warning
  BACKPORT: x86/asm: Fix inline asm call constraints for Clang
  BACKPORT: efi/libstub/arm64: Set -fpie when building the EFI stub
  UPSTREAM: efi/libstub/arm64: Force 'hidden' visibility for section markers
  UPSTREAM: efi/libstub/arm64: Use hidden attribute for struct screen_info reference
  UPSTREAM: x86/build: Use cc-option to validate stack alignment parameter
  UPSTREAM: x86/build: Fix stack alignment for CLang
  UPSTREAM: compiler, clang: always inline when CONFIG_OPTIMIZE_INLINING is disabled
  UPSTREAM: x86/boot: #undef memcpy() et al in string.c
  UPSTREAM: llist: clang: introduce member_address_is_nonnull()
  UPSTREAM: crypto: arm64/sha - avoid non-standard inline asm tricks
  UPSTREAM: kbuild: clang: Disable 'address-of-packed-member' warning
  UPSTREAM: x86/build: Specify stack alignment for clang
  UPSTREAM: x86/build: Use __cc-option for boot code compiler options
  UPSTREAM: kbuild: Add __cc-option macro
  UPSTREAM: x86/mm/kaslr: Use the _ASM_MUL macro for multiplication to work around Clang incompatibility
  UPSTREAM: crypto, x86: aesni - fix token pasting for clang
  UPSTREAM: x86/kbuild: Use cc-option to enable -falign-{jumps/loops}
  UPSTREAM: compiler, clang: properly override 'inline' for clang
  UPSTREAM: compiler, clang: suppress warning for unused static inline functions
  UPSTREAM: modules: mark __inittest/__exittest as __maybe_unused
  UPSTREAM: kbuild: Add support to generate LLVM assembly files
  UPSTREAM: kbuild: use -Oz instead of -Os when using clang
  UPSTREAM: kbuild, LLVMLinux: Add -Werror to cc-option to support clang
  UPSTREAM: kbuild: drop -Wno-unknown-warning-option from clang options
  UPSTREAM: kbuild: fix asm-offset generation to work with clang
  UPSTREAM: kbuild: consolidate redundant sed script ASM offset generation
  UPSTREAM: kbuild: Consolidate header generation from ASM offset information
  UPSTREAM: kbuild: clang: add -no-integrated-as to KBUILD_[AC]FLAGS
  UPSTREAM: kbuild: Add better clang cross build support
  FROMLIST: f2fs: expose some sectors to user in inline data or dentry case
  UPSTREAM: sched/fair: Fix usage of find_idlest_group() when the local group is idlest
  UPSTREAM: sched/fair: Fix usage of find_idlest_group() when no groups are allowed
  UPSTREAM: sched/fair: Fix find_idlest_group() when local group is not allowed
  UPSTREAM: sched/fair: Remove unnecessary comparison with -1
  UPSTREAM: sched/fair: Move select_task_rq_fair() slow-path into its own function
  UPSTREAM: sched/fair: Force balancing on NOHZ balance if local group has capacity
  UPSTREAM: f2fs: fix potential panic during fstrim
  f2fs: catch up to v4.14-rc1
  UPSTREAM: sched: use load_avg for selecting idlest group
  UPSTREAM: sched: fix find_idlest_group for fork
  ANDROID: binder: fix node sched policy calculation
  ANDROID: binder: init desired_prio.sched_policy before use it
  BACKPORT: net: xfrm: support setting an output mark.
  FROMLIST: tracing: Add support for preempt and irq enable/disable events
  FROMLIST: tracing: Prepare to add preempt and irq trace events

Conflicts:
	arch/arm64/Kconfig
	arch/arm64/include/asm/assembler.h
	arch/arm64/include/asm/cpucaps.h
	arch/arm64/include/asm/efi.h
	arch/arm64/include/asm/memory.h
	arch/arm64/include/asm/mmu.h
	arch/arm64/include/asm/mmu_context.h
	arch/arm64/kernel/cpufeature.c
	arch/arm64/kernel/io.c
	arch/arm64/kernel/setup.c
	arch/arm64/kernel/vdso.c
	arch/arm64/mm/context.c
	arch/arm64/mm/mmu.c
	drivers/Kconfig
	drivers/Makefile
	drivers/cpufreq/Kconfig
	drivers/hwtracing/coresight/coresight-etm4x.c
	drivers/hwtracing/coresight/coresight-priv.h
	drivers/hwtracing/coresight/coresight-tmc-etr.c
	drivers/hwtracing/coresight/coresight.c
	drivers/scsi/ufs/ufshcd.h
	drivers/staging/android/ion/ion-ioctl.c
	drivers/staging/android/ion/ion_system_heap.c
	drivers/usb/dwc3/gadget.c
	include/linux/sched.h
	include/trace/events/sched.h
	kernel/kcov.c
	kernel/sched/core.c
	kernel/sched/cpufreq_sched.c
	kernel/sched/cpufreq_schedutil.c
	kernel/sched/fair.c
	kernel/sched/sched.h
	kernel/sched/walt.c
	kernel/sched/walt.h
	mm/kasan/report.c
	security/security.c
	security/selinux/hooks.c

Change-Id: I0ec8cbca6cb6384e22fbbe8def8a9d228229dc48
Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
2018-03-19 04:18:31 -07:00
David Howells
5cab144f07 Provide a function to create a NUL-terminated string from unterminated data
commit f35157417215ec138c920320c746fdb3e04ef1d5 upstream.

Provide a function, kmemdup_nul(), that will create a NUL-terminated string
from an unterminated character array where the length is known in advance.

This is better than kstrndup() in situations where we already know the
string length as the strnlen() in kstrndup() is superfluous.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-25 11:05:41 +01:00
Alexey Polyudov
3ce0ad138f Merge remote-tracking branch 'partner/qcom-msm-4.9' into android-msm-bluecross-4.9
Conflicts:
	drivers/gpu/drm/msm/dsi-staging/dsi_display.c
	drivers/soc/qcom/Makefile
	drivers/usb/phy/phy-msm-qusb-v2.c

Change-Id: I1cd8b5205cac72d247a266a51efa4d57ca976dc4
2017-12-20 16:16:25 -08:00
Channagoud Kadabi
724ed8f409 include: Disable compile time boundary check
Newer version of gcc keeps the calls to __write_overflow which is only a
compile time check. __write_overflow is implemented as error function
and as a result all the string functions fail with the overflow error.
Work around the gcc issue by defining the overflow functions as no-op.

Change-Id: I41c2bb6d35c1a308c1a4e9c1d484ad6ad2bf7d3f
Signed-off-by: Channagoud Kadabi <ckadabi@codeaurora.org>
2017-12-05 20:22:44 -08:00
Daniel Micay
3d2f47bfa3 replace incorrect strscpy use in FORTIFY_SOURCE
Using strscpy was wrong because FORTIFY_SOURCE is passing the maximum
possible size of the outermost object, but strscpy defines the count
parameter as the exact buffer size, so this could copy past the end of
the source.  This would still be wrong with the planned usage of
__builtin_object_size(p, 1) for intra-object overflow checks since it's
the maximum possible size of the specified object with no guarantee of
it being that large.

Reuse of the fortified functions like this currently makes the runtime
error reporting less precise but that can be improved later on.

Noticed by Dave Jones and KASAN.

Change-Id: I559abc94e1fd8acaa97cfc2c23d454caa43ce804
Signed-off-by: Daniel Micay <danielmicay@gmail.com>
Acked-by: Kees Cook <keescook@chromium.org>
Reported-by: Dave Jones <davej@codemonkey.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: 077d2ba519b2e8bf1abd80cbade699b1de42cafe
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
2017-10-27 10:14:37 -07:00
Vikram Mulukutla
ba13b75c62 Revert "replace incorrect strscpy use in FORTIFY_SOURCE"
This reverts commit 4c5c1c70bb.

The author attribution is incorrect and will be corrected soon.

Change-Id: I97767788e2ca5a827ffd2f4730877f211382826e
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
2017-10-27 10:14:29 -07:00
Alexey Polyudov
6c2f3d399a Merge remote-tracking branch 'partner/qcom-msm-4.9' into android-msm-bluecross-4.9
Conflicts:
	drivers/gpu/drm/msm/dsi-staging/dsi_catalog.h
	drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c
	drivers/gpu/drm/msm/dsi-staging/dsi_ctrl_hw.h
	drivers/gpu/drm/msm/dsi-staging/dsi_ctrl_hw_cmn.c
	net/netfilter/xt_qtaguid.c

Change-Id: I0f214587b6c192d7f7d1a178b5049328fd12b440
2017-10-26 15:00:33 -07:00
Heikki Krogerus
c951506077 lib/string: add sysfs_match_string helper
Make a simple helper for matching strings with sysfs
attribute files. In most parts the same as match_string(),
except sysfs_match_string() uses sysfs_streq() instead of
strcmp() for matching. This is more convenient when used
with sysfs attributes.

Bug: 67648334
Change-Id: I57c1af76862840ecae1b892b6e3cbee92f565a37
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
2017-10-20 15:04:32 -07:00
Vikram Mulukutla
4c5c1c70bb replace incorrect strscpy use in FORTIFY_SOURCE
Using strscpy was wrong because FORTIFY_SOURCE is passing the maximum
possible size of the outermost object, but strscpy defines the count
parameter as the exact buffer size, so this could copy past the end of
the source.  This would still be wrong with the planned usage of
__builtin_object_size(p, 1) for intra-object overflow checks since it's
the maximum possible size of the specified object with no guarantee of
it being that large.

Reuse of the fortified functions like this currently makes the runtime
error reporting less precise but that can be improved later on.

Noticed by Dave Jones and KASAN.

Change-Id: I0b485afdcab001002152d39ade3189db6dbaa1c8
Signed-off-by: Daniel Micay <danielmicay@gmail.com>
Acked-by: Kees Cook <keescook@chromium.org>
Reported-by: Dave Jones <davej@codemonkey.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: 077d2ba519b2e8bf1abd80cbade699b1de42cafe
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
2017-09-14 13:12:54 -07:00
Daniel Micay
0f51310ad5 include/linux/string.h: add the option of fortified string.h functions
This adds support for compiling with a rough equivalent to the glibc
_FORTIFY_SOURCE=1 feature, providing compile-time and runtime buffer
overflow checks for string.h functions when the compiler determines the
size of the source or destination buffer at compile-time.  Unlike glibc,
it covers buffer reads in addition to writes.

GNU C __builtin_*_chk intrinsics are avoided because they would force a
much more complex implementation.  They aren't designed to detect read
overflows and offer no real benefit when using an implementation based
on inline checks.  Inline checks don't add up to much code size and
allow full use of the regular string intrinsics while avoiding the need
for a bunch of _chk functions and per-arch assembly to avoid wrapper
overhead.

This detects various overflows at compile-time in various drivers and
some non-x86 core kernel code.  There will likely be issues caught in
regular use at runtime too.

Future improvements left out of initial implementation for simplicity,
as it's all quite optional and can be done incrementally:

* Some of the fortified string functions (strncpy, strcat), don't yet
  place a limit on reads from the source based on __builtin_object_size of
  the source buffer.

* Extending coverage to more string functions like strlcat.

* It should be possible to optionally use __builtin_object_size(x, 1) for
  some functions (C strings) to detect intra-object overflows (like
  glibc's _FORTIFY_SOURCE=2), but for now this takes the conservative
  approach to avoid likely compatibility issues.

* The compile-time checks should be made available via a separate config
  option which can be enabled by default (or always enabled) once enough
  time has passed to get the issues it catches fixed.

Kees said:
 "This is great to have. While it was out-of-tree code, it would have
  blocked at least CVE-2016-3858 from being exploitable (improper size
  argument to strlcpy()). I've sent a number of fixes for
  out-of-bounds-reads that this detected upstream already"

Change-Id: I4c6ba947ffc296caf1b074f7ef4a3b64877230ea
[arnd@arndb.de: x86: fix fortified memcpy]
  Link: http://lkml.kernel.org/r/20170627150047.660360-1-arnd@arndb.de
[keescook@chromium.org: avoid panic() in favor of BUG()]
  Link: http://lkml.kernel.org/r/20170626235122.GA25261@beast
[keescook@chromium.org: move from -mm, add ARCH_HAS_FORTIFY_SOURCE, tweak Kconfig help]
Link: http://lkml.kernel.org/r/20170526095404.20439-1-danielmicay@gmail.com
Link: http://lkml.kernel.org/r/1497903987-21002-8-git-send-email-keescook@chromium.org
Signed-off-by: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Daniel Axtens <dja@axtens.net>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Chris Metcalf <cmetcalf@ezchip.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: 6974f0c4555e285ab217cee58b6e874f776ff409
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2017-08-07 17:43:55 -07:00
Rasmus Villemoes
48a270554a include/linux: apply __malloc attribute
Attach the malloc attribute to a few allocation functions.  This helps
gcc generate better code by telling it that the return value doesn't
alias any existing pointers (which is even more valuable given the
pessimizations implied by -fno-strict-aliasing).

A simple example of what this allows gcc to do can be seen by looking at
the last part of drm_atomic_helper_plane_reset:

	plane->state = kzalloc(sizeof(*plane->state), GFP_KERNEL);

	if (plane->state) {
		plane->state->plane = plane;
		plane->state->rotation = BIT(DRM_ROTATE_0);
	}

which compiles to

    e8 99 bf d6 ff          callq  ffffffff8116d540 <kmem_cache_alloc_trace>
    48 85 c0                test   %rax,%rax
    48 89 83 40 02 00 00    mov    %rax,0x240(%rbx)
    74 11                   je     ffffffff814015c4 <drm_atomic_helper_plane_reset+0x64>
    48 89 18                mov    %rbx,(%rax)
    48 8b 83 40 02 00 00    mov    0x240(%rbx),%rax [*]
    c7 40 40 01 00 00 00    movl   $0x1,0x40(%rax)

With this patch applied, the instruction at [*] is elided, since the
store to plane->state->plane is known to not alter the value of
plane->state.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-05-19 19:12:14 -07:00
Kees Cook
ef95159907 lib: move strtobool() to kstrtobool()
Create the kstrtobool_from_user() helper and move strtobool() logic into
the new kstrtobool() (matching all the other kstrto* functions).
Provides an inline wrapper for existing strtobool() callers.

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Joe Perches <joe@perches.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Amitkumar Karwar <akarwar@marvell.com>
Cc: Nishant Sarmukadam <nishants@marvell.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: Steve French <sfrench@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-03-17 15:09:34 -07:00
Andy Shevchenko
56b060814e lib/string: introduce match_string() helper
Occasionally we have to search for an occurrence of a string in an array
of strings.  Make a simple helper for that purpose.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: David Airlie <airlied@linux.ie>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-03-17 15:09:34 -07:00
Al Viro
e9d408e107 new helper: memdup_user_nul()
Similar to memdup_user(), except that allocated buffer is one byte
longer and '\0' is stored after the copied data.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2016-01-04 10:20:19 -05:00
Chris Metcalf
30035e4575 string: provide strscpy()
The strscpy() API is intended to be used instead of strlcpy(),
and instead of most uses of strncpy().

- Unlike strlcpy(), it doesn't read from memory beyond (src + size).

- Unlike strlcpy() or strncpy(), the API provides an easy way to check
  for destination buffer overflow: an -E2BIG error return value.

- The provided implementation is robust in the face of the source
  buffer being asynchronously changed during the copy, unlike the
  current implementation of strlcpy().

- Unlike strncpy(), the destination buffer will be NUL-terminated
  if the string in the source buffer is too long.

- Also unlike strncpy(), the destination buffer will not be updated
  beyond the NUL termination, avoiding strncpy's behavior of zeroing
  the entire tail end of the destination buffer.  (A memset() after
  the strscpy() can be used if this behavior is desired.)

- The implementation should be reasonably performant on all
  platforms since it uses the asm/word-at-a-time.h API rather than
  simple byte copy.  Kernel-to-kernel string copy is not considered
  to be performance critical in any case.

Signed-off-by: Chris Metcalf <cmetcalf@ezchip.com>
2015-09-10 15:36:59 -04:00
Rasmus Villemoes
94df290404 lib/string.c: introduce strreplace()
Strings are sometimes sanitized by replacing a certain character (often
'/') by another (often '!').  In a few places, this is done the same way
Schlemiel the Painter would do it.  Others are slightly smarter but still
do multiple strchr() calls.  Introduce strreplace() to do this using a
single function call and a single pass over the string.

One would expect the return value to be one of three things: void, s, or
the number of replacements made.  I chose the fourth, returning a pointer
to the end of the string.  This is more likely to be useful (for example
allowing the caller to avoid a strlen call).

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Neil Brown <neilb@suse.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-06-25 17:00:40 -07:00
Andrzej Hajda
a4bb1e43e2 mm/util: add kstrdup_const
kstrdup() is often used to duplicate strings where neither source neither
destination will be ever modified.  In such case we can just reuse the
source instead of duplicating it.  The problem is that we must be sure
that the source is non-modifiable and its life-time is long enough.

I suspect the good candidates for such strings are strings located in
kernel .rodata section, they cannot be modifed because the section is
read-only and their life-time is equal to kernel life-time.

This small patchset proposes alternative version of kstrdup -
kstrdup_const, which returns source string if it is located in .rodata
otherwise it fallbacks to kstrdup.  To verify if the source is in
.rodata function checks if the address is between sentinels
__start_rodata, __end_rodata.  I guess it should work with all
architectures.

The main patch is accompanied by four patches constifying kstrdup for
cases where situtation described above happens frequently.

I have tested the patchset on mobile platform (exynos4210-trats) and it
saves 3272 string allocations.  Since minimal allocation is 32 or 64
bytes depending on Kconfig options the patchset saves respectively about
100KB or 200KB of memory.

Stats from tested platform show that the main offender is sysfs:

By caller:
  2260 __kernfs_new_node
    631 clk_register+0xc8/0x1b8
    318 clk_register+0x34/0x1b8
      51 kmem_cache_create
      12 alloc_vfsmnt

By string (with count >= 5):
    883 power
    876 subsystem
    135 parameters
    132 device
     61 iommu_group
    ...

This patch (of 5):

Add an alternative version of kstrdup which returns pointer to constant
char array.  The function checks if input string is in persistent and
read-only memory section, if yes it returns the input string, otherwise it
fallbacks to kstrdup.

kstrdup_const is accompanied by kfree_const performing conditional memory
deallocation of the string.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Mike Turquette <mturquette@linaro.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Greg KH <greg@kroah.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-02-13 21:21:35 -08:00
Rasmus Villemoes
af3cd13501 lib/string.c: remove strnicmp()
Now that all in-tree users of strnicmp have been converted to
strncasecmp, the wrapper can be removed.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: David Howells <dhowells@redhat.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-02-12 18:54:14 -08:00
Linus Torvalds
14d4cc0883 Merge tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random
Pull /dev/random updates from Ted Ts'o:
 "This adds a memzero_explicit() call which is guaranteed not to be
  optimized away by GCC.  This is important when we are wiping
  cryptographically sensitive material"

* tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random:
  crypto: memzero_explicit - make sure to clear out sensitive data
  random: add and use memzero_explicit() for clearing data
2014-10-24 12:33:32 -07:00
Daniel Borkmann
d4c5efdb97 random: add and use memzero_explicit() for clearing data
zatimend has reported that in his environment (3.16/gcc4.8.3/corei7)
memset() calls which clear out sensitive data in extract_{buf,entropy,
entropy_user}() in random driver are being optimized away by gcc.

Add a helper memzero_explicit() (similarly as explicit_bzero() variants)
that can be used in such cases where a variable with sensitive data is
being cleared out in the end. Other use cases might also be in crypto
code. [ I have put this into lib/string.c though, as it's always built-in
and doesn't need any dependencies then. ]

Fixes kernel bugzilla: 82041

Reported-by: zatimend@hotmail.co.uk
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
2014-10-17 11:37:29 -04:00
Rasmus Villemoes
b0bfb63118 lib: string: Make all calls to strnicmp into calls to strncasecmp
The previous patch made strnicmp into a wrapper for strncasecmp.

This patch makes all in-tree users of strnicmp call strncasecmp
directly, while still making sure that the strnicmp symbol can be used
by out-of-tree modules.  It should be considered a temporary hack until
all in-tree callers have been converted.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-10-14 02:18:23 +02:00
Grant Likely
11d200e95f lib: add glibc style strchrnul() variant
The strchrnul() variant helpfully returns a the end of the string
instead of a NULL if the requested character is not found. This can
simplify string parsing code since it doesn't need to expicitly check
for a NULL return. If a valid string pointer is passed in, then a valid
null terminated string will always come back out.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
2014-05-23 11:23:27 +09:00
Andy Shevchenko
b18888ab25 string: introduce helper to get base file name from given path
There are several places in the kernel that use functionality like
basename(3) with the exception: in case of '/foo/bar/' we expect to get an
empty string.  Let's do it common helper for them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: YAMANE Toshiaki <yamanetoshi@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-12-17 17:15:17 -08:00
David Howells
607ca46e97 UAPI: (Scripted) Disintegrate include/linux
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Michael Kerrisk <mtk.manpages@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Dave Jones <davej@redhat.com>
2012-10-13 10:46:48 +01:00
WANG Cong
c3a5ce0416 string: do not export memweight() to userspace
Fix the following warning:

  usr/include/linux/string.h:8: userspace cannot reference function or variable defined in the kernel

Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
Acked-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-21 16:45:03 -07:00
Akinobu Mita
639b9e34f1 string: introduce memweight()
memweight() is the function that counts the total number of bits set in
memory area.  Unlike bitmap_weight(), memweight() takes pointer and size
in bytes to specify a memory area which does not need to be aligned to
long-word boundary.

[akpm@linux-foundation.org: rename `w' to `ret']
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Anders Larsen <al@alarsen.net>
Cc: Alasdair Kergon <agk@redhat.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Tony Luck <tony.luck@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-07-30 17:25:16 -07:00
Akinobu Mita
798248206b lib/string.c: introduce memchr_inv()
memchr_inv() is mainly used to check whether the whole buffer is filled
with just a specified byte.

The function name and prototype are stolen from logfs and the
implementation is from SLUB.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Christoph Lameter <cl@linux-foundation.org>
Acked-by: Pekka Enberg <penberg@kernel.org>
Cc: Matt Mackall <mpm@selenic.com>
Acked-by: Joern Engel <joern@logfs.org>
Cc: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-31 17:30:47 -07:00
Jonathan Cameron
d0f1fed29e Add a strtobool function matching semantics of existing in kernel equivalents
This is a rename of the usr_strtobool proposal, which was a renamed,
relocated and fixed version of previous kstrtobool RFC

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-05-19 16:55:28 +09:30
Li Zefan
d5f1fb5335 lib: Introduce strnstr()
It differs strstr() in that it limits the length to be searched
in the first string.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4B4E8743.6030805@cn.fujitsu.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2010-01-14 22:38:09 -05:00
KOSAKI Motohiro
ca54cb8c9e Subject: Re: [PATCH] strstrip incorrectly marked __must_check
Recently, We marked strstrip() as must_check.  because it was frequently
misused and it should be checked.  However, we found one exception.
scsi/ipr.c intentionally ignore return value of strstrip.  Because it
wishes to keep the whitespace at the beginning.

Thus we need to keep with and without checked whitespace trim function.
This patch adds a new strim() and changes ipr.c to use it.

[akpm@linux-foundation.org: coding-style fixes]
Suggested-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-12-15 08:53:34 -08:00
André Goddard Rosa
f653398c86 string: factorize skip_spaces and export it to be generally available
On the following sentence:
    while (*s && isspace(*s))
        s++;

If *s == 0, isspace() evaluates to ((_ctype[*s] & 0x20) != 0), which
evaluates to ((0x08 & 0x20) != 0) which equals to 0 as well.
If *s == 1, we depend on isspace() result anyway. In other words,
"a char equals zero is never a space", so remove this check.

Also, *s != 0 is most common case (non-null string).

Fixed const return as noticed by Jan Engelhardt and James Bottomley.
Fixed unnecessary extra cast on strstrip() as noticed by Jan Engelhardt.

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-12-15 08:53:32 -08:00
KOSAKI Motohiro
0a1b71b400 strstrip(): mark as as must_check
strstrip() can return a modified value of its input argument, when
removing elading whitesapce.  So it is surely bug for this function's
return value to be ignored.  The caller is probably going to use the
incorrect original pointer.

So mark it __must_check to prevent this frm happening (as it has before).

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-10-29 07:39:25 -07:00
Linus Torvalds
cab4e4c43f Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-module-and-param
* git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-module-and-param:
  module: use strstarts()
  strstarts: helper function for !strncmp(str, prefix, strlen(prefix))
  arm: allow usage of string functions in linux/string.h
  module: don't use stop_machine on module load
  module: create a request_module_nowait()
  module: include other structures in module version check
  module: remove the SHF_ALLOC flag on the __versions section.
  module: clarify the force-loading taint message.
  module: Export symbols needed for Ksplice
  Ksplice: Add functions for walking kallsyms symbols
  module: remove module_text_address()
  module: __module_address
  module: Make find_symbol return a struct kernel_symbol
  kernel/module.c: fix an unused goto label
  param: fix charp parameters set via sysfs

Fix trivial conflicts in kernel/extable.c manually.
2009-04-05 10:30:21 -07:00
Linus Torvalds
e4c393fd55 Merge branch 'printk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'printk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  printk: correct the behavior of printk_timed_ratelimit()
  vsprintf: unify the format decoding layer for its 3 users, cleanup
  fix regression from "vsprintf: unify the format decoding layer for its 3 users"
  vsprintf: fix bug in negative value printing
  vsprintf: unify the format decoding layer for its 3 users
  vsprintf: add binary printf
  printk: introduce printk_once()

Fix trivial conflicts (printk_once vs log_buf_kexec_setup() added near
each other) in include/linux/kernel.h.
2009-04-05 10:23:25 -07:00
Li Zefan
610a77e04a memdup_user(): introduce
I notice there are many places doing copy_from_user() which follows
kmalloc():

        dst = kmalloc(len, GFP_KERNEL);
        if (!dst)
                return -ENOMEM;
        if (copy_from_user(dst, src, len)) {
		kfree(dst);
		return -EFAULT
	}

memdup_user() is a wrapper of the above code.  With this new function, we
don't have to write 'len' twice, which can lead to typos/mistakes.  It
also produces smaller code and kernel text.

A quick grep shows 250+ places where memdup_user() *may* be used.  I'll
prepare a patchset to do this conversion.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Americo Wang <xiyou.wangcong@gmail.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-04-01 08:59:13 -07:00
Rusty Russell
66f92cf9d4 strstarts: helper function for !strncmp(str, prefix, strlen(prefix))
Impact: minor new API

ksplice added a "starts_with" function, which seems like a common need.
When people open-code it they seem to use fixed numbers rather than strlen,
so it's quite a readability win (also, strncmp() almost always wants != 0
on it).

So here's strstarts().

Cc: Anders Kaseorg <andersk@mit.edu>
Cc: Jeff Arnold <jbarnold@mit.edu>
Cc: Tim Abbott <tabbott@mit.edu>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-03-31 13:05:36 +10:30
Lai Jiangshan
4370aa4aa7 vsprintf: add binary printf
Impact: add new APIs for binary trace printk infrastructure

vbin_printf(): write args to binary buffer, string is copied
when "%s" is occurred.

bstr_printf(): read from binary buffer for args and format a string

[fweisbec@gmail.com: rebase]

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
LKML-Reference: <1236356510-8381-2-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-03-06 17:39:04 +01:00
Jeff Garzik
4ac96572f1 linux/string.h: fix comment typo
s/user/used/

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-11-02 10:15:07 -08:00
Akinobu Mita
e108526e77 move memory_read_from_buffer() from fs.h to string.h
James Bottomley warns that inclusion of linux/fs.h in a low level
driver was always a danger signal.  This patch moves
memory_read_from_buffer() from fs.h to string.h and fixes includes in
existing memory_read_from_buffer() users.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: James Bottomley <James.Bottomley@hansenpartnership.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Bob Moore <robert.moore@intel.com>
Cc: Thomas Renninger <trenn@suse.de>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-24 10:47:13 -07:00