1073 Commits

Author SHA1 Message Date
Bruno Martins
9162135978 Merge branch 'deprecated/android-4.9-q' of https://android.googlesource.com/kernel/common into HEAD
Conflicts:
	arch/arm/Makefile
	arch/arm/include/asm/unistd.h
	arch/arm/kernel/calls.S
	arch/arm64/include/asm/assembler.h
	arch/arm64/include/asm/cputype.h
	arch/arm64/kernel/bpi.S
	arch/arm64/kernel/cpu_errata.c
	arch/arm64/kernel/setup.c
	arch/arm64/kernel/vdso.c
	arch/arm64/mm/proc.S
	arch/mips/include/uapi/asm/Kbuild
	arch/powerpc/include/uapi/asm/Kbuild
	drivers/char/Kconfig
	drivers/char/random.c
	drivers/clk/qcom/clk-rcg2.c
	drivers/gpu/drm/drm_edid.c
	drivers/irqchip/irq-gic.c
	drivers/md/dm-table.c
	drivers/media/dvb-core/dmxdev.c
	drivers/mmc/core/core.c
	drivers/mmc/core/host.c
	drivers/mmc/core/mmc.c
	drivers/mmc/host/sdhci.c
	drivers/net/usb/lan78xx.c
	drivers/scsi/ufs/ufs_quirks.h
	drivers/scsi/ufs/ufshcd.c
	drivers/staging/android/ion/ion-ioctl.c
	drivers/staging/android/ion/ion.c
	drivers/staging/android/ion/ion_priv.h
	drivers/staging/android/ion/ion_system_heap.c
	drivers/tty/tty_io.c
	drivers/usb/core/hub.c
	drivers/usb/core/usb.h
	drivers/usb/dwc3/core.c
	drivers/usb/dwc3/gadget.c
	drivers/usb/gadget/composite.c
	drivers/usb/gadget/configfs.c
	drivers/usb/gadget/function/f_accessory.c
	drivers/usb/gadget/function/rndis.c
	drivers/usb/gadget/function/rndis.h
	fs/eventpoll.c
	fs/ext4/namei.c
	fs/fat/fatent.c
	fs/gfs2/acl.c
	include/linux/random.h
	include/uapi/drm/Kbuild
	include/uapi/linux/Kbuild
	include/uapi/linux/cifs/Kbuild
	include/uapi/linux/genwqe/Kbuild
	kernel/cpu.c
	kernel/exit.c
	kernel/sched/cpufreq_schedutil.c
	lib/Makefile
	lib/string.c
	mm/memory.c
	mm/page-writeback.c
	mm/page_alloc.c
	net/ipv4/udp.c
	net/ipv6/datagram.c
	net/ipv6/ip6_output.c
	net/netfilter/nf_conntrack_irc.c
	net/netfilter/xt_quota2.c
	net/netlink/genetlink.c
	security/selinux/avc.c
	security/selinux/include/objsec.h
	sound/core/compress_offload.c

Change-Id: I41982a5a8e22a21b72ec5dfa61a3680be66213f4
2023-03-26 12:09:00 +01:00
Greg Kroah-Hartman
33296e8a81 Merge 4.9.326 into android-4.9-q
Changes in 4.9.326
	Bluetooth: L2CAP: Fix use-after-free caused by l2cap_chan_put
	ntfs: fix use-after-free in ntfs_ucsncmp()
	scsi: ufs: host: Hold reference returned by of_parse_phandle()
	net: ping6: Fix memleak in ipv6_renew_options().
	net: sungem_phy: Add of_node_put() for reference returned by of_get_parent()
	netfilter: nf_queue: do not allow packet truncation below transport header offset
	ARM: crypto: comment out gcc warning that breaks clang builds
	mt7601u: add USB device ID for some versions of XiaoDu WiFi Dongle.
	ion: Make user_ion_handle_put_nolock() a void function
	selinux: Minor cleanups
	proc: Pass file mode to proc_pid_make_inode
	selinux: Clean up initialization of isec->sclass
	selinux: Convert isec->lock into a spinlock
	selinux: fix error initialization in inode_doinit_with_dentry()
	selinux: fix inode_doinit_with_dentry() LABEL_INVALID error handling
	include/uapi/linux/swab.h: fix userspace breakage, use __BITS_PER_LONG for swap
	init/main: Fix double "the" in comment
	init/main: properly align the multi-line comment
	init: move stack canary initialization after setup_arch
	init/main.c: extract early boot entropy from the passed cmdline
	ACPI: video: Force backlight native for some TongFang devices
	ACPI: video: Shortening quirk list by identifying Clevo by board_name only
	random: only call boot_init_stack_canary() once
	macintosh/adb: fix oob read in do_adb_query() function
	ALSA: bcd2000: Fix a UAF bug on the error path of probing
	add barriers to buffer_uptodate and set_buffer_uptodate
	KVM: SVM: Don't BUG if userspace injects an interrupt with GIF=0
	KVM: x86: Mark TSS busy during LTR emulation _after_ all fault checks
	ALSA: hda/conexant: Add quirk for LENOVO 20149 Notebook model
	ALSA: hda/cirrus - support for iMac 12,1 model
	vfs: Check the truncate maximum size in inode_newsize_ok()
	usbnet: Fix linkwatch use-after-free on disconnect
	parisc: Fix device names in /proc/iomem
	drm/nouveau: fix another off-by-one in nvbios_addr
	bpf: fix overflow in prog accounting
	fuse: limit nsec
	md-raid10: fix KASAN warning
	ia64, processor: fix -Wincompatible-pointer-types in ia64_get_irr()
	PCI: Add defines for normal and subtractive PCI bridges
	powerpc/fsl-pci: Fix Class Code of PCIe Root Port
	powerpc/powernv: Avoid crashing if rng is NULL
	MIPS: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK
	USB: HCD: Fix URB giveback issue in tasklet function
	netfilter: nf_tables: fix null deref due to zeroed list head
	scsi: zfcp: Fix missing auto port scan and thus missing target ports
	x86/olpc: fix 'logical not is only applied to the left hand side'
	spmi: trace: fix stack-out-of-bound access in SPMI tracing functions
	ext4: add EXT4_INODE_HAS_XATTR_SPACE macro in xattr.h
	ext4: make sure ext4_append() always allocates new block
	ext4: fix use-after-free in ext4_xattr_set_entry
	ext4: update s_overhead_clusters in the superblock during an on-line resize
	ext4: fix extent status tree race in writeback error recovery path
	ext4: correct max_inline_xattr_value_size computing
	dm raid: fix address sanitizer warning in raid_status
	net_sched: cls_route: remove from list when handle is 0
	btrfs: reject log replay if there is unsupported RO compat flag
	tcp: fix over estimation in sk_forced_mem_schedule()
	scsi: sg: Allow waiting for commands to complete on removed device
	Revert "net: usb: ax88179_178a needs FLAG_SEND_ZLP"
	Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm regression
	nios2: time: Read timer in get_cycles only if initialized
	net/9p: Initialize the iounit field during fid creation
	net_sched: cls_route: disallow handle of 0
	ALSA: info: Fix llseek return value when using callback
	rds: add missing barrier to release_refill
	ata: libata-eh: Add missing command name
	btrfs: fix lost error handling when looking up extended ref on log replay
	can: ems_usb: fix clang's -Wunaligned-access warning
	NFSv4.1: RECLAIM_COMPLETE must handle EACCES
	SUNRPC: Reinitialise the backchannel request buffers before reuse
	pinctrl: nomadik: Fix refcount leak in nmk_pinctrl_dt_subnode_to_map
	pinctrl: qcom: msm8916: Allow CAMSS GP clocks to be muxed
	vsock: Fix memory leak in vsock_connect()
	xen/xenbus: fix return type in xenbus_file_read()
	atm: idt77252: fix use-after-free bugs caused by tst_timer
	nios2: page fault et.al. are *not* restartable syscalls...
	nios2: don't leave NULLs in sys_call_table[]
	nios2: traced syscall does need to check the syscall number
	nios2: fix syscall restart checks
	nios2: restarts apply only to the first sigframe we build...
	nios2: add force_successful_syscall_return()
	netfilter: nf_tables: really skip inactive sets when allocating name
	fec: Fix timer capture timing in `fec_ptp_enable_pps()`
	irqchip/tegra: Fix overflow implicit truncation warnings
	usb: host: ohci-ppc-of: Fix refcount leak bug
	gadgetfs: ep_io - wait until IRQ finishes
	cxl: Fix a memory leak in an error handling path
	drivers:md:fix a potential use-after-free bug
	ext4: avoid remove directory when directory is corrupted
	ext4: avoid resizing to a partial cluster size
	tty: serial: Fix refcount leak bug in ucc_uart.c
	vfio: Clear the caps->buf to NULL after free
	mips: cavium-octeon: Fix missing of_node_put() in octeon2_usb_clocks_start
	ALSA: core: Add async signal helpers
	ALSA: timer: Use deferred fasync helper
	powerpc/64: Init jump labels before parse_early_param()
	video: fbdev: i740fb: Check the argument of i740_calc_vclk()
	MIPS: tlbex: Explicitly compare _PAGE_NO_EXEC against 0
	Linux 4.9.326

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I3ca17af58cd0c61bd81028c496849592cfd22f0f
2022-08-25 12:09:51 +02:00
Weitao Wang
77057007fe USB: HCD: Fix URB giveback issue in tasklet function
commit 26c6c2f8a907c9e3a2f24990552a4d77235791e6 upstream.

Usb core introduce the mechanism of giveback of URB in tasklet context to
reduce hardware interrupt handling time. On some test situation(such as
FIO with 4KB block size), when tasklet callback function called to
giveback URB, interrupt handler add URB node to the bh->head list also.
If check bh->head list again after finish all URB giveback of local_list,
then it may introduce a "dynamic balance" between giveback URB and add URB
to bh->head list. This tasklet callback function may not exit for a long
time, which will cause other tasklet function calls to be delayed. Some
real-time applications(such as KB and Mouse) will see noticeable lag.

In order to prevent the tasklet function from occupying the cpu for a long
time at a time, new URBS will not be added to the local_list even though
the bh->head list is not empty. But also need to ensure the left URB
giveback to be processed in time, so add a member high_prio for structure
giveback_urb_bh to prioritize tasklet and schelule this tasklet again if
bh->head list is not empty.

At the same time, we are able to prioritize tasklet through structure
member high_prio. So, replace the local high_prio_bh variable with this
structure member in usb_hcd_giveback_urb.

Fixes: 94dfd7edfd ("USB: HCD: support giveback of URB in tasklet context")
Cc: stable <stable@kernel.org>
Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Weitao Wang <WeitaoWang-oc@zhaoxin.com>
Link: https://lore.kernel.org/r/20220726074918.5114-1-WeitaoWang-oc@zhaoxin.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-25 11:09:25 +02:00
Bruno Martins
dbcc8fefd9 treewide: Import Samsung changes from T725XXU2DUD1
Change-Id: I5c31dc4a8006a967910963fb9e7d1a0ab4ab9731
2022-02-23 22:14:25 +01:00
Greg Kroah-Hartman
86cb772013 Merge 4.9.280 into android-4.9-q
Changes in 4.9.280
	ALSA: seq: Fix racy deletion of subscriber
	scsi: sr: Return correct event when media event code is 3
	media: videobuf2-core: dequeue if start_streaming fails
	net: natsemi: Fix missing pci_disable_device() in probe and remove
	mips: Fix non-POSIX regexp
	bnx2x: fix an error code in bnx2x_nic_load()
	net: pegasus: fix uninit-value in get_interrupt_interval
	net: fec: fix use-after-free in fec_drv_remove
	net: vxge: fix use-after-free in vxge_device_unregister
	Bluetooth: defer cleanup of resources in hci_unregister_dev()
	USB: usbtmc: Fix RCU stall warning
	USB: serial: option: add Telit FD980 composition 0x1056
	USB: serial: ch341: fix character loss at high transfer rates
	USB: serial: ftdi_sio: add device ID for Auto-M3 OP-COM v2
	usb: otg-fsm: Fix hrtimer list corruption
	scripts/tracing: fix the bug that can't parse raw_trace_func
	media: rtl28xxu: fix zero-length control request
	pipe: increase minimum default pipe size to 2 pages
	serial: 8250: Mask out floating 16/32-bit bus bits
	MIPS: Malta: Do not byte-swap accesses to the CBUS UART
	pcmcia: i82092: fix a null pointer dereference bug
	perf/x86/amd: Don't touch the AMD64_EVENTSEL_HOSTONLY bit inside the guest
	reiserfs: add check for root_inode in reiserfs_fill_super
	reiserfs: check directory items on read from disk
	alpha: Send stop IPI to send to online CPUs
	net/qla3xxx: fix schedule while atomic in ql_wait_for_drvr_lock and ql_adapter_reset
	USB:ehci:fix Kunpeng920 ehci hardware problem
	ppp: Fix generating ppp unit id when ifname is not specified
	net: xilinx_emaclite: Do not print real IOMEM pointer
	ovl: prevent private clone if bind mount is not allowed
	Linux 4.9.280

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I9ec4951d64f625a7bd15aec0fae6c294e3ec0897
2021-08-15 13:09:22 +02:00
Dmitry Osipenko
22b3cc0f63 usb: otg-fsm: Fix hrtimer list corruption
commit bf88fef0b6f1488abeca594d377991171c00e52a upstream.

The HNP work can be re-scheduled while it's still in-fly. This results in
re-initialization of the busy work, resetting the hrtimer's list node of
the work and crashing kernel with null dereference within kernel/timer
once work's timer is expired. It's very easy to trigger this problem by
re-plugging USB cable quickly. Initialize HNP work only once to fix this
trouble.

 Unable to handle kernel NULL pointer dereference at virtual address 00000126)
 ...
 PC is at __run_timers.part.0+0x150/0x228
 LR is at __next_timer_interrupt+0x51/0x9c
 ...
 (__run_timers.part.0) from [<c0187a2b>] (run_timer_softirq+0x2f/0x50)
 (run_timer_softirq) from [<c01013ad>] (__do_softirq+0xd5/0x2f0)
 (__do_softirq) from [<c012589b>] (irq_exit+0xab/0xb8)
 (irq_exit) from [<c0170341>] (handle_domain_irq+0x45/0x60)
 (handle_domain_irq) from [<c04c4a43>] (gic_handle_irq+0x6b/0x7c)
 (gic_handle_irq) from [<c0100b65>] (__irq_svc+0x65/0xac)

Cc: stable@vger.kernel.org
Acked-by: Peter Chen <peter.chen@kernel.org>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20210717182134.30262-6-digetx@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-15 13:01:03 +02:00
Greg Kroah-Hartman
6c5d14c2ed Merge 4.9.272 into android-4.9-q
Changes in 4.9.272
	net: usb: cdc_ncm: don't spew notifications
	efi: Allow EFI_MEMORY_XP and EFI_MEMORY_RO both to be cleared
	efi: cper: fix snprintf() use in cper_dimm_err_location()
	vfio/pci: Fix error return code in vfio_ecap_init()
	vfio/pci: zap_vma_ptes() needs MMU
	vfio/platform: fix module_put call in error flow
	ipvs: ignore IP_VS_SVC_F_HASHED flag when adding service
	HID: pidff: fix error return code in hid_pidff_init()
	HID: i2c-hid: fix format string mismatch
	netfilter: nfnetlink_cthelper: hit EBUSY on updates if size mismatches
	ieee802154: fix error return code in ieee802154_add_iface()
	ieee802154: fix error return code in ieee802154_llsec_getparams()
	Bluetooth: fix the erroneous flush_work() order
	Bluetooth: use correct lock to prevent UAF of hdev object
	net: caif: added cfserl_release function
	net: caif: add proper error handling
	net: caif: fix memory leak in caif_device_notify
	net: caif: fix memory leak in cfusbl_device_notify
	ALSA: timer: Fix master timer notification
	ext4: fix bug on in ext4_es_cache_extent as ext4_split_extent_at failed
	pid: take a reference when initializing `cad_pid`
	ocfs2: fix data corruption by fallocate
	nfc: fix NULL ptr dereference in llcp_sock_getname() after failed connect
	btrfs: fix error handling in btrfs_del_csums
	btrfs: fixup error handling in fixup_inode_link_counts
	bnxt_en: Remove the setting of dev_port.
	KVM: SVM: Truncate GPR value for DR and CR accesses in !64-bit mode
	arm64: Remove unimplemented syscall log message
	xen-pciback: redo VF placement in the virtual topology
	Linux 4.9.272

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Iaf3c73a2aedcc4749540fd03d820756200b26a90
2021-06-10 13:43:23 +02:00
Grant Grundler
7246d9cfe1 net: usb: cdc_ncm: don't spew notifications
[ Upstream commit de658a195ee23ca6aaffe197d1d2ea040beea0a2 ]

RTL8156 sends notifications about every 32ms.
Only display/log notifications when something changes.

This issue has been reported by others:
	https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1832472
	https://lkml.org/lkml/2020/8/27/1083

...
[785962.779840] usb 1-1: new high-speed USB device number 5 using xhci_hcd
[785962.929944] usb 1-1: New USB device found, idVendor=0bda, idProduct=8156, bcdDevice=30.00
[785962.929949] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=6
[785962.929952] usb 1-1: Product: USB 10/100/1G/2.5G LAN
[785962.929954] usb 1-1: Manufacturer: Realtek
[785962.929956] usb 1-1: SerialNumber: 000000001
[785962.991755] usbcore: registered new interface driver cdc_ether
[785963.017068] cdc_ncm 1-1:2.0: MAC-Address: 00:24:27:88:08:15
[785963.017072] cdc_ncm 1-1:2.0: setting rx_max = 16384
[785963.017169] cdc_ncm 1-1:2.0: setting tx_max = 16384
[785963.017682] cdc_ncm 1-1:2.0 usb0: register 'cdc_ncm' at usb-0000:00:14.0-1, CDC NCM, 00:24:27:88:08:15
[785963.019211] usbcore: registered new interface driver cdc_ncm
[785963.023856] usbcore: registered new interface driver cdc_wdm
[785963.025461] usbcore: registered new interface driver cdc_mbim
[785963.038824] cdc_ncm 1-1:2.0 enx002427880815: renamed from usb0
[785963.089586] cdc_ncm 1-1:2.0 enx002427880815: network connection: disconnected
[785963.121673] cdc_ncm 1-1:2.0 enx002427880815: network connection: disconnected
[785963.153682] cdc_ncm 1-1:2.0 enx002427880815: network connection: disconnected
...

This is about 2KB per second and will overwrite all contents of a 1MB
dmesg buffer in under 10 minutes rendering them useless for debugging
many kernel problems.

This is also an extra 180 MB/day in /var/logs (or 1GB per week) rendering
the majority of those logs useless too.

When the link is up (expected state), spew amount is >2x higher:
...
[786139.600992] cdc_ncm 2-1:2.0 enx002427880815: network connection: connected
[786139.632997] cdc_ncm 2-1:2.0 enx002427880815: 2500 mbit/s downlink 2500 mbit/s uplink
[786139.665097] cdc_ncm 2-1:2.0 enx002427880815: network connection: connected
[786139.697100] cdc_ncm 2-1:2.0 enx002427880815: 2500 mbit/s downlink 2500 mbit/s uplink
[786139.729094] cdc_ncm 2-1:2.0 enx002427880815: network connection: connected
[786139.761108] cdc_ncm 2-1:2.0 enx002427880815: 2500 mbit/s downlink 2500 mbit/s uplink
...

Chrome OS cannot support RTL8156 until this is fixed.

Signed-off-by: Grant Grundler <grundler@chromium.org>
Reviewed-by: Hayes Wang <hayeswang@realtek.com>
Link: https://lore.kernel.org/r/20210120011208.3768105-1-grundler@chromium.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-06-10 12:42:35 +02:00
Udipto Goswami
9c63b66111 phy-msm-usb: Add mutex for protecting msm_otg_reset
While booting up with charger connected, there is a chance
that msm_otg_reset getting called two times from two paths,
one from apsd re-run and another as part of udc_bind. This
could create a race condition leading to clocks being not
enabled while accessing registers causing to NOC error.

Fix this by introducing mutex lock in msm_otg_reset for
protecting both the thread's execution.

Change-Id: Ie20eded91bbe37f1ed672b7b926f6e5f31fb0235
Signed-off-by: Udipto Goswami <ugoswami@codeaurora.org>
2020-12-27 23:34:08 -08:00
Greg Kroah-Hartman
f1eb1c3b80 Merge 4.9.247 into android-4.9-q
Changes in 4.9.247
	perf event: Check ref_reloc_sym before using it
	mm/userfaultfd: do not access vma->vm_mm after calling handle_userfault()
	btrfs: fix lockdep splat when reading qgroup config on mount
	PCI: Add device even if driver attach failed
	btrfs: tree-checker: Enhance chunk checker to validate chunk profile
	btrfs: inode: Verify inode mode to avoid NULL pointer dereference
	arm64: pgtable: Fix pte_accessible()
	ALSA: hda/hdmi: Use single mutex unlock in error paths
	ALSA: hda/hdmi: fix incorrect locking in hdmi_pcm_close
	HID: cypress: Support Varmilo Keyboards' media hotkeys
	Input: i8042 - allow insmod to succeed on devices without an i8042 controller
	HID: hid-sensor-hub: Fix issue with devices with no report ID
	dmaengine: xilinx_dma: use readl_poll_timeout_atomic variant
	x86/xen: don't unbind uninitialized lock_kicker_irq
	proc: don't allow async path resolution of /proc/self components
	dmaengine: pl330: _prep_dma_memcpy: Fix wrong burst size
	scsi: libiscsi: Fix NOP race condition
	scsi: target: iscsi: Fix cmd abort fabric stop race
	perf/x86: fix sysfs type mismatches
	phy: tegra: xusb: Fix dangling pointer on probe failure
	batman-adv: set .owner to THIS_MODULE
	scsi: ufs: Fix race between shutdown and runtime resume flow
	bnxt_en: fix error return code in bnxt_init_board()
	video: hyperv_fb: Fix the cache type when mapping the VRAM
	bnxt_en: Release PCI regions when DMA mask setup fails during probe.
	IB/mthca: fix return value of error branch in mthca_init_cq()
	nfc: s3fwrn5: use signed integer for parsing GPIO numbers
	net: ena: set initial DMA width to avoid intel iommu issue
	ibmvnic: fix NULL pointer dereference in ibmvic_reset_crq
	efivarfs: revert "fix memory leak in efivarfs_create()"
	can: gs_usb: fix endianess problem with candleLight firmware
	platform/x86: toshiba_acpi: Fix the wrong variable assignment
	perf probe: Fix to die_entrypc() returns error correctly
	USB: core: Change %pK for __user pointers to %px
	usb: gadget: f_midi: Fix memleak in f_midi_alloc
	usb: gadget: Fix memleak in gadgetfs_fill_super
	x86/speculation: Fix prctl() when spectre_v2_user={seccomp,prctl},ibpb
	regulator: avoid resolve_supply() infinite recursion
	regulator: workaround self-referent regulators
	USB: core: add endpoint-blacklist quirk
	USB: core: Fix regression in Hercules audio card
	Linux 4.9.247

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I077a342073700f16f0d902b10597b7a3ded56914
2020-12-02 09:15:04 +01:00
Johan Hovold
c795e16801 USB: core: add endpoint-blacklist quirk
commit 73f8bda9b5dc1c69df2bc55c0cbb24461a6391a9 upstream

Add a new device quirk that can be used to blacklist endpoints.

Since commit 3e4f8e21c4f2 ("USB: core: fix check for duplicate
endpoints") USB core ignores any duplicate endpoints found during
descriptor parsing.

In order to handle devices where the first interfaces with duplicate
endpoints are the ones that should have their endpoints ignored, we need
to add a blacklist.

Tested-by: edes <edes@gmx.net>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20200203153830.26394-2-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[sudip: adjust context]
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-12-02 08:31:29 +01:00
Greg Kroah-Hartman
6e60c655f9 Merge 4.9.229 into android-4.9-q
Changes in 4.9.229
	power: supply: bq24257_charger: Replace depends on REGMAP_I2C with select
	clk: sunxi: Fix incorrect usage of round_down()
	i2c: piix4: Detect secondary SMBus controller on AMD AM4 chipsets
	iio: pressure: bmp280: Tolerate IRQ before registering
	clk: qcom: msm8916: Fix the address location of pll->config_reg
	backlight: lp855x: Ensure regulators are disabled on probe failure
	ARM: integrator: Add some Kconfig selections
	ALSA: isa/wavefront: prevent out of bounds write in ioctl
	scsi: qla2xxx: Fix issue with adapter's stopping state
	iio: bmp280: fix compensation of humidity
	i2c: pxa: clear all master action bits in i2c_pxa_stop_message()
	usblp: poison URBs upon disconnect
	PCI: aardvark: Don't blindly enable ASPM L0s and don't write to read-only register
	ps3disk: use the default segment boundary
	vfio/pci: fix memory leaks in alloc_perm_bits()
	mfd: wm8994: Fix driver operation if loaded as modules
	scsi: lpfc: Fix lpfc_nodelist leak when processing unsolicited event
	clk: clk-flexgen: fix clock-critical handling
	powerpc/perf/hv-24x7: Fix inconsistent output values incase multiple hv-24x7 events run
	nfsd: Fix svc_xprt refcnt leak when setup callback client failed
	powerpc/crashkernel: Take "mem=" option into account
	yam: fix possible memory leak in yam_init_driver
	mksysmap: Fix the mismatch of '.L' symbols in System.map
	scsi: sr: Fix sr_probe() missing deallocate of device minor
	scsi: ibmvscsi: Don't send host info in adapter info MAD after LPM
	ALSA: usb-audio: Improve frames size computation
	s390/qdio: put thinint indicator after early error
	tty: hvc: Fix data abort due to race in hvc_open
	staging: sm750fb: add missing case while setting FB_VISUAL
	i2c: pxa: fix i2c_pxa_scream_blue_murder() debug output
	serial: amba-pl011: Make sure we initialize the port.lock spinlock
	drivers: base: Fix NULL pointer exception in __platform_driver_probe() if a driver developer is foolish
	PCI: rcar: Fix incorrect programming of OB windows
	PCI/ASPM: Allow ASPM on links to PCIe-to-PCI/PCI-X Bridges
	power: supply: lp8788: Fix an error handling path in 'lp8788_charger_probe()'
	power: supply: smb347-charger: IRQSTAT_D is volatile
	scsi: mpt3sas: Fix double free warnings
	dlm: remove BUG() before panic()
	clk: ti: composite: fix memory leak
	tty: n_gsm: Fix SOF skipping
	tty: n_gsm: Fix waking up upper tty layer when room available
	powerpc/pseries/ras: Fix FWNMI_VALID off by one
	powerpc/ps3: Fix kexec shutdown hang
	vfio-pci: Mask cap zero
	usb/ohci-platform: Fix a warning when hibernating
	drm/msm/mdp5: Fix mdp5_init error path for failed mdp5_kms allocation
	USB: host: ehci-mxc: Add error handling in ehci_mxc_drv_probe()
	tty: n_gsm: Fix bogus i++ in gsm_data_kick
	clk: samsung: exynos5433: Add IGNORE_UNUSED flag to sclk_i2s1
	powerpc/64s/pgtable: fix an undefined behaviour
	PCI/PTM: Inherit Switch Downstream Port PTM settings from Upstream Port
	IB/cma: Fix ports memory leak in cma_configfs
	watchdog: da9062: No need to ping manually before setting timeout
	usb: dwc2: gadget: move gadget resume after the core is in L0 state
	USB: gadget: udc: s3c2410_udc: Remove pointless NULL check in s3c2410_udc_nuke
	usb: gadget: lpc32xx_udc: don't dereference ep pointer before null check
	usb: gadget: fix potential double-free in m66592_probe.
	usb: gadget: Fix issue with config_ep_by_speed function
	clk: bcm2835: Fix return type of bcm2835_register_gate
	net: sunrpc: Fix off-by-one issues in 'rpc_ntop6'
	NFSv4.1 fix rpc_call_done assignment for BIND_CONN_TO_SESSION
	extcon: adc-jack: Fix an error handling path in 'adc_jack_probe()'
	ASoC: fsl_asrc_dma: Fix dma_chan leak when config DMA channel failed
	openrisc: Fix issue with argument clobbering for clone/fork
	gfs2: Allow lock_nolock mount to specify jid=X
	scsi: iscsi: Fix reference count leak in iscsi_boot_create_kobj
	pinctrl: imxl: Fix an error handling path in 'imx1_pinctrl_core_probe()'
	crypto: omap-sham - add proper load balancing support for multicore
	lib/zlib: remove outdated and incorrect pre-increment optimization
	include/linux/bitops.h: avoid clang shift-count-overflow warnings
	elfnote: mark all .note sections SHF_ALLOC
	selftests/vm/pkeys: fix alloc_random_pkey() to make it really random
	selftests/net: in timestamping, strncpy needs to preserve null byte
	scsi: acornscsi: Fix an error handling path in acornscsi_probe()
	usb/xhci-plat: Set PM runtime as active on resume
	usb/ehci-platform: Set PM runtime as active on resume
	perf report: Fix NULL pointer dereference in hists__fprintf_nr_sample_events()
	bcache: fix potential deadlock problem in btree_gc_coalesce
	block: Fix use-after-free in blkdev_get()
	libata: Use per port sync for detach
	drm: encoder_slave: fix refcouting error for modules
	drm/dp_mst: Reformat drm_dp_check_act_status() a bit
	drm/qxl: Use correct notify port address when creating cursor ring
	selinux: fix double free
	ext4: fix partial cluster initialization when splitting extent
	drm/dp_mst: Increase ACT retry timeout to 3s
	x86/boot/compressed: Relax sed symbol type regex for LLVM ld.lld
	block: nr_sects_write(): Disable preemption on seqcount write
	s390: fix syscall_get_error for compat processes
	drm/i915: Whitelist context-local timestamp in the gen9 cmdparser
	crypto: algboss - don't wait during notifier callback
	kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex
	powerpc/kprobes: Fixes for kprobe_lookup_name() on BE
	x86/kprobes: Avoid kretprobe recursion bug
	kretprobe: Prevent triggering kretprobe from within kprobe_flush_task
	e1000e: Do not wake up the system via WOL if device wakeup is disabled
	sched/rt, net: Use CONFIG_PREEMPTION.patch
	net: core: device_rename: Use rwsem instead of a seqcount
	media: dvb_frontend: initialize variable s with FE_NONE instead of 0
	media: dvb/frontend.h: move out a private internal structure
	media: dvb/frontend.h: document the uAPI file
	media: dvb_frontend: get rid of get_property() callback
	media: stv0288: get rid of set_property boilerplate
	media: stv6110: get rid of a srate dead code
	media: friio-fe: get rid of set_property()
	media: dvb_frontend: get rid of set_property() callback
	media: dvb_frontend: cleanup dvb_frontend_ioctl_properties()
	media: dvb_frontend: cleanup ioctl handling logic
	media: dvb_frontend: get rid of property cache's state
	media: dvb_frontend: better document the -EPERM condition
	media: dvb_frontend: fix return values for FE_SET_PROPERTY
	media: dvb_frontend: dtv_property_process_set() cleanups
	media: dvb_frontend: be sure to init dvb_frontend_handle_ioctl() return code
	media: dvb_frontend: Add unlocked_ioctl in dvb_frontend.c
	media: dvb_frontend: Add compat_ioctl callback
	media: dvb_frontend: Add commands implementation for compat ioct
	media: dvb_frontend: fix wrong cast in compat_ioctl
	media: dvb_frontend: fix return error code
	mtd: rawnand: Pass a nand_chip object to nand_release()
	mtd: rawnand: diskonchip: Fix the probe error path
	mtd: rawnand: sharpsl: Fix the probe error path
	mtd: rawnand: xway: Fix the probe error path
	mtd: rawnand: orion: Fix the probe error path
	mtd: rawnand: socrates: Fix the probe error path
	mtd: rawnand: plat_nand: Fix the probe error path
	mtd: rawnand: mtk: Fix the probe error path
	mtd: rawnand: tmio: Fix the probe error path
	scsi: scsi_devinfo: handle non-terminated strings
	l2tp: Allow duplicate session creation with UDP
	net: sched: export __netdev_watchdog_up()
	fix a braino in "sparc32: fix register window handling in genregs32_[gs]et()"
	mld: fix memory leak in ipv6_mc_destroy_dev()
	net: fix memleak in register_netdevice()
	net: usb: ax88179_178a: fix packet alignment padding
	rocker: fix incorrect error handling in dma_rings_init
	rxrpc: Fix notification call on completion of discarded calls
	tg3: driver sleeps indefinitely when EEH errors exceed eeh_max_freezes
	ip_tunnel: fix use-after-free in ip_tunnel_lookup()
	tcp_cubic: fix spurious HYSTART_DELAY exit upon drop in min RTT
	ip6_gre: fix use-after-free in ip6gre_tunnel_lookup()
	tcp: grow window for OOO packets only for SACK flows
	sctp: Don't advertise IPv4 addresses if ipv6only is set on the socket
	net: Fix the arp error in some cases
	net: Do not clear the sock TX queue in sk_set_socket()
	net: core: reduce recursion limit value
	USB: ohci-sm501: Add missed iounmap() in remove
	usb: dwc2: Postponed gadget registration to the udc class driver
	usb: add USB_QUIRK_DELAY_INIT for Logitech C922
	USB: ehci: reopen solution for Synopsys HC bug
	usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()
	ALSA: usb-audio: add quirk for Denon DCD-1500RE
	xhci: Fix incorrect EP_STATE_MASK
	xhci: Fix enumeration issue when setting max packet size for FS devices.
	cdc-acm: Add DISABLE_ECHO quirk for Microchip/SMSC chip
	ALSA: usb-audio: uac1: Invalidate ctl on interrupt
	ALSA: usb-audio: Clean up mixer element list traverse
	ALSA: usb-audio: Fix OOB access of mixer element list
	xhci: Poll for U0 after disabling USB2 LPM
	cifs/smb3: Fix data inconsistent when punch hole
	cifs/smb3: Fix data inconsistent when zero file range
	efi/esrt: Fix reference count leak in esre_create_sysfs_entry.
	RDMA/mad: Fix possible memory leak in ib_mad_post_receive_mads()
	net: qed: fix left elements count calculation
	net: qed: fix NVMe login fails over VFs
	net: qed: fix excessive QM ILT lines consumption
	ARM: imx5: add missing put_device() call in imx_suspend_alloc_ocram()
	usb: gadget: udc: Potential Oops in error handling code
	netfilter: ipset: fix unaligned atomic access
	sched/core: Fix PI boosting between RT and DEADLINE tasks
	ata/libata: Fix usage of page address by page_address in ata_scsi_mode_select_xlat function
	net: alx: fix race condition in alx_remove
	s390/ptrace: fix setting syscall number
	kbuild: improve cc-option to clean up all temporary files
	blktrace: break out of blktrace setup on concurrent calls
	ALSA: hda: Add NVIDIA codec IDs 9a & 9d through a0 to patch table
	ACPI: sysfs: Fix pm_profile_attr type
	KVM: X86: Fix MSR range of APIC registers in X2APIC mode
	mm/slab: use memzero_explicit() in kzfree()
	ocfs2: load global_inode_alloc
	ocfs2: fix value of OCFS2_INVALID_SLOT
	ocfs2: fix panic on nfs server over ocfs2
	arm64: perf: Report the PC value in REGS_ABI_32 mode
	tracing: Fix event trigger to accept redundant spaces
	drm/radeon: fix fb_div check in ni_init_smc_spll_table()
	sunrpc: fixed rollback in rpc_gssd_dummy_populate()
	SUNRPC: Properly set the @subbuf parameter of xdr_buf_subsegment()
	pNFS/flexfiles: Fix list corruption if the mirror count changes
	NFSv4 fix CLOSE not waiting for direct IO compeletion
	xfs: add agf freeblocks verify in xfs_agf_verify
	Revert "tty: hvc: Fix data abort due to race in hvc_open"
	Linux 4.9.229

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I0ce84c8f4c2c437fee36399c358c3dcc19fdfc1d
2020-07-01 10:50:22 +02:00
Pawel Laszczak
b4a4925ab8 usb: gadget: Fix issue with config_ep_by_speed function
[ Upstream commit 5d363120aa548ba52d58907a295eee25f8207ed2 ]

This patch adds new config_ep_by_speed_and_alt function which
extends the config_ep_by_speed about alt parameter.
This additional parameter allows to find proper usb_ss_ep_comp_descriptor.

Problem has appeared during testing f_tcm (BOT/UAS) driver function.

f_tcm function for SS use array of headers for both  BOT/UAS alternate
setting:

static struct usb_descriptor_header *uasp_ss_function_desc[] = {
        (struct usb_descriptor_header *) &bot_intf_desc,
        (struct usb_descriptor_header *) &uasp_ss_bi_desc,
        (struct usb_descriptor_header *) &bot_bi_ep_comp_desc,
        (struct usb_descriptor_header *) &uasp_ss_bo_desc,
        (struct usb_descriptor_header *) &bot_bo_ep_comp_desc,

        (struct usb_descriptor_header *) &uasp_intf_desc,
        (struct usb_descriptor_header *) &uasp_ss_bi_desc,
        (struct usb_descriptor_header *) &uasp_bi_ep_comp_desc,
        (struct usb_descriptor_header *) &uasp_bi_pipe_desc,
        (struct usb_descriptor_header *) &uasp_ss_bo_desc,
        (struct usb_descriptor_header *) &uasp_bo_ep_comp_desc,
        (struct usb_descriptor_header *) &uasp_bo_pipe_desc,
        (struct usb_descriptor_header *) &uasp_ss_status_desc,
        (struct usb_descriptor_header *) &uasp_status_in_ep_comp_desc,
        (struct usb_descriptor_header *) &uasp_status_pipe_desc,
        (struct usb_descriptor_header *) &uasp_ss_cmd_desc,
        (struct usb_descriptor_header *) &uasp_cmd_comp_desc,
        (struct usb_descriptor_header *) &uasp_cmd_pipe_desc,
        NULL,
};

The first 5 descriptors are associated with BOT alternate setting,
and others are associated with UAS.

During handling UAS alternate setting f_tcm driver invokes
config_ep_by_speed and this function sets incorrect companion endpoint
descriptor in usb_ep object.

Instead setting ep->comp_desc to uasp_bi_ep_comp_desc function in this
case set ep->comp_desc to uasp_ss_bi_desc.

This is due to the fact that it searches endpoint based on endpoint
address:

        for_each_ep_desc(speed_desc, d_spd) {
                chosen_desc = (struct usb_endpoint_descriptor *)*d_spd;
                if (chosen_desc->bEndpoitAddress == _ep->address)
                        goto ep_found;
        }

And in result it uses the descriptor from BOT alternate setting
instead UAS.

Finally, it causes that controller driver during enabling endpoints
detect that just enabled endpoint for bot.

Signed-off-by: Jayshri Pawar <jpawar@cadence.com>
Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-06-30 15:38:27 -04:00
jianzhou
45ddef214c Merge android-4.9.213(cff739f) into msm-4.9
* refs/heads/tmp-cff739f:
  Linux 4.9.213
  btrfs: do not zero f_bavail if we have available space
  net: Fix skb->csum update in inet_proto_csum_replace16().
  l2t_seq_next should increase position index
  seq_tab_next() should increase position index
  net/sonic: Quiesce SONIC before re-initializing descriptor memory
  net/sonic: Fix receive buffer handling
  net/sonic: Use MMIO accessors
  net/sonic: Add mutual exclusion for accessing shared state
  net: fsl/fman: rename IF_MODE_XGMII to IF_MODE_10G
  net/fsl: treat fsl,erratum-a011043
  powerpc/fsl/dts: add fsl,erratum-a011043
  qlcnic: Fix CPU soft lockup while collecting firmware dump
  r8152: get default setting of WOL before initializing
  airo: Add missing CAP_NET_ADMIN check in AIROOLDIOCTL/SIOCDEVPRIVATE
  airo: Fix possible info leak in AIROOLDIOCTL/SIOCDEVPRIVATE
  scsi: fnic: do not queue commands during fwreset
  vti[6]: fix packet tx through bpf_redirect()
  wireless: wext: avoid gcc -O3 warning
  mac80211: Fix TKIP replay protection immediately after key setup
  wireless: fix enabling channel 12 for custom regulatory domain
  ixgbe: Fix calculation of queue with VFs and flow director on interface flap
  ixgbevf: Remove limit of 10 entries for unicast filter list
  clk: mmp2: Fix the order of timer mux parents
  mac80211: mesh: restrict airtime metric to peered established plinks
  soc: ti: wkup_m3_ipc: Fix race condition with rproc_boot
  ARM: dts: beagle-x15-common: Model 5V0 regulator
  media: si470x-i2c: Move free() past last use of 'radio'
  usb: dwc3: turn off VBUS when leaving host mode
  Bluetooth: Fix race condition in hci_release_sock()
  ttyprintk: fix a potential deadlock in interrupt context issue
  media: dvb-usb/dvb-usb-urb.c: initialize actlen to 0
  media: gspca: zero usb_buf
  media: af9005: uninitialized variable printked
  media: digitv: don't continue if remote control state can't be read
  reiserfs: Fix memory leak of journal device string
  mm/mempolicy.c: fix out of bounds write in mpol_parse_str()
  arm64: kbuild: remove compressed images on 'make ARCH=arm64 (dist)clean'
  tools lib: Fix builds when glibc contains strlcpy()
  iio: gyro: st_gyro: fix L3GD20H support
  iio: gyro: st_gyro: inline per-sensor data
  crypto: pcrypt - Fix user-after-free on module unload
  vfs: fix do_last() regression
  crypto: af_alg - Use bh_lock_sock in sk_destruct
  net_sched: ematch: reject invalid TCF_EM_SIMPLE
  usb-storage: Disable UAS on JMicron SATA enclosure
  atm: eni: fix uninitialized variable warning
  gpio: max77620: Add missing dependency on GPIOLIB_IRQCHIP
  net: wan: sdla: Fix cast from pointer to integer of different size
  drivers/net/b44: Change to non-atomic bit operations on pwol_mask
  watchdog: rn5t618_wdt: fix module aliases
  arc: eznps: fix allmodconfig kconfig warning
  zd1211rw: fix storage endpoint lookup
  rtl8xxxu: fix interface sanity check
  brcmfmac: fix interface sanity check
  ath9k: fix storage endpoint lookup
  serial: 8250_bcm2835aux: Fix line mismatch on driver unbind
  staging: vt6656: Fix false Tx excessive retries reporting.
  staging: vt6656: use NULLFUCTION stack on mac80211
  staging: vt6656: correct packet types for CTS protect, mode.
  staging: wlan-ng: ensure error return is actually returned
  staging: most: net: fix buffer overflow
  USB: serial: ir-usb: fix IrLAP framing
  USB: serial: ir-usb: fix link-speed handling
  USB: serial: ir-usb: add missing endpoint sanity check
  rsi_91x_usb: fix interface sanity check
  orinoco_usb: fix interface sanity check
  ALSA: pcm: Add missing copy ops check before clearing buffer
  UPSTREAM: staging: most: net: fix buffer overflow
  UPSTREAM: ALSA: pcm: Add missing copy ops check before clearing buffer

 Conflicts:
	drivers/usb/dwc3/core.c

Change-Id: Ib14af0814f4b9caed8e9f2c9610b4ba43a6c2f02
Signed-off-by: jianzhou <jianzhou@codeaurora.org>
2020-03-13 16:08:04 +08:00
Manu Gautam
9c365d447a USB: gadget: qti: Add qti_usb gadget
Configfs based gadget relies on userspace to specify configfs
attributes in order to enable USB composition. This causes USB
enumeration to not happen until userspace comes up.
However, if there is no dependency on userspace then there
is no reason to use configfs and by having an in-kernel USB
gadget we can get USB enumerated much early.

Change-Id: I5feec52ff45c82a166fab73d0d1c586254c7025f
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
2020-02-06 14:26:46 +05:30
Greg Kroah-Hartman
cff739f894 Merge 4.9.213 into android-4.9-q
Changes in 4.9.213
	ALSA: pcm: Add missing copy ops check before clearing buffer
	orinoco_usb: fix interface sanity check
	rsi_91x_usb: fix interface sanity check
	USB: serial: ir-usb: add missing endpoint sanity check
	USB: serial: ir-usb: fix link-speed handling
	USB: serial: ir-usb: fix IrLAP framing
	staging: most: net: fix buffer overflow
	staging: wlan-ng: ensure error return is actually returned
	staging: vt6656: correct packet types for CTS protect, mode.
	staging: vt6656: use NULLFUCTION stack on mac80211
	staging: vt6656: Fix false Tx excessive retries reporting.
	serial: 8250_bcm2835aux: Fix line mismatch on driver unbind
	ath9k: fix storage endpoint lookup
	brcmfmac: fix interface sanity check
	rtl8xxxu: fix interface sanity check
	zd1211rw: fix storage endpoint lookup
	arc: eznps: fix allmodconfig kconfig warning
	watchdog: rn5t618_wdt: fix module aliases
	drivers/net/b44: Change to non-atomic bit operations on pwol_mask
	net: wan: sdla: Fix cast from pointer to integer of different size
	gpio: max77620: Add missing dependency on GPIOLIB_IRQCHIP
	atm: eni: fix uninitialized variable warning
	usb-storage: Disable UAS on JMicron SATA enclosure
	net_sched: ematch: reject invalid TCF_EM_SIMPLE
	crypto: af_alg - Use bh_lock_sock in sk_destruct
	vfs: fix do_last() regression
	crypto: pcrypt - Fix user-after-free on module unload
	iio: gyro: st_gyro: inline per-sensor data
	iio: gyro: st_gyro: fix L3GD20H support
	tools lib: Fix builds when glibc contains strlcpy()
	arm64: kbuild: remove compressed images on 'make ARCH=arm64 (dist)clean'
	mm/mempolicy.c: fix out of bounds write in mpol_parse_str()
	reiserfs: Fix memory leak of journal device string
	media: digitv: don't continue if remote control state can't be read
	media: af9005: uninitialized variable printked
	media: gspca: zero usb_buf
	media: dvb-usb/dvb-usb-urb.c: initialize actlen to 0
	ttyprintk: fix a potential deadlock in interrupt context issue
	Bluetooth: Fix race condition in hci_release_sock()
	usb: dwc3: turn off VBUS when leaving host mode
	media: si470x-i2c: Move free() past last use of 'radio'
	ARM: dts: beagle-x15-common: Model 5V0 regulator
	soc: ti: wkup_m3_ipc: Fix race condition with rproc_boot
	mac80211: mesh: restrict airtime metric to peered established plinks
	clk: mmp2: Fix the order of timer mux parents
	ixgbevf: Remove limit of 10 entries for unicast filter list
	ixgbe: Fix calculation of queue with VFs and flow director on interface flap
	wireless: fix enabling channel 12 for custom regulatory domain
	mac80211: Fix TKIP replay protection immediately after key setup
	wireless: wext: avoid gcc -O3 warning
	vti[6]: fix packet tx through bpf_redirect()
	scsi: fnic: do not queue commands during fwreset
	airo: Fix possible info leak in AIROOLDIOCTL/SIOCDEVPRIVATE
	airo: Add missing CAP_NET_ADMIN check in AIROOLDIOCTL/SIOCDEVPRIVATE
	r8152: get default setting of WOL before initializing
	qlcnic: Fix CPU soft lockup while collecting firmware dump
	powerpc/fsl/dts: add fsl,erratum-a011043
	net/fsl: treat fsl,erratum-a011043
	net: fsl/fman: rename IF_MODE_XGMII to IF_MODE_10G
	net/sonic: Add mutual exclusion for accessing shared state
	net/sonic: Use MMIO accessors
	net/sonic: Fix receive buffer handling
	net/sonic: Quiesce SONIC before re-initializing descriptor memory
	seq_tab_next() should increase position index
	l2t_seq_next should increase position index
	net: Fix skb->csum update in inet_proto_csum_replace16().
	btrfs: do not zero f_bavail if we have available space
	Linux 4.9.213

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ia11340061ca1d357e98f09bf64ea5d0856e4a5b2
2020-02-05 14:06:56 +00:00
Johan Hovold
10d24acd8d USB: serial: ir-usb: fix link-speed handling
commit 17a0184ca17e288decdca8b2841531e34d49285f upstream.

Commit e0d795e4f3 ("usb: irda: cleanup on ir-usb module") added a USB
IrDA header with common defines, but mistakingly switched to using the
class-descriptor baud-rate bitmask values for the outbound header.

This broke link-speed handling for rates above 9600 baud, but a device
would also be able to operate at the default 9600 baud until a
link-speed request was issued (e.g. using the TCGETS ioctl).

Fixes: e0d795e4f3 ("usb: irda: cleanup on ir-usb module")
Cc: stable <stable@vger.kernel.org>     # 2.6.27
Cc: Felipe Balbi <balbi@kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-05 13:05:35 +00:00
Udipto Goswami
5276006ff4 usb: dwc3: Drive a pulse on DP on CDP detection
Some USB host PCs switch the downstream port mode from
CDP to SDP if the device does not pull DP up within certain
duration (~2s).
This limits the current drawn by the device to 500mA(or 900mA)
as opposed to the possible 1.5A resulting in slow charging of
the battery.
Fix this by driving a DP pulse when there is a connect
notification from PMIC and detected the charger type as CDP.

Change-Id: Ia04e3c3f2dc9ad96781d2aa91f8842b6aa8dc0da
Signed-off-by: Udipto Goswami <ugoswami@codeaurora.org>
2020-01-22 22:31:04 -08:00
Linux Build Service Account
30ba3de1b5 Merge "ARM: msm: dts: Enable sdp check timer for msm8909w" 2019-11-18 06:06:52 -08:00
Greg Kroah-Hartman
258971b8e1 Merge 4.9.202 into android-4.9-q
Changes in 4.9.202
	kvm: mmu: Don't read PDPTEs when paging is not enabled
	Bluetooth: hci_ldisc: Postpone HCI_UART_PROTO_READY bit set in hci_uart_set_proto()
	MIPS: BCM63XX: fix switch core reset on BCM6368
	usb: gadget: core: unmap request from DMA only if previously mapped
	KVM: x86: use Intel speculation bugs and features as derived in generic x86 code
	x86/msr: Add the IA32_TSX_CTRL MSR
	x86/cpu: Add a helper function x86_read_arch_cap_msr()
	x86/cpu: Add a "tsx=" cmdline option with TSX disabled by default
	x86/speculation/taa: Add mitigation for TSX Async Abort
	x86/speculation/taa: Add sysfs reporting for TSX Async Abort
	kvm/x86: Export MDS_NO=0 to guests when TSX is enabled
	x86/tsx: Add "auto" option to the tsx= cmdline parameter
	x86/speculation/taa: Add documentation for TSX Async Abort
	x86/tsx: Add config options to set tsx=on|off|auto
	x86/speculation/taa: Fix printing of TAA_MSG_SMT on IBRS_ALL CPUs
	KVM: x86: simplify ept_misconfig
	KVM: x86: extend usage of RET_MMIO_PF_* constants
	kvm: Convert kvm_lock to a mutex
	kvm: x86: Do not release the page inside mmu_set_spte()
	KVM: x86: make FNAME(fetch) and __direct_map more similar
	KVM: x86: remove now unneeded hugepage gfn adjustment
	KVM: x86: change kvm_mmu_page_get_gfn BUG_ON to WARN_ON
	KVM: x86: Add is_executable_pte()
	KVM: x86: add tracepoints around __direct_map and FNAME(fetch)
	KVM: vmx, svm: always run with EFER.NXE=1 when shadow paging is active
	x86/bugs: Add ITLB_MULTIHIT bug infrastructure
	cpu/speculation: Uninline and export CPU mitigations helpers
	kvm: mmu: ITLB_MULTIHIT mitigation
	kvm: Add helper function for creating VM worker threads
	kvm: x86: mmu: Recovery of shattered NX large pages
	Documentation: Add ITLB_MULTIHIT documentation
	Linux 4.9.202

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2019-11-16 11:05:12 +01:00
Jack Pham
6e3683ebef usb: gadget: core: unmap request from DMA only if previously mapped
commit 31fe084ffaaf8abece14f8ca28e5e3b4e2bf97b6 upstream.

In the SG case this is already handled since a non-zero
request->num_mapped_sgs is a clear indicator that dma_map_sg()
had been called. While it would be nice to do the same for the
singly mapped case by simply checking for non-zero request->dma,
it's conceivable that 0 is a valid dma_addr_t handle. Hence add
a flag 'dma_mapped' to struct usb_request and use this to
determine the need to call dma_unmap_single(). Otherwise, if a
request is not DMA mapped then the result of calling
usb_request_unmap_request() would safely be a no-op.

Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-16 10:29:37 +01:00
Vijayavardhan Vennapusa
b6cf5acd93 phy-msm-usb: Perform sdp_check for SDP charger as well
In case of wearables, there is a chance that usb pins get dirty and due to
that, USB might be out of low power mode. This could cause battery draining
faster as enumeration might fail due to dirty pins and charger ends up
stopping charging. Fix the issue by having workaround to have timer to
check whether USB enumeration happened or not. If no enumeration, treat as
disconnect & notify ETIMEDOUT to charger driver and enter low power mode.

Change-Id: I8b92f18c962a56b49ff5ac4d514b39babce1f370
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
2019-11-15 11:12:27 +05:30
Chandana Kishori Chiluveru
e92b17c343 usb: gadget: core: unmap request from DMA only if previously
mapped

In the SG case this is already handled since a non-zero
request->num_mapped_sgs is a clear indicator that dma_map_sg()
had been called. While it would be nice to do the same for the
singly mapped case by simply checking for non-zero request->dma,
it's conceivable that 0 is a valid dma_addr_t handle. Hence add
a flag 'dma_mapped' to struct usb_request and use this to
determine the need to call dma_unmap_single(). Otherwise, if a
request is not DMA mapped then the result of calling
usb_request_unmap_request() would safely be a no-op.

Change-Id: Ibb00d6df31f21522da9ebbcda3ae288cb7b189fa
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Git-commit: 31fe084ffaaf8abece14f8ca28e5e3b4e2bf97b6
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[cchiluve@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Chandana Kishori Chiluveru <cchiluve@codeaurora.org>
2019-09-16 06:44:38 -07:00
Manu Gautam
22f3f5d774 usb: dwc3-msm: Add GSI mode support for Normal USB EPs
Allow non-GSI capable or normal USB endpoint to be used
in GSI mode. In this case, USB driver receives events from
hardware and updates GSI doorbell register with completed
TRB. USB GSI hardware wrapper isn't involved for such EPs.
In order to use this feature, GSI function driver must
choose interrupter number as '0' with such endpoints,
non-zero interrupters are reserved for USB GSI wrapper use.

Change-Id: Ief51b722bbe1aa97ff806e5a3b8b1ca806671a8f
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
2019-07-15 17:20:00 +05:30
Ajay Agarwal
fcd296f13f usb: gadget: Add support for IPC driver
IPC messages are to be exchanged between device and host using
the IPC router platform driver on the device side. For this
driver to use USB as transport layer, add support for function
driver which will configure Bulk IN and OUT endpoints and expose
proper callbacks to router driver for read and write operations.

Change-Id: I350624ccd24a6c6fd4bda5ea91379fb426fae742
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
2018-11-13 17:37:37 +05:30
Linux Build Service Account
01b1ed4fc2 Merge "usb: phy-msm-ssusb-qmp: Perform USB only reset in USB+DP mode" 2018-10-11 07:01:13 -07:00
Pratham Pratap
c69aa33e8b usb: phy-msm-ssusb-qmp: Perform USB only reset in USB+DP mode
When USB3 controller stops responding to stop endpoint
command driver performs global phy reset to recover from
error state. During this USB host mode recovery is performed
and global phy reset is done but DP driver is not notified
of this reset which results in unclocked access of DP link
registers. Fix this by replacing phy global reset with USB
only reset to not affect DP PHY when USB is reset in DP+USB
concurrent mode.

Change-Id: I2acde04c99b84293644fdefdceee4bd00a964e7f
Signed-off-by: Pratham Pratap <prathampratap@codeaurora.org>
2018-10-11 14:35:20 +05:30
Manu Gautam
e89c929626 phy: msm: usb: Fix extcon vbus/id notifier_block list corruption
If driver fails to register extcon notifier from probe, it defers
same to work_queue which is invoked when extcon provider becomes
available (psy_nb is used for same). If power_supply notifier call
gets invoked back to back before extcon_register_work could
unregister psy_changed notifier, it results in driver registering
extcon notifier two times without unregister. This causes notifier_nb
list corruption where notifer_nb->next points to itself and any
extcon event later results in inifinite notifer calls causing
watchdog bite.

Change-Id: Ic7963971db198817e5643b6f3968cd8a4bc2e43c
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
2018-09-28 10:47:53 +05:30
Linux Build Service Account
5f0af9c931 Merge "USB: pd: Always set selfpowered bit after explicit contract" 2018-07-26 07:45:14 -07:00
Vijayavardhan Vennapusa
daeb5ac709 USB: pd: Always set selfpowered bit after explicit contract
USB PD spec says after PD explicit contract, device needs to
advertise as selfpowered and needs to mark bMaxPower as zero.
Otherwise USB PD compliance test 4.10.2 is failing. Fix the
failure by advertising as self powered after explicit contract
through new extcon property.

Change-Id: If3acdc06b4ac8567bb101ecfc23076af4894e776
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
2018-07-25 15:49:37 +05:30
Ajay Agarwal
7827fab397 phy: msm: usb: Add USB atomic notifier for USB psy registration
Add support for USB atomic notifier callback when power supply
framework registers any power supply. Check in the callback
function if the psy registered is USB, and then register extcon
handles for VBUS and ID notifications. This helps to remove
dependency between SMB and msm_otg probe routines.

Change-Id: I4d4d98cc45ab70fc3742142a0f18fcfc84bea790
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
2018-07-03 16:57:15 +05:30
Linux Build Service Account
98ae895379 Merge changes Ia7c70965,I881a3f8d into msm-4.9
* changes:
  Merge android-4.9.103 (70c65e4) into msm-4.9
  Merge android-4.9.102 (9c3041c) into msm-4.9
2018-06-21 05:08:12 -07:00
Chandana Kishori Chiluveru
a1dbc9e820 usb: f_gsi: Report Function Remote Wake capabilities
Add support for sending Function Wake capabilities in
response to GET_STATUS from the host. GET_STATUS addressed
to an Interface allows the device to report if it is capable
of doing a Function Remote Wake. Windows8/10 MBIM hosts request
this information before enabling Suspend in SS mode.

Change-Id: Ic0a6db57b2b46804a82847de511feb433a3dfca6
Signed-off-by: Devdutt Patnaik <dpatnaik@codeaurora.org>
Signed-off-by: Chandana Kishori Chiluveru <cchiluve@codeaurora.org>
2018-06-08 10:07:42 +05:30
Ajay Agarwal
adacc5f847 phy: msm: usb: Add charger detection support
Add support for PHY based charger detection and notify the
charger type and current to PMI.

Change-Id: I93db3f18274083ecc07c34ac64e0c07ed517f29f
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
2018-05-30 14:31:02 +05:30
Blagovest Kolenichev
79a63da9e0 Merge android-4.9.103 (70c65e4) into msm-4.9
* refs/heads/tmp-70c65e4:
  Linux 4.9.103
  rtc: tx4939: avoid unintended sign extension on a 24 bit shift
  rtc: hctosys: Ensure system time doesn't overflow time_t
  rtc: snvs: Fix usage of snvs_rtc_enable
  serial: 8250: Don't service RX FIFO if interrupts are disabled
  serial: arc_uart: Fix out-of-bounds access through DT alias
  serial: fsl_lpuart: Fix out-of-bounds access through DT alias
  serial: imx: Fix out-of-bounds access through serial port index
  serial: mxs-auart: Fix out-of-bounds access through serial port index
  serial: samsung: Fix out-of-bounds access through serial port index
  serial: xuartps: Fix out-of-bounds access through DT alias
  media: cx25821: prevent out-of-bounds read on array card
  media: vivid: fix incorrect capabilities for radio
  media: vb2: Fix videobuf2 to map correct area
  media: s3c-camif: fix out-of-bounds array access
  media: cx23885: Override 888 ImpactVCBe crystal frequency
  media: dmxdev: fix error code for invalid ioctls
  clk: samsung: exynos3250: Fix PLL rates
  clk: samsung: exynos5250: Fix PLL rates
  clk: samsung: exynos5433: Fix PLL rates
  clk: samsung: exynos5260: Fix PLL rates
  clk: samsung: exynos7: Fix PLL rates
  clk: samsung: s3c2410: Fix PLL rates
  clk: rockchip: Prevent calculating mmc phase if clock rate is zero
  media: cx23885: Set subdev host data to clk_freq pointer
  clk: tegra: Fix pll_u rate configuration
  clk: Don't show the incorrect clock phase
  clk: rockchip: Fix wrong parent for SDMMC phase clock for rk3228
  ASoC: samsung: i2s: Ensure the RCLK rate is properly determined
  ASoC: topology: create TLV data for dapm widgets
  ASoC: au1x: Fix timeout tests in au1xac97c_ac97_read()
  scsi: lpfc: Fix frequency of Release WQE CQEs
  scsi: lpfc: Fix soft lockup in lpfc worker thread during LIP testing
  scsi: lpfc: Fix issue_lip if link is disabled
  scsi: mvsas: fix wrong endianness of sgpio api
  scsi: aacraid: Insure command thread is not recursively stopped
  scsi: sd: Keep disk read-only when re-reading partition
  scsi: mpt3sas: Do not mark fw_event workqueue as WQ_MEM_RECLAIM
  scsi: qla4xxx: skip error recovery in case of register disconnect.
  scsi: aacraid: fix shutdown crash when init fails
  scsi: storvsc: Increase cmd_per_lun for higher speed devices
  scsi: qla2xxx: Avoid triggering undefined behavior in qla2x00_mbx_completion()
  scsi: mptfusion: Add bounds check in mptctl_hp_targetinfo()
  scsi: sym53c8xx_2: iterator underflow in sym_getsync()
  scsi: bnx2fc: Fix check in SCSI completion handler for timed out request
  scsi: ufs: Enable quirk to ignore sending WRITE_SAME command
  scsi: fas216: fix sense buffer initialization
  crypto: sunxi-ss - Add MODULE_ALIAS to sun4i-ss
  staging: lustre: lmv: correctly iput lmo_root
  staging: rtl8192u: return -ENOMEM on failed allocation of priv->oldaddr
  staging: lustre: fix bug in osc_enter_cache_try
  Bluetooth: btusb: Add device ID for RTL8822BE
  media: em28xx: USB bulk packet size fix
  usb: gadget: composite: fix incorrect handling of OS desc requests
  usb: gadget: udc: change comparison to bitshift when dealing with a mask
  usb: gadget: ffs: Execute copy_to_user() with USER_DS set
  usb: gadget: ffs: Let setup() return USB_GADGET_DELAYED_STATUS
  usb: dwc2: host: Fix transaction errors in host mode
  usb: dwc2: Fix interval type issue
  xhci: zero usb device slot_id member when disabling and freeing a xhci slot
  usb: dwc3: Update DWC_usb31 GTXFIFOSIZ reg fields
  usb: dwc3: Add SoftReset PHY synchonization delay
  ALSA: usb-audio: Add native DSD support for Luxman DA-06
  Bluetooth: btusb: Add USB ID 7392:a611 for Edimax EW-7611ULB
  net-usb: add qmi_wwan if on lte modem wistron neweb d18q1
  net/usb/qmi_wwan.c: Add USB id for lt4120 modem
  USB: OHCI: Fix NULL dereference in HCDs using HCD_LOCAL_MEM
  usb: cdc_acm: prevent race at write to acm while system resumes
  usb: dwc2: Fix dwc2_hsotg_core_init_disconnected()
  usb: gadget: fsl_udc_core: fix ep valid checks
  usb: gadget: core: Fix use-after-free of usb_request
  usb: dwc3: omap: don't miss events during suspend/resume
  usb: dwc3: Undo PHY init if soft reset fails
  usb: gadget: f_uac2: fix bFirstInterface in composite gadget
  x86/kexec: Avoid double free_page() upon do_kexec_load() failure
  hfsplus: stop workqueue when fill_super() failed
  cfg80211: limit wiphy names to 128 bytes
  scsi: zfcp: fix infinite iteration on ERP ready list
  scsi: sg: allocate with __GFP_ZERO in sg_build_indirect()
  scsi: libsas: defer ata device eh commands to libata
  s390: use expoline thunks in the BPF JIT
  s390: extend expoline to BC instructions
  s390: move spectre sysfs attribute code
  s390/kernel: use expoline for indirect branches
  s390/ftrace: use expoline for indirect branches
  s390/lib: use expoline for indirect branches
  s390/crc32-vx: use expoline for indirect branches
  s390: move expoline assembler macros to a header
  s390: add assembler macros for CPU alternatives
  ext2: fix a block leak
  vmxnet3: use DMA memory barriers where required
  vmxnet3: set the DMA mask before the first DMA map operation
  tcp: purge write queue in tcp_connect_init()
  sock_diag: fix use-after-free read in __sk_free
  packet: in packet_snd start writing at link layer allocation
  net: test tailroom before appending to linear skb
  net/mlx4_core: Fix error handling in mlx4_init_port_info.
  ANDROID: proc: fix undefined behavior in proc_uid_base_readdir
  x86: vdso: Fix leaky vdso linker with CC=clang.
  ANDROID: build: cuttlefish: Upgrade clang to newer version.
  ANDROID: build: cuttlefish: Upgrade clang to newer version.
  ANDROID: build: cuttlefish: Fix path to clang.

Conflicts:
	drivers/media/dvb-core/dmxdev.c
	drivers/scsi/sd.c
	drivers/scsi/ufs/ufshcd.c
	drivers/usb/dwc3/core.c
	drivers/usb/gadget/function/f_fs.c

Change-Id: Ia7c7096562c5be3d01a11a3bb5b380d2ebc5e011
Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
2018-05-29 07:49:55 -07:00
Greg Kroah-Hartman
70c65e471b Merge 4.9.103 into android-4.9
Changes in 4.9.103
	net/mlx4_core: Fix error handling in mlx4_init_port_info.
	net: test tailroom before appending to linear skb
	packet: in packet_snd start writing at link layer allocation
	sock_diag: fix use-after-free read in __sk_free
	tcp: purge write queue in tcp_connect_init()
	vmxnet3: set the DMA mask before the first DMA map operation
	vmxnet3: use DMA memory barriers where required
	ext2: fix a block leak
	s390: add assembler macros for CPU alternatives
	s390: move expoline assembler macros to a header
	s390/crc32-vx: use expoline for indirect branches
	s390/lib: use expoline for indirect branches
	s390/ftrace: use expoline for indirect branches
	s390/kernel: use expoline for indirect branches
	s390: move spectre sysfs attribute code
	s390: extend expoline to BC instructions
	s390: use expoline thunks in the BPF JIT
	scsi: libsas: defer ata device eh commands to libata
	scsi: sg: allocate with __GFP_ZERO in sg_build_indirect()
	scsi: zfcp: fix infinite iteration on ERP ready list
	cfg80211: limit wiphy names to 128 bytes
	hfsplus: stop workqueue when fill_super() failed
	x86/kexec: Avoid double free_page() upon do_kexec_load() failure
	usb: gadget: f_uac2: fix bFirstInterface in composite gadget
	usb: dwc3: Undo PHY init if soft reset fails
	usb: dwc3: omap: don't miss events during suspend/resume
	usb: gadget: core: Fix use-after-free of usb_request
	usb: gadget: fsl_udc_core: fix ep valid checks
	usb: dwc2: Fix dwc2_hsotg_core_init_disconnected()
	usb: cdc_acm: prevent race at write to acm while system resumes
	USB: OHCI: Fix NULL dereference in HCDs using HCD_LOCAL_MEM
	net/usb/qmi_wwan.c: Add USB id for lt4120 modem
	net-usb: add qmi_wwan if on lte modem wistron neweb d18q1
	Bluetooth: btusb: Add USB ID 7392:a611 for Edimax EW-7611ULB
	ALSA: usb-audio: Add native DSD support for Luxman DA-06
	usb: dwc3: Add SoftReset PHY synchonization delay
	usb: dwc3: Update DWC_usb31 GTXFIFOSIZ reg fields
	xhci: zero usb device slot_id member when disabling and freeing a xhci slot
	usb: dwc2: Fix interval type issue
	usb: dwc2: host: Fix transaction errors in host mode
	usb: gadget: ffs: Let setup() return USB_GADGET_DELAYED_STATUS
	usb: gadget: ffs: Execute copy_to_user() with USER_DS set
	usb: gadget: udc: change comparison to bitshift when dealing with a mask
	usb: gadget: composite: fix incorrect handling of OS desc requests
	media: em28xx: USB bulk packet size fix
	Bluetooth: btusb: Add device ID for RTL8822BE
	staging: lustre: fix bug in osc_enter_cache_try
	staging: rtl8192u: return -ENOMEM on failed allocation of priv->oldaddr
	staging: lustre: lmv: correctly iput lmo_root
	crypto: sunxi-ss - Add MODULE_ALIAS to sun4i-ss
	scsi: fas216: fix sense buffer initialization
	scsi: ufs: Enable quirk to ignore sending WRITE_SAME command
	scsi: bnx2fc: Fix check in SCSI completion handler for timed out request
	scsi: sym53c8xx_2: iterator underflow in sym_getsync()
	scsi: mptfusion: Add bounds check in mptctl_hp_targetinfo()
	scsi: qla2xxx: Avoid triggering undefined behavior in qla2x00_mbx_completion()
	scsi: storvsc: Increase cmd_per_lun for higher speed devices
	scsi: aacraid: fix shutdown crash when init fails
	scsi: qla4xxx: skip error recovery in case of register disconnect.
	scsi: mpt3sas: Do not mark fw_event workqueue as WQ_MEM_RECLAIM
	scsi: sd: Keep disk read-only when re-reading partition
	scsi: aacraid: Insure command thread is not recursively stopped
	scsi: mvsas: fix wrong endianness of sgpio api
	scsi: lpfc: Fix issue_lip if link is disabled
	scsi: lpfc: Fix soft lockup in lpfc worker thread during LIP testing
	scsi: lpfc: Fix frequency of Release WQE CQEs
	ASoC: au1x: Fix timeout tests in au1xac97c_ac97_read()
	ASoC: topology: create TLV data for dapm widgets
	ASoC: samsung: i2s: Ensure the RCLK rate is properly determined
	clk: rockchip: Fix wrong parent for SDMMC phase clock for rk3228
	clk: Don't show the incorrect clock phase
	clk: tegra: Fix pll_u rate configuration
	media: cx23885: Set subdev host data to clk_freq pointer
	clk: rockchip: Prevent calculating mmc phase if clock rate is zero
	clk: samsung: s3c2410: Fix PLL rates
	clk: samsung: exynos7: Fix PLL rates
	clk: samsung: exynos5260: Fix PLL rates
	clk: samsung: exynos5433: Fix PLL rates
	clk: samsung: exynos5250: Fix PLL rates
	clk: samsung: exynos3250: Fix PLL rates
	media: dmxdev: fix error code for invalid ioctls
	media: cx23885: Override 888 ImpactVCBe crystal frequency
	media: s3c-camif: fix out-of-bounds array access
	media: vb2: Fix videobuf2 to map correct area
	media: vivid: fix incorrect capabilities for radio
	media: cx25821: prevent out-of-bounds read on array card
	serial: xuartps: Fix out-of-bounds access through DT alias
	serial: samsung: Fix out-of-bounds access through serial port index
	serial: mxs-auart: Fix out-of-bounds access through serial port index
	serial: imx: Fix out-of-bounds access through serial port index
	serial: fsl_lpuart: Fix out-of-bounds access through DT alias
	serial: arc_uart: Fix out-of-bounds access through DT alias
	serial: 8250: Don't service RX FIFO if interrupts are disabled
	rtc: snvs: Fix usage of snvs_rtc_enable
	rtc: hctosys: Ensure system time doesn't overflow time_t
	rtc: tx4939: avoid unintended sign extension on a 24 bit shift
	Linux 4.9.103

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2018-05-25 17:06:35 +02:00
Chris Dickens
bf54f31e1f usb: gadget: composite: fix incorrect handling of OS desc requests
[ Upstream commit 5d6ae4f0da8a64a185074dabb1b2f8c148efa741 ]

When handling an OS descriptor request, one of the first operations is
to zero out the request buffer using the wLength from the setup packet.
There is no bounds checking, so a wLength > 4096 would clobber memory
adjacent to the request buffer. Fix this by taking the min of wLength
and the request buffer length prior to the memset. While at it, define
the buffer length in a header file so that magic numbers don't appear
throughout the code.

When returning data to the host, the data length should be the min of
the wLength and the valid data we have to return. Currently we are
returning wLength, thus requests for a wLength greater than the amount
of data in the OS descriptor buffer would return invalid (albeit zero'd)
data following the valid descriptor data. Fix this by counting the
number of bytes when constructing the data and using this when
determining the length of the request.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-25 16:13:04 +02:00
Linux Build Service Account
78667dedc6 Merge "Merge android-4.9.90 (dd1e37e) into msm-4.9" 2018-05-03 09:02:10 -07:00
Ajay Agarwal
81c28cf815 phy: msm: usb: Add support to handle floating D+/D- lines
There is a possibility of PMI detecting SDP as a floating charger
when connected to a PC. Workaround this issue by starting
peripheral stack for floating charger as well. After 10 sec check
for USB device enumeration using gadget USB state. If device is
indeed connected to SDP gadget usb state will be
USB_STATE_DEFAULT or higher.

Change-Id: I9b8f9ee0611277b2ff86a4855da783d47820cf2a
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
2018-04-21 13:33:43 +05:30
Blagovest Kolenichev
aa71c72742 Merge android-4.9.88 (bb52bba) into msm-4.9
* refs/heads/tmp-bb52bba:
  Linux 4.9.88
  PCI: dwc: Fix enumeration end when reaching root subordinate
  earlycon: add reg-offset to physical address before mapping
  serial: core: mark port as initialized in autoconfig
  serial: 8250_pci: Add Brainboxes UC-260 4 port serial device
  usb: gadget: f_fs: Fix use-after-free in ffs_fs_kill_sb()
  usb: usbmon: Read text within supplied buffer size
  usb: quirks: add control message delay for 1b1c:1b20
  usbip: vudc: fix null pointer dereference on udc->lock
  USB: storage: Add JMicron bridge 152d:2567 to unusual_devs.h
  staging: android: ashmem: Fix lockdep issue during llseek
  staging: comedi: fix comedi_nsamples_left.
  uas: fix comparison for error code
  tty/serial: atmel: add new version check for usart
  serial: sh-sci: prevent lockup on full TTY buffers
  ASoC: rt5651: Fix regcache sync errors on resume
  ASoC: sgtl5000: Fix suspend/resume
  x86: Treat R_X86_64_PLT32 as R_X86_64_PC32
  x86/module: Detect and skip invalid relocations
  NFS: Fix unstable write completion
  NFS: Fix an incorrect type in struct nfs_direct_req
  scsi: qla2xxx: Replace fcport alloc with qla2x00_alloc_fcport
  ubi: Fix race condition between ubi volume creation and udev
  ext4: inplace xattr block update fails to deduplicate blocks
  netfilter: x_tables: pack percpu counter allocations
  netfilter: x_tables: pass xt_counters struct to counter allocator
  netfilter: x_tables: pass xt_counters struct instead of packet counter
  netfilter: ipv6: fix use-after-free Write in nf_nat_ipv6_manip_pkt
  netfilter: bridge: ebt_among: add missing match size checks
  netfilter: ebtables: CONFIG_COMPAT: don't trust userland offsets
  netfilter: IDLETIMER: be syzkaller friendly
  netfilter: nat: cope with negative port range
  netfilter: x_tables: fix missing timer initialization in xt_LED
  netfilter: add back stackpointer size checks
  tc358743: fix register i2c_rd/wr function fix
  Input: tca8418_keypad - remove double read of key event register
  ARM: omap2: hide omap3_save_secure_ram on non-OMAP3 builds
  watchdog: hpwdt: Remove legacy NMI sourcing.
  watchdog: hpwdt: fix unused variable warning
  watchdog: hpwdt: Check source of NMI
  watchdog: hpwdt: SMBIOS check
  x86/paravirt, objtool: Annotate indirect calls
  x86/speculation: Move firmware_restrict_branch_speculation_*() from C to CPP
  x86/boot, objtool: Annotate indirect jump in secondary_startup_64()
  x86/speculation, objtool: Annotate indirect calls/jumps for objtool
  x86/retpoline: Support retpoline builds with Clang
  x86/speculation: Use IBRS if available before calling into firmware
  Revert "x86/retpoline: Simplify vmexit_fill_RSB()"
  nospec: Include <asm/barrier.h> dependency
  nospec: Kill array_index_nospec_mask_check()
  ALSA: hda: add dock and led support for HP ProBook 640 G2
  ALSA: hda: add dock and led support for HP EliteBook 820 G3
  ALSA: seq: More protection for concurrent write and ioctl races
  ALSA: seq: Don't allow resizing pool in use
  ALSA: hda/realtek - Make dock sound work on ThinkPad L570
  ALSA: hda/realtek - Fix dock line-out volume on Dell Precision 7520
  ALSA: hda/realtek: Limit mic boost on T480
  x86/spectre_v2: Don't check microcode versions when running under hypervisors
  perf tools: Fix trigger class trigger_on()
  x86/MCE: Serialize sysfs changes
  bcache: don't attach backing with duplicate UUID
  bcache: fix crashes in duplicate cache device register
  IB/mlx5: Fix incorrect size of klms in the memory region
  kbuild: Handle builtin dtb file names containing hyphens
  KVM: s390: fix memory overwrites when not using SCA entries
  virtio_ring: fix num_free handling in error case
  loop: Fix lost writes caused by missing flag
  Input: matrix_keypad - fix race when disabling interrupts
  MIPS: OCTEON: irq: Check for null return on kzalloc allocation
  MIPS: ath25: Check for kzalloc allocation failure
  MIPS: BMIPS: Do not mask IPIs during suspend
  drm/amdgpu:Always save uvd vcpu_bo in VM Mode
  drm/amdgpu:Correct max uvd handles
  drm/amdgpu: fix KV harvesting
  drm/radeon: fix KV harvesting
  drm/amdgpu: Notify sbios device ready before send request
  drm/amdgpu: Fix deadlock on runtime suspend
  drm/radeon: Fix deadlock on runtime suspend
  drm/nouveau: Fix deadlock on runtime suspend
  drm: Allow determining if current task is output poll worker
  workqueue: Allow retrieval of current task's work struct
  drm/i915: Always call to intel_display_set_init_power() in resume_early.
  scsi: qla2xxx: Fix NULL pointer crash due to active timer for ABTS
  drm/i915: Try EDID bitbanging on HDMI after failed read
  RDMA/mlx5: Fix integer overflow while resizing CQ
  RDMA/ucma: Check that user doesn't overflow QP state
  RDMA/ucma: Limit possible option size
  ANDROID: sdcardfs: fix lock issue on 32 bit/SMP architectures
  UPSTREAM: kasan: add functions for unpoisoning stack variables
  UPSTREAM: kasan: add tests for alloca poisoning
  UPSTREAM: kasan: support alloca() poisoning
  UPSTREAM: kasan/Makefile: support LLVM style asan parameters
  BACKPORT: kasan: add compiler support for clang
  kbuild: fix --gc-sections
  BACKPORT: fix "netfilter: xt_bpf: Fix XT_BPF_MODE_FD_PINNED mode of 'xt_bpf_info_v1'"
  UPSTREAM: netfilter: xt_bpf: add overflow checks
  UPSTREAM: netfilter: xt_bpf: Fix XT_BPF_MODE_FD_PINNED mode of 'xt_bpf_info_v1'
  UPSTREAM: netfilter: xt_bpf: support ebpf
  FROMLIST: f2fs: don't put dentry page in pagecache into highmem

Change-Id: I7f13fedc725fe5333e18e4e5b6639eee27ea1120
Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
2018-04-17 10:43:29 -07:00
Sundara Vinayagam
2e4da3f33f usb: phy msm: Do msm_otg_notify_chg_current in sleepable context
The charger driver's implementation of power_supply_set_property() for
POWER_SUPPLY_CURRENT_MAX currently uses a mutex. Since
sleeping is disallowed in this case, instead schedule a
work function to do the call.

Change-Id: Icad8be033dd0782c155ac8858a15580844415ba4
Signed-off-by: Sundara Vinayagam <sundvi@codeaurora.org>
2018-03-18 21:41:16 -07:00
Greg Kroah-Hartman
bb52bba67e Merge 4.9.88 into android-4.9
Changes in 4.9.88
	RDMA/ucma: Limit possible option size
	RDMA/ucma: Check that user doesn't overflow QP state
	RDMA/mlx5: Fix integer overflow while resizing CQ
	drm/i915: Try EDID bitbanging on HDMI after failed read
	scsi: qla2xxx: Fix NULL pointer crash due to active timer for ABTS
	drm/i915: Always call to intel_display_set_init_power() in resume_early.
	workqueue: Allow retrieval of current task's work struct
	drm: Allow determining if current task is output poll worker
	drm/nouveau: Fix deadlock on runtime suspend
	drm/radeon: Fix deadlock on runtime suspend
	drm/amdgpu: Fix deadlock on runtime suspend
	drm/amdgpu: Notify sbios device ready before send request
	drm/radeon: fix KV harvesting
	drm/amdgpu: fix KV harvesting
	drm/amdgpu:Correct max uvd handles
	drm/amdgpu:Always save uvd vcpu_bo in VM Mode
	MIPS: BMIPS: Do not mask IPIs during suspend
	MIPS: ath25: Check for kzalloc allocation failure
	MIPS: OCTEON: irq: Check for null return on kzalloc allocation
	Input: matrix_keypad - fix race when disabling interrupts
	loop: Fix lost writes caused by missing flag
	virtio_ring: fix num_free handling in error case
	KVM: s390: fix memory overwrites when not using SCA entries
	kbuild: Handle builtin dtb file names containing hyphens
	IB/mlx5: Fix incorrect size of klms in the memory region
	bcache: fix crashes in duplicate cache device register
	bcache: don't attach backing with duplicate UUID
	x86/MCE: Serialize sysfs changes
	perf tools: Fix trigger class trigger_on()
	x86/spectre_v2: Don't check microcode versions when running under hypervisors
	ALSA: hda/realtek: Limit mic boost on T480
	ALSA: hda/realtek - Fix dock line-out volume on Dell Precision 7520
	ALSA: hda/realtek - Make dock sound work on ThinkPad L570
	ALSA: seq: Don't allow resizing pool in use
	ALSA: seq: More protection for concurrent write and ioctl races
	ALSA: hda: add dock and led support for HP EliteBook 820 G3
	ALSA: hda: add dock and led support for HP ProBook 640 G2
	nospec: Kill array_index_nospec_mask_check()
	nospec: Include <asm/barrier.h> dependency
	Revert "x86/retpoline: Simplify vmexit_fill_RSB()"
	x86/speculation: Use IBRS if available before calling into firmware
	x86/retpoline: Support retpoline builds with Clang
	x86/speculation, objtool: Annotate indirect calls/jumps for objtool
	x86/boot, objtool: Annotate indirect jump in secondary_startup_64()
	x86/speculation: Move firmware_restrict_branch_speculation_*() from C to CPP
	x86/paravirt, objtool: Annotate indirect calls
	watchdog: hpwdt: SMBIOS check
	watchdog: hpwdt: Check source of NMI
	watchdog: hpwdt: fix unused variable warning
	watchdog: hpwdt: Remove legacy NMI sourcing.
	ARM: omap2: hide omap3_save_secure_ram on non-OMAP3 builds
	Input: tca8418_keypad - remove double read of key event register
	tc358743: fix register i2c_rd/wr function fix
	netfilter: add back stackpointer size checks
	netfilter: x_tables: fix missing timer initialization in xt_LED
	netfilter: nat: cope with negative port range
	netfilter: IDLETIMER: be syzkaller friendly
	netfilter: ebtables: CONFIG_COMPAT: don't trust userland offsets
	netfilter: bridge: ebt_among: add missing match size checks
	netfilter: ipv6: fix use-after-free Write in nf_nat_ipv6_manip_pkt
	netfilter: x_tables: pass xt_counters struct instead of packet counter
	netfilter: x_tables: pass xt_counters struct to counter allocator
	netfilter: x_tables: pack percpu counter allocations
	ext4: inplace xattr block update fails to deduplicate blocks
	ubi: Fix race condition between ubi volume creation and udev
	scsi: qla2xxx: Replace fcport alloc with qla2x00_alloc_fcport
	NFS: Fix an incorrect type in struct nfs_direct_req
	NFS: Fix unstable write completion
	x86/module: Detect and skip invalid relocations
	x86: Treat R_X86_64_PLT32 as R_X86_64_PC32
	ASoC: sgtl5000: Fix suspend/resume
	ASoC: rt5651: Fix regcache sync errors on resume
	serial: sh-sci: prevent lockup on full TTY buffers
	tty/serial: atmel: add new version check for usart
	uas: fix comparison for error code
	staging: comedi: fix comedi_nsamples_left.
	staging: android: ashmem: Fix lockdep issue during llseek
	USB: storage: Add JMicron bridge 152d:2567 to unusual_devs.h
	usbip: vudc: fix null pointer dereference on udc->lock
	usb: quirks: add control message delay for 1b1c:1b20
	usb: usbmon: Read text within supplied buffer size
	usb: gadget: f_fs: Fix use-after-free in ffs_fs_kill_sb()
	serial: 8250_pci: Add Brainboxes UC-260 4 port serial device
	serial: core: mark port as initialized in autoconfig
	earlycon: add reg-offset to physical address before mapping
	PCI: dwc: Fix enumeration end when reaching root subordinate
	Linux 4.9.88

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2018-03-18 12:07:50 +01:00
Danilo Krummrich
b2708e1e30 usb: quirks: add control message delay for 1b1c:1b20
commit cb88a0588717ba6c756cb5972d75766b273a6817 upstream.

Corsair Strafe RGB keyboard does not respond to usb control messages
sometimes and hence generates timeouts.

Commit de3af5bf259d ("usb: quirks: add delay init quirk for Corsair
Strafe RGB keyboard") tried to fix those timeouts by adding
USB_QUIRK_DELAY_INIT.

Unfortunately, even with this quirk timeouts of usb_control_msg()
can still be seen, but with a lower frequency (approx. 1 out of 15):

[   29.103520] usb 1-8: string descriptor 0 read error: -110
[   34.363097] usb 1-8: can't set config #1, error -110

Adding further delays to different locations where usb control
messages are issued just moves the timeouts to other locations,
e.g.:

[   35.400533] usbhid 1-8:1.0: can't add hid device: -110
[   35.401014] usbhid: probe of 1-8:1.0 failed with error -110

The only way to reliably avoid those issues is having a pause after
each usb control message. In approx. 200 boot cycles no more timeouts
were seen.

Addionaly, keep USB_QUIRK_DELAY_INIT as it turned out to be necessary
to have the delay in hub_port_connect() after hub_port_init().

The overall boot time seems not to be influenced by these additional
delays, even on fast machines and lightweight distributions.

Fixes: de3af5bf259d ("usb: quirks: add delay init quirk for Corsair Strafe RGB keyboard")
Cc: stable@vger.kernel.org
Signed-off-by: Danilo Krummrich <danilokrummrich@dk-develop.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-18 11:18:56 +01:00
Sundara Vinayagam
93ab52c123 usb: gadget: Fix ci13xxx compilation issues
Resolved compilation dependencies.

Change-Id: Ic83489eb781db1dfd6cc5f1c4f961dc18ba96d4b
Signed-off-by: Sundara Vinayagam <sundvi@codeaurora.org>
2018-03-16 15:14:08 +05:30
Ajay Agarwal
e57372b34e usb: gadget: Add flag to determine gadget controller
Add a flag is_chipidea to determine whether the USB device
controller is ChipIdea or not. Set the flag to true during
CI UDC probe.

Change-Id: I57d54345fe2a655191c8d66a46e906a61e34a3e4
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
2018-03-05 14:48:46 +05:30
Ajay Agarwal
a5370b8644 Revert "usb: gadget: Add flag to determine gadget controller"
This reverts commit ac38cd8c8c
to fix the compilation error because of the typo is_chipiea.

Change-Id: I92a7d5f7353b59518c8cbdfa8b5ae94b10cf214c
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
2018-03-05 12:23:10 +05:30
Linux Build Service Account
6f681a6279 Merge "USB: dwc3-msm: Perform DBM config/unconfig under spinlock protection" 2018-03-03 15:04:01 -08:00
Linux Build Service Account
8ccef11387 Merge "usb: gadget: Add flag to determine gadget controller" 2018-03-03 04:54:18 -08:00
Vijayavardhan Vennapusa
0a162cdede USB: dwc3-msm: Perform DBM config/unconfig under spinlock protection
There is a possibility of dwc3_msm_ep_queue() and msm_ep_unconfig() racing
each other if suspend happens right after configured. This scenario will
result in NOC error if start_xfer command gets queued after
msm_ep_unconfig().  Hence fix the issue by adding spinlock protection for
DBM endpoint configuration and unconfiguration.

Change-Id: I3fd007647370250017c97faebffadb35afb7fc4d
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: Chandana Kishori Chiluveru <cchiluve@codeaurora.org>
Signed-off-by: Sriharsha Allenki <sallenki@codeaurora.org>
2018-03-01 21:36:54 -08:00
Vijayavardhan Vennapusa
80508b4fa6 USB: dwc3-msm: Initialize DBM ep before BAM pipe reset
On new platforms, endpoint clock gating is added for dbm endpoints
with Synopsys USB3.0 controller. This hardware feature requires
initialization of DBM endpoint before BAM pipe reset for bam2bam mode
data transfers working. Hence change sequence such that do DBM endpoint
initialization first followed by BAM pipe reset and do start transfer
as last operation.

CRs-Fixed: 965207
Change-Id: Ib5bfd1a7d258fe336a4c9924850fc9223c1c81f6
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: Chandana Kishori Chiluveru <cchiluve@codeaurora.org>
Signed-off-by: Sriharsha Allenki <sallenki@codeaurora.org>
2018-02-27 23:25:07 +05:30