Commit Graph

4673 Commits

Author SHA1 Message Date
Jaegeuk Kim
57df3030e1 Merge remote-tracking branch 'aosp/upstream-f2fs-stable-linux-5.4.y' into android-5.4
Merged in v5.5-rc1.

* aosp/upstream-f2fs-stable-linux-5.4.y:
  docs: fs-verity: mention statx() support
  f2fs: support STATX_ATTR_VERITY
  ext4: support STATX_ATTR_VERITY
  statx: define STATX_ATTR_VERITY
  docs: fs-verity: document first supported kernel version
  f2fs: add support for IV_INO_LBLK_64 encryption policies
  ext4: add support for IV_INO_LBLK_64 encryption policies
  fscrypt: add support for IV_INO_LBLK_64 policies
  fscrypt: avoid data race on fscrypt_mode::logged_impl_name
  fscrypt: zeroize fscrypt_info before freeing
  fscrypt: remove struct fscrypt_ctx
  fscrypt: invoke crypto API for ESSIV handling
  null_blk: remove unused variable warning on !CONFIG_BLK_DEV_ZONED
  block: set the zone size in blk_revalidate_disk_zones atomically
  block: don't handle bio based drivers in blk_revalidate_disk_zones
  null_blk: cleanup null_gendisk_register
  null_blk: fix zone size paramter check
  block: allocate the zone bitmaps lazily
  block: replace seq_zones_bitmap with conv_zones_bitmap
  block: simplify blkdev_nr_zones
  block: remove the empty line at the end of blk-zoned.c
  scsi: sd_zbc: Improve report zones error printout
  scsi: sd_zbc: Remove set but not used variable 'buflen'
  block: rework zone reporting
  scsi: sd_zbc: Cleanup sd_zbc_alloc_report_buffer()
  null_blk: clean up report zones
  null_blk: clean up the block device operations
  null_blk: return fixed zoned reads > write pointer
  scsi: sd_zbc: add zone open, close, and finish support
  block: Remove partition support for zoned block devices
  block: Simplify report zones execution
  block: cleanup the !zoned case in blk_revalidate_disk_zones
  block: Enhance blk_revalidate_disk_zones()
  block: add zone open, close and finish ioctl support
  block: add zone open, close and finish operations
  block: Simplify REQ_OP_ZONE_RESET_ALL handling
  block: Remove REQ_OP_ZONE_RESET plugging
  f2fs: stop GC when the victim becomes fully valid
  f2fs: expose main_blkaddr in sysfs
  f2fs: choose hardlimit when softlimit is larger than hardlimit in f2fs_statfs_project()
  f2fs: Fix deadlock in f2fs_gc() context during atomic files handling
  f2fs: show f2fs instance in printk_ratelimited
  f2fs: fix potential overflow
  f2fs: fix to update dir's i_pino during cross_rename
  f2fs: support aligned pinned file
  f2fs: avoid kernel panic on corruption test
  f2fs: fix wrong description in document
  f2fs: cache global IPU bio
  f2fs: fix to avoid memory leakage in f2fs_listxattr
  f2fs: check total_segments from devices in raw_super
  f2fs: update multi-dev metadata in resize_fs
  f2fs: mark recovery flag correctly in read_raw_super_block()
  f2fs: fix to update time in lazytime mode

Change-Id: I9325127228fb82b67f064ce8b3bc8d40ac76e65b
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2020-01-15 16:41:51 -08:00
Satya Tangirala
b7b3af9614 BACKPORT: FROMLIST: Update Inline Encryption from v5 to v6 of patch series
Changes v5 => v6:
 - Blk-crypto's kernel crypto API fallback is no longer restricted to
   8-byte DUNs. It's also now separately configurable from blk-crypto, and
   can be disabled entirely, while still allowing the kernel to use inline
   encryption hardware. Further, struct bio_crypt_ctx takes up less space,
   and no longer contains the information needed by the crypto API
   fallback - the fallback allocates the required memory when necessary.
 - Blk-crypto now supports all file content encryption modes supported by
   fscrypt.
 - Fixed bio merging logic in blk-merge.c
 - Fscrypt now supports inline encryption with the direct key policy, since
   blk-crypto now has support for larger DUNs.
 - Keyslot manager now uses a hashtable to lookup which keyslot contains
   any particular key (thanks Eric!)
 - Fscrypt support for inline encryption now handles filesystems with
   multiple underlying block devices (thanks Eric!)
 - Numerous cleanups

Bug: 137270441
Test: refer to I26376479ee38259b8c35732cb3a1d7e15f9b05a3
Change-Id: I13e2e327e0b4784b394cb1e7cf32a04856d95f01
Link: https://lore.kernel.org/linux-block/20191218145136.172774-1-satyat@google.com/
Signed-off-by: Satya Tangirala <satyat@google.com>
2020-01-13 18:46:44 +00:00
Greg Kroah-Hartman
fde6e0c654 This is the 5.4.11 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl4bAaMACgkQONu9yGCS
 aT6WThAApG5Lt+rOIIbb0JsTgiqzRs/5VkxQLDsDkn8QXMDDX44eY+cW3XLA+3nv
 UAU7wXraFCq7SznsQADHj4edAQN/urNXcIlLCIfoWCuq4Yk6DIgHNDZcC5a1PPiz
 ri96mrxHq24XDbRcXZFN4usC6Q1Q40W/N2NyZ7gIfCsYOeiaZzNhvw1Sh6Pkajb+
 jKe9Yzjolj2XJxrNgJxfsTJLnCEPwoQ/QoBIp1ffHqhhCjR/7tHm611Pj0q260Fj
 H6OGZaRNMoc4I+2dQXsYUfyPH5aMwx2/Nym4FNHye9LaoQl07m+uR0LqmytPQ0GL
 j6mQuMv+kdeVOOXO+zRJH8A2yq4mwvr80s15myhG9HvAzmcGAvagsCl19yy9/fJx
 6M2Sn8qDwJXRaxTc1e7figXkTZu5+sX7th3sUk0KbCHZ+UkJiCjXpJDgBK/HQkC3
 EsVFZGeIBySbWk2yYKzQkb4ZA32qbzUKW88Rjago3BOV96WHfnAhJDQPssDJqlcs
 cgK+UTQOJb9U1V+Kd4Z8uhlCeboaRj4yOFt2EGxkK2sqJse05eaTN0GPbP/3X6Be
 TyD17Cnv18Ltk2qf2DXanJSlrCUcHEfEDoQQTqJATxV4NLzTcwmVAscsv1aRmcot
 ii1ZTwqi04MLgaNla+6tqqZ/VufUtWVIbN73q2UdU8zZh5PHJ18=
 =cKx6
 -----END PGP SIGNATURE-----

Merge 5.4.11 into android-5.4

Changes in 5.4.11
	USB: dummy-hcd: use usb_urb_dir_in instead of usb_pipein
	bpf: Fix passing modified ctx to ld/abs/ind instruction
	ASoC: rt5682: fix i2c arbitration lost issue
	spi: pxa2xx: Add support for Intel Jasper Lake
	regulator: fix use after free issue
	ASoC: max98090: fix possible race conditions
	spi: fsl: Fix GPIO descriptor support
	gpio: Handle counting of Freescale chipselects
	spi: fsl: Handle the single hardwired chipselect case
	locking/spinlock/debug: Fix various data races
	netfilter: ctnetlink: netns exit must wait for callbacks
	x86/intel: Disable HPET on Intel Ice Lake platforms
	netfilter: nf_tables_offload: Check for the NETDEV_UNREGISTER event
	mwifiex: Fix heap overflow in mmwifiex_process_tdls_action_frame()
	libtraceevent: Fix lib installation with O=
	libtraceevent: Copy pkg-config file to output folder when using O=
	regulator: core: fix regulator_register() error paths to properly release rdev
	x86/efi: Update e820 with reserved EFI boot services data to fix kexec breakage
	ASoC: Intel: bytcr_rt5640: Update quirk for Teclast X89
	selftests: netfilter: use randomized netns names
	efi/gop: Return EFI_NOT_FOUND if there are no usable GOPs
	efi/gop: Return EFI_SUCCESS if a usable GOP was found
	efi/gop: Fix memory leak in __gop_query32/64()
	efi/earlycon: Remap entire framebuffer after page initialization
	ARM: dts: imx6ul: imx6ul-14x14-evk.dtsi: Fix SPI NOR probing
	ARM: vexpress: Set-up shared OPP table instead of individual for each CPU
	netfilter: uapi: Avoid undefined left-shift in xt_sctp.h
	netfilter: nft_set_rbtree: bogus lookup/get on consecutive elements in named sets
	netfilter: nf_tables: validate NFT_SET_ELEM_INTERVAL_END
	netfilter: nf_tables: validate NFT_DATA_VALUE after nft_data_init()
	netfilter: nf_tables: skip module reference count bump on object updates
	netfilter: nf_tables_offload: return EOPNOTSUPP if rule specifies no actions
	ARM: dts: BCM5301X: Fix MDIO node address/size cells
	selftests/ftrace: Fix to check the existence of set_ftrace_filter
	selftests/ftrace: Fix ftrace test cases to check unsupported
	selftests/ftrace: Do not to use absolute debugfs path
	selftests/ftrace: Fix multiple kprobe testcase
	selftests: safesetid: Move link library to LDLIBS
	selftests: safesetid: Check the return value of setuid/setgid
	selftests: safesetid: Fix Makefile to set correct test program
	ARM: exynos_defconfig: Restore debugfs support
	ARM: dts: Cygnus: Fix MDIO node address/size cells
	spi: spi-cavium-thunderx: Add missing pci_release_regions()
	reset: Do not register resource data for missing resets
	ASoC: topology: Check return value for snd_soc_add_dai_link()
	ASoC: topology: Check return value for soc_tplg_pcm_create()
	ASoC: SOF: loader: snd_sof_fw_parse_ext_data log warning on unknown header
	ASoC: SOF: Intel: split cht and byt debug window sizes
	ARM: dts: am335x-sancloud-bbe: fix phy mode
	ARM: omap2plus_defconfig: Add back DEBUG_FS
	ARM: dts: bcm283x: Fix critical trip point
	arm64: dts: ls1028a: fix typo in TMU calibration data
	bpf, riscv: Limit to 33 tail calls
	bpf, mips: Limit to 33 tail calls
	bpftool: Don't crash on missing jited insns or ksyms
	perf metricgroup: Fix printing event names of metric group with multiple events
	perf header: Fix false warning when there are no duplicate cache entries
	spi: spi-ti-qspi: Fix a bug when accessing non default CS
	ARM: dts: am437x-gp/epos-evm: fix panel compatible
	kselftest/runner: Print new line in print of timeout log
	kselftest: Support old perl versions
	samples: bpf: Replace symbol compare of trace_event
	samples: bpf: fix syscall_tp due to unused syscall
	arm64: dts: ls1028a: fix reboot node
	ARM: imx_v6_v7_defconfig: Explicitly restore CONFIG_DEBUG_FS
	pinctrl: aspeed-g6: Fix LPC/eSPI mux configuration
	bus: ti-sysc: Fix missing reset delay handling
	clk: walk orphan list on clock provider registration
	mac80211: fix TID field in monitor mode transmit
	cfg80211: fix double-free after changing network namespace
	pinctrl: pinmux: fix a possible null pointer in pinmux_can_be_used_for_gpio
	powerpc: Ensure that swiotlb buffer is allocated from low memory
	btrfs: Fix error messages in qgroup_rescan_init
	Btrfs: fix cloning range with a hole when using the NO_HOLES feature
	powerpc/vcpu: Assume dedicated processors as non-preempt
	powerpc/spinlocks: Include correct header for static key
	btrfs: handle error in btrfs_cache_block_group
	Btrfs: fix hole extent items with a zero size after range cloning
	ocxl: Fix potential memory leak on context creation
	bpf: Clear skb->tstamp in bpf_redirect when necessary
	habanalabs: rate limit error msg on waiting for CS
	habanalabs: remove variable 'val' set but not used
	bnx2x: Do not handle requests from VFs after parity
	bnx2x: Fix logic to get total no. of PFs per engine
	cxgb4: Fix kernel panic while accessing sge_info
	net: usb: lan78xx: Fix error message format specifier
	parisc: fix compilation when KEXEC=n and KEXEC_FILE=y
	parisc: add missing __init annotation
	rfkill: Fix incorrect check to avoid NULL pointer dereference
	ASoC: wm8962: fix lambda value
	regulator: rn5t618: fix module aliases
	spi: nxp-fspi: Ensure width is respected in spi-mem operations
	clk: at91: fix possible deadlock
	staging: axis-fifo: add unspecified HAS_IOMEM dependency
	iommu/iova: Init the struct iova to fix the possible memleak
	kconfig: don't crash on NULL expressions in expr_eq()
	scripts: package: mkdebian: add missing rsync dependency
	perf/x86: Fix potential out-of-bounds access
	perf/x86/intel: Fix PT PMI handling
	sched/psi: Fix sampling error and rare div0 crashes with cgroups and high uptime
	psi: Fix a division error in psi poll()
	usb: typec: fusb302: Fix an undefined reference to 'extcon_get_state'
	block: end bio with BLK_STS_AGAIN in case of non-mq devs and REQ_NOWAIT
	fs: avoid softlockups in s_inodes iterators
	fs: call fsnotify_sb_delete after evict_inodes
	perf/smmuv3: Remove the leftover put_cpu() in error path
	iommu/dma: Relax locking in iommu_dma_prepare_msi()
	io_uring: don't wait when under-submitting
	clk: Move clk_core_reparent_orphans() under CONFIG_OF
	net: stmmac: selftests: Needs to check the number of Multicast regs
	net: stmmac: Determine earlier the size of RX buffer
	net: stmmac: Do not accept invalid MTU values
	net: stmmac: xgmac: Clear previous RX buffer size
	net: stmmac: RX buffer size must be 16 byte aligned
	net: stmmac: Always arm TX Timer at end of transmission start
	s390/purgatory: do not build purgatory with kcov, kasan and friends
	drm/exynos: gsc: add missed component_del
	tpm/tpm_ftpm_tee: add shutdown call back
	xsk: Add rcu_read_lock around the XSK wakeup
	net/mlx5e: Fix concurrency issues between config flow and XSK
	net/i40e: Fix concurrency issues between config flow and XSK
	net/ixgbe: Fix concurrency issues between config flow and XSK
	platform/x86: pcengines-apuv2: fix simswap GPIO assignment
	arm64: cpu_errata: Add Hisilicon TSV110 to spectre-v2 safe list
	block: Fix a lockdep complaint triggered by request queue flushing
	s390/dasd/cio: Interpret ccw_device_get_mdc return value correctly
	s390/dasd: fix memleak in path handling error case
	block: fix memleak when __blk_rq_map_user_iov() is failed
	parisc: Fix compiler warnings in debug_core.c
	sbitmap: only queue kyber's wait callback if not already active
	s390/qeth: handle error due to unsupported transport mode
	s390/qeth: fix promiscuous mode after reset
	s390/qeth: don't return -ENOTSUPP to userspace
	llc2: Fix return statement of llc_stat_ev_rx_null_dsap_xid_c (and _test_c)
	hv_netvsc: Fix unwanted rx_table reset
	selftests: pmtu: fix init mtu value in description
	tracing: Do not create directories if lockdown is in affect
	gtp: fix bad unlock balance in gtp_encap_enable_socket
	macvlan: do not assume mac_header is set in macvlan_broadcast()
	net: dsa: mv88e6xxx: Preserve priority when setting CPU port.
	net: freescale: fec: Fix ethtool -d runtime PM
	net: stmmac: dwmac-sun8i: Allow all RGMII modes
	net: stmmac: dwmac-sunxi: Allow all RGMII modes
	net: stmmac: Fixed link does not need MDIO Bus
	net: usb: lan78xx: fix possible skb leak
	pkt_sched: fq: do not accept silly TCA_FQ_QUANTUM
	sch_cake: avoid possible divide by zero in cake_enqueue()
	sctp: free cmd->obj.chunk for the unprocessed SCTP_CMD_REPLY
	tcp: fix "old stuff" D-SACK causing SACK to be treated as D-SACK
	vxlan: fix tos value before xmit
	mlxsw: spectrum_qdisc: Ignore grafting of invisible FIFO
	net: sch_prio: When ungrafting, replace with FIFO
	vlan: fix memory leak in vlan_dev_set_egress_priority
	vlan: vlan_changelink() should propagate errors
	macb: Don't unregister clks unconditionally
	net/mlx5: Move devlink registration before interfaces load
	net: dsa: mv88e6xxx: force cmode write on 6141/6341
	net/mlx5e: Always print health reporter message to dmesg
	net/mlx5: DR, No need for atomic refcount for internal SW steering resources
	net/mlx5e: Fix hairpin RSS table size
	net/mlx5: DR, Init lists that are used in rule's member
	usb: dwc3: gadget: Fix request complete check
	USB: core: fix check for duplicate endpoints
	USB: serial: option: add Telit ME910G1 0x110a composition
	usb: missing parentheses in USE_NEW_SCHEME
	Linux 5.4.11

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Idb9985bebc97203fa305f881fd98a62ac08e66d9
2020-01-12 15:36:52 +01:00
Yang Yingliang
3a1cba8768 block: fix memleak when __blk_rq_map_user_iov() is failed
[ Upstream commit 3b7995a98ad76da5597b488fa84aa5a56d43b608 ]

When I doing fuzzy test, get the memleak report:

BUG: memory leak
unreferenced object 0xffff88837af80000 (size 4096):
  comm "memleak", pid 3557, jiffies 4294817681 (age 112.499s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    20 00 00 00 10 01 00 00 00 00 00 00 01 00 00 00   ...............
  backtrace:
    [<000000001c894df8>] bio_alloc_bioset+0x393/0x590
    [<000000008b139a3c>] bio_copy_user_iov+0x300/0xcd0
    [<00000000a998bd8c>] blk_rq_map_user_iov+0x2f1/0x5f0
    [<000000005ceb7f05>] blk_rq_map_user+0xf2/0x160
    [<000000006454da92>] sg_common_write.isra.21+0x1094/0x1870
    [<00000000064bb208>] sg_write.part.25+0x5d9/0x950
    [<000000004fc670f6>] sg_write+0x5f/0x8c
    [<00000000b0d05c7b>] __vfs_write+0x7c/0x100
    [<000000008e177714>] vfs_write+0x1c3/0x500
    [<0000000087d23f34>] ksys_write+0xf9/0x200
    [<000000002c8dbc9d>] do_syscall_64+0x9f/0x4f0
    [<00000000678d8e9a>] entry_SYSCALL_64_after_hwframe+0x49/0xbe

If __blk_rq_map_user_iov() is failed in blk_rq_map_user_iov(),
the bio(s) which is allocated before this failing will leak. The
refcount of the bio(s) is init to 1 and increased to 2 by calling
bio_get(), but __blk_rq_unmap_user() only decrease it to 1, so
the bio cannot be freed. Fix it by calling blk_rq_unmap_user().

Reviewed-by: Bob Liu <bob.liu@oracle.com>
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-12 12:21:43 +01:00
Bart Van Assche
f7cc2f988f block: Fix a lockdep complaint triggered by request queue flushing
[ Upstream commit b3c6a59975415bde29cfd76ff1ab008edbf614a9 ]

Avoid that running test nvme/012 from the blktests suite triggers the
following false positive lockdep complaint:

============================================
WARNING: possible recursive locking detected
5.0.0-rc3-xfstests-00015-g1236f7d60242 #841 Not tainted
--------------------------------------------
ksoftirqd/1/16 is trying to acquire lock:
000000000282032e (&(&fq->mq_flush_lock)->rlock){..-.}, at: flush_end_io+0x4e/0x1d0

but task is already holding lock:
00000000cbadcbc2 (&(&fq->mq_flush_lock)->rlock){..-.}, at: flush_end_io+0x4e/0x1d0

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&(&fq->mq_flush_lock)->rlock);
  lock(&(&fq->mq_flush_lock)->rlock);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

1 lock held by ksoftirqd/1/16:
 #0: 00000000cbadcbc2 (&(&fq->mq_flush_lock)->rlock){..-.}, at: flush_end_io+0x4e/0x1d0

stack backtrace:
CPU: 1 PID: 16 Comm: ksoftirqd/1 Not tainted 5.0.0-rc3-xfstests-00015-g1236f7d60242 #841
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 dump_stack+0x67/0x90
 __lock_acquire.cold.45+0x2b4/0x313
 lock_acquire+0x98/0x160
 _raw_spin_lock_irqsave+0x3b/0x80
 flush_end_io+0x4e/0x1d0
 blk_mq_complete_request+0x76/0x110
 nvmet_req_complete+0x15/0x110 [nvmet]
 nvmet_bio_done+0x27/0x50 [nvmet]
 blk_update_request+0xd7/0x2d0
 blk_mq_end_request+0x1a/0x100
 blk_flush_complete_seq+0xe5/0x350
 flush_end_io+0x12f/0x1d0
 blk_done_softirq+0x9f/0xd0
 __do_softirq+0xca/0x440
 run_ksoftirqd+0x24/0x50
 smpboot_thread_fn+0x113/0x1e0
 kthread+0x121/0x140
 ret_from_fork+0x3a/0x50

Cc: Christoph Hellwig <hch@infradead.org>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Hannes Reinecke <hare@suse.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-12 12:21:42 +01:00
Roman Penyaev
2ac95310fe block: end bio with BLK_STS_AGAIN in case of non-mq devs and REQ_NOWAIT
[ Upstream commit c58c1f83436b501d45d4050fd1296d71a9760bcb ]

Non-mq devs do not honor REQ_NOWAIT so give a chance to the caller to repeat
request gracefully on -EAGAIN error.

The problem is well reproduced using io_uring:

   mkfs.ext4 /dev/ram0
   mount /dev/ram0 /mnt

   # Preallocate a file
   dd if=/dev/zero of=/mnt/file bs=1M count=1

   # Start fio with io_uring and get -EIO
   fio --rw=write --ioengine=io_uring --size=1M --direct=1 --name=job --filename=/mnt/file

Signed-off-by: Roman Penyaev <rpenyaev@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-12 12:21:37 +01:00
Greg Kroah-Hartman
813bf83282 This is the 5.4.9 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl4W8EgACgkQONu9yGCS
 aT4szA//fqXI1OQ3xcCt5s9MYZYYa6IpX/VZ0H7lNC/7pkJzccKo+aSer7ppEn4o
 ND8sHNx/lhfZorhvLdqJK4PLThC+fXmXnLvFOzqvZeUVyesnv9zlhd/5JNu18Fvc
 RNjcIRIAHFwanZLAw8uft1DIZXcZ8wNkAAugn/WQV3FN/TG+FsrDzWYnmbBhRIQS
 XC/2jSlFpMTKoExNzEdbduG0XH5plWeE+AdY3a+DQsOBUO2XrAuk5HTEByM1jzPV
 W7U9vMqvw3OyrERcA0lmjs37Waw1e0qzfUaa8Bman5Uc0StOTq0UwschX21SB5yP
 MvbAKhqaKtSff7b4lNrDP9Kj1O/lH84WPSn/aao9D083m/ZYdkkd4AWMlS480lL5
 oJ28tFbgwLayIqDbwCggHluTsNUdQSTwahVbnp4GMqxfjWrApdLPCqloSb+x9JCF
 9pWJf3awI53mA864pH/uOM7pDOz5/c/oJ4QzVmOmR48dsddorY+gPcwk+YpElJcZ
 +xCBQDN5JkNC7lwqu2lvaoq/5cMC5lO/v6aeTfsYCRVnlNY12TY8z352zzMZfCKG
 GRkNvDqWZ5ZmQ+LblWRVbgdGxU42wIYXUS1jUdFd+5DRzz17+ZKUy7YbLNmZMcpY
 UyiM2Ij7X7HsNGrYDKFq0lZPw6k7v3FshvMwQ8C6dNk+l3o9oCA=
 =M+hs
 -----END PGP SIGNATURE-----

Merge 5.4.9 into android-5.4

Changes in 5.4.9
	drm/mcde: dsi: Fix invalid pointer dereference if panel cannot be found
	nvme_fc: add module to ops template to allow module references
	nvme-fc: fix double-free scenarios on hw queues
	drm/amdgpu: add check before enabling/disabling broadcast mode
	drm/amdgpu: add header line for power profile on Arcturus
	drm/amdgpu: add cache flush workaround to gfx8 emit_fence
	drm/amd/display: Map DSC resources 1-to-1 if numbers of OPPs and DSCs are equal
	drm/amd/display: Fixed kernel panic when booting with DP-to-HDMI dongle
	drm/amd/display: Change the delay time before enabling FEC
	drm/amd/display: Reset steer fifo before unblanking the stream
	drm/amd/display: update dispclk and dppclk vco frequency
	nvme/pci: Fix write and poll queue types
	nvme/pci: Fix read queue count
	iio: st_accel: Fix unused variable warning
	iio: adc: max9611: Fix too short conversion time delay
	PM / devfreq: Fix devfreq_notifier_call returning errno
	PM / devfreq: Set scaling_max_freq to max on OPP notifier error
	PM / devfreq: Don't fail devfreq_dev_release if not in list
	afs: Fix afs_find_server lookups for ipv4 peers
	afs: Fix SELinux setting security label on /afs
	RDMA/cma: add missed unregister_pernet_subsys in init failure
	rxe: correctly calculate iCRC for unaligned payloads
	scsi: lpfc: Fix memory leak on lpfc_bsg_write_ebuf_set func
	scsi: qla2xxx: Use explicit LOGO in target mode
	scsi: qla2xxx: Drop superfluous INIT_WORK of del_work
	scsi: qla2xxx: Don't call qlt_async_event twice
	scsi: qla2xxx: Fix PLOGI payload and ELS IOCB dump length
	scsi: qla2xxx: Configure local loop for N2N target
	scsi: qla2xxx: Send Notify ACK after N2N PLOGI
	scsi: qla2xxx: Don't defer relogin unconditonally
	scsi: qla2xxx: Ignore PORT UPDATE after N2N PLOGI
	scsi: iscsi: qla4xxx: fix double free in probe
	scsi: libsas: stop discovering if oob mode is disconnected
	scsi: iscsi: Avoid potential deadlock in iscsi_if_rx func
	staging/wlan-ng: add CRC32 dependency in Kconfig
	drm/nouveau: Move the declaration of struct nouveau_conn_atom up a bit
	drm/nouveau: Fix drm-core using atomic code-paths on pre-nv50 hardware
	drm/nouveau/kms/nv50-: fix panel scaling
	usb: gadget: fix wrong endpoint desc
	net: make socket read/write_iter() honor IOCB_NOWAIT
	afs: Fix mountpoint parsing
	afs: Fix creation calls in the dynamic root to fail with EOPNOTSUPP
	raid5: need to set STRIPE_HANDLE for batch head
	md: raid1: check rdev before reference in raid1_sync_request func
	s390/cpum_sf: Adjust sampling interval to avoid hitting sample limits
	s390/cpum_sf: Avoid SBD overflow condition in irq handler
	RDMA/counter: Prevent auto-binding a QP which are not tracked with res
	IB/mlx4: Follow mirror sequence of device add during device removal
	IB/mlx5: Fix steering rule of drop and count
	xen-blkback: prevent premature module unload
	xen/balloon: fix ballooned page accounting without hotplug enabled
	PM / hibernate: memory_bm_find_bit(): Tighten node optimisation
	ALSA: hda/realtek - Add Bass Speaker and fixed dac for bass speaker
	ALSA: hda/realtek - Enable the bass speaker of ASUS UX431FLC
	PCI: Add a helper to check Power Resource Requirements _PR3 existence
	ALSA: hda: Allow HDA to be runtime suspended when dGPU is not bound to a driver
	PCI: Fix missing inline for pci_pr3_present()
	ALSA: hda - fixup for the bass speaker on Lenovo Carbon X1 7th gen
	tcp: fix data-race in tcp_recvmsg()
	shmem: pin the file in shmem_fault() if mmap_sem is dropped
	taskstats: fix data-race
	ALSA: hda - Downgrade error message for single-cmd fallback
	netfilter: nft_tproxy: Fix port selector on Big Endian
	block: add bio_truncate to fix guard_bio_eod
	mm: drop mmap_sem before calling balance_dirty_pages() in write fault
	ALSA: ice1724: Fix sleep-in-atomic in Infrasonic Quartet support code
	ALSA: usb-audio: fix set_format altsetting sanity check
	ALSA: usb-audio: set the interface format after resume on Dell WD19
	ALSA: hda - Apply sync-write workaround to old Intel platforms, too
	ALSA: hda/realtek - Add headset Mic no shutup for ALC283
	drm/sun4i: hdmi: Remove duplicate cleanup calls
	drm/amdgpu/smu: add metrics table lock
	drm/amdgpu/smu: add metrics table lock for arcturus (v2)
	drm/amdgpu/smu: add metrics table lock for navi (v2)
	drm/amdgpu/smu: add metrics table lock for vega20 (v2)
	MIPS: BPF: Disable MIPS32 eBPF JIT
	MIPS: BPF: eBPF JIT: check for MIPS ISA compliance in Kconfig
	MIPS: Avoid VDSO ABI breakage due to global register variable
	media: pulse8-cec: fix lost cec_transmit_attempt_done() call
	media: cec: CEC 2.0-only bcast messages were ignored
	media: cec: avoid decrementing transmit_queue_sz if it is 0
	media: cec: check 'transmit_in_progress', not 'transmitting'
	mm/memory_hotplug: shrink zones when offlining memory
	mm/zsmalloc.c: fix the migrated zspage statistics.
	memcg: account security cred as well to kmemcg
	mm: move_pages: return valid node id in status if the page is already on the target node
	mm/oom: fix pgtables units mismatch in Killed process message
	ocfs2: fix the crash due to call ocfs2_get_dlm_debug once less
	pstore/ram: Write new dumps to start of recycled zones
	pstore/ram: Fix error-path memory leak in persistent_ram_new() callers
	gcc-plugins: make it possible to disable CONFIG_GCC_PLUGINS again
	locks: print unsigned ino in /proc/locks
	selftests/seccomp: Zero out seccomp_notif
	seccomp: Check that seccomp_notif is zeroed out by the user
	samples/seccomp: Zero out members based on seccomp_notif_sizes
	selftests/seccomp: Catch garbage on SECCOMP_IOCTL_NOTIF_RECV
	dmaengine: Fix access to uninitialized dma_slave_caps
	dmaengine: dma-jz4780: Also break descriptor chains on JZ4725B
	Btrfs: fix infinite loop during nocow writeback due to race
	compat_ioctl: block: handle Persistent Reservations
	compat_ioctl: block: handle BLKREPORTZONE/BLKRESETZONE
	compat_ioctl: block: handle BLKGETZONESZ/BLKGETNRZONES
	bpf: Fix precision tracking for unbounded scalars
	ata: libahci_platform: Export again ahci_platform_<en/dis>able_phys()
	ata: ahci_brcm: Fix AHCI resources management
	ata: ahci_brcm: Add missing clock management during recovery
	ata: ahci_brcm: BCM7425 AHCI requires AHCI_HFLAG_DELAY_ENGINE
	libata: Fix retrieving of active qcs
	gpio: xtensa: fix driver build
	gpiolib: fix up emulated open drain outputs
	clocksource: riscv: add notrace to riscv_sched_clock
	riscv: ftrace: correct the condition logic in function graph tracer
	rseq/selftests: Fix: Namespace gettid() for compatibility with glibc 2.30
	tracing: Fix lock inversion in trace_event_enable_tgid_record()
	tracing: Avoid memory leak in process_system_preds()
	tracing: Have the histogram compare functions convert to u64 first
	tracing: Fix endianness bug in histogram trigger
	samples/trace_printk: Wait for IRQ work to finish
	io_uring: use current task creds instead of allocating a new one
	mm/gup: fix memory leak in __gup_benchmark_ioctl
	apparmor: fix aa_xattrs_match() may sleep while holding a RCU lock
	dmaengine: virt-dma: Fix access after free in vchan_complete()
	gen_initramfs_list.sh: fix 'bad variable name' error
	ALSA: cs4236: fix error return comparison of an unsigned integer
	ALSA: pcm: Yet another missing check of non-cached buffer type
	ALSA: firewire-motu: Correct a typo in the clock proc string
	scsi: lpfc: Fix rpi release when deleting vport
	exit: panic before exit_mm() on global init exit
	arm64: Revert support for execute-only user mappings
	ftrace: Avoid potential division by zero in function profiler
	spi: spi-fsl-dspi: Fix 16-bit word order in 32-bit XSPI mode
	drm/msm: include linux/sched/task.h
	PM / devfreq: Check NULL governor in available_governors_show
	sunrpc: fix crash when cache_head become valid before update
	arm64: dts: qcom: msm8998-clamshell: Remove retention idle state
	nfsd4: fix up replay_matches_cache()
	powerpc: Chunk calls to flush_dcache_range in arch_*_memory
	HID: i2c-hid: Reset ALPS touchpads on resume
	net/sched: annotate lockless accesses to qdisc->empty
	kernel/module.c: wakeup processes in module_wq on module unload
	ACPI: sysfs: Change ACPI_MASKABLE_GPE_MAX to 0x100
	perf callchain: Fix segfault in thread__resolve_callchain_sample()
	iommu/vt-d: Remove incorrect PSI capability check
	of: overlay: add_changeset_property() memory leak
	cifs: Fix potential softlockups while refreshing DFS cache
	firmware: arm_scmi: Avoid double free in error flow
	xfs: don't check for AG deadlock for realtime files in bunmapi
	platform/x86: pmc_atom: Add Siemens CONNECT X300 to critclk_systems DMI table
	netfilter: nf_queue: enqueue skbs with NULL dst
	net, sysctl: Fix compiler warning when only cBPF is present
	watchdog: tqmx86_wdt: Fix build error
	regulator: axp20x: Fix axp20x_set_ramp_delay
	regulator: bd70528: Remove .set_ramp_delay for bd70528_ldo_ops
	spi: uniphier: Fix FIFO threshold
	regulator: axp20x: Fix AXP22x ELDO2 regulator enable bitmask
	powerpc/mm: Mark get_slice_psize() & slice_addr_is_low() as notrace
	Bluetooth: btusb: fix PM leak in error case of setup
	Bluetooth: delete a stray unlock
	Bluetooth: Fix memory leak in hci_connect_le_scan
	arm64: dts: meson-gxl-s905x-khadas-vim: fix uart_A bluetooth node
	arm64: dts: meson-gxm-khadas-vim2: fix uart_A bluetooth node
	media: flexcop-usb: ensure -EIO is returned on error condition
	regulator: ab8500: Remove AB8505 USB regulator
	media: usb: fix memory leak in af9005_identify_state
	dt-bindings: clock: renesas: rcar-usb2-clock-sel: Fix typo in example
	arm64: dts: meson: odroid-c2: Disable usb_otg bus to avoid power failed warning
	phy: renesas: rcar-gen3-usb2: Use platform_get_irq_optional() for optional irq
	tty: serial: msm_serial: Fix lockup for sysrq and oops
	cifs: Fix lookup of root ses in DFS referral cache
	fs: cifs: Fix atime update check vs mtime
	fix compat handling of FICLONERANGE, FIDEDUPERANGE and FS_IOC_FIEMAP
	ath9k_htc: Modify byte order for an error message
	ath9k_htc: Discard undersized packets
	drm/i915/execlists: Fix annotation for decoupling virtual request
	xfs: periodically yield scrub threads to the scheduler
	net: add annotations on hh->hh_len lockless accesses
	ubifs: ubifs_tnc_start_commit: Fix OOB in layout_in_gaps
	btrfs: get rid of unique workqueue helper functions
	Btrfs: only associate the locked page with one async_chunk struct
	s390/smp: fix physical to logical CPU map for SMT
	mm/sparse.c: mark populate_section_memmap as __meminit
	xen/blkback: Avoid unmapping unmapped grant pages
	lib/ubsan: don't serialize UBSAN report
	efi: Don't attempt to map RCI2 config table if it doesn't exist
	perf/x86/intel/bts: Fix the use of page_private()
	net: annotate lockless accesses to sk->sk_pacing_shift
	hsr: avoid debugfs warning message when module is remove
	hsr: fix error handling routine in hsr_dev_finalize()
	hsr: fix a race condition in node list insertion and deletion
	mm/hugetlb: defer freeing of huge pages if in non-task context
	Linux 5.4.9

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I8eebcdac421faf74f70af8e8666abfdcdc45c86b
2020-01-09 16:00:18 +01:00
Arnd Bergmann
247aca0b6b compat_ioctl: block: handle BLKGETZONESZ/BLKGETNRZONES
commit 21d37340912d74b1222d43c11aa9dd0687162573 upstream.

These were added to blkdev_ioctl() in v4.20 but not blkdev_compat_ioctl,
so add them now.

Cc: <stable@vger.kernel.org> # v4.20+
Fixes: 72cd87576d ("block: Introduce BLKGETZONESZ ioctl")
Fixes: 65e4e3eee8 ("block: Introduce BLKGETNRZONES ioctl")
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09 10:19:58 +01:00
Arnd Bergmann
17d3c07aab compat_ioctl: block: handle BLKREPORTZONE/BLKRESETZONE
commit 673bdf8ce0a387ef585c13b69a2676096c6edfe9 upstream.

These were added to blkdev_ioctl() but not blkdev_compat_ioctl,
so add them now.

Cc: <stable@vger.kernel.org> # v4.10+
Fixes: 3ed05a987e ("blk-zoned: implement ioctls")
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09 10:19:58 +01:00
Arnd Bergmann
755d02fcf8 compat_ioctl: block: handle Persistent Reservations
commit b2c0fcd28772f99236d261509bcd242135677965 upstream.

These were added to blkdev_ioctl() in linux-5.5 but not
blkdev_compat_ioctl, so add them now.

Cc: <stable@vger.kernel.org> # v4.4+
Fixes: bbd3e06436 ("block: add an API for Persistent Reservations")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Fold in followup patch from Arnd with missing pr.h header include.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-01-09 10:19:58 +01:00
Ming Lei
943cd69efa block: add bio_truncate to fix guard_bio_eod
[ Upstream commit 85a8ce62c2eabe28b9d76ca4eecf37922402df93 ]

Some filesystem, such as vfat, may send bio which crosses device boundary,
and the worse thing is that the IO request starting within device boundaries
can contain more than one segment past EOD.

Commit dce30ca9e3 ("fs: fix guard_bio_eod to check for real EOD errors")
tries to fix this issue by returning -EIO for this situation. However,
this way lets fs user code lose chance to handle -EIO, then sync_inodes_sb()
may hang for ever.

Also the current truncating on last segment is dangerous by updating the
last bvec, given bvec table becomes not immutable any more, and fs bio
users may not retrieve the truncated pages via bio_for_each_segment_all() in
its .end_io callback.

Fixes this issue by supporting multi-segment truncating. And the
approach is simpler:

- just update bio size since block layer can make correct bvec with
the updated bio size. Then bvec table becomes really immutable.

- zero all truncated segments for read bio

Cc: Carlos Maiolino <cmaiolino@redhat.com>
Cc: linux-fsdevel@vger.kernel.org
Fixed-by: dce30ca9e3 ("fs: fix guard_bio_eod to check for real EOD errors")
Reported-by: syzbot+2b9e54155c8c25d8d165@syzkaller.appspotmail.com
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-09 10:19:54 +01:00
Christoph Hellwig
93eab050d3 block: set the zone size in blk_revalidate_disk_zones atomically
The current zone revalidation code has a major problem in that it
doesn't update the zone size and q->nr_zones atomically, leading
to a short window where an out of bounds access to the zone arrays
is possible.

To fix this move the setting of the zone size into the crticial
sections blk_revalidate_disk_zones so that it gets updated together
with the zone bitmaps and q->nr_zones.  This also slightly simplifies
the caller as it deducts the zone size from the report_zones.

This change also allows to check for a power of two zone size in generic
code.

Reported-by: Hans Holmberg <hans@owltronix.com>
Reviewed-by: Javier González <javier@javigon.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-01-07 16:02:50 -08:00
Christoph Hellwig
43ea7a9a2d block: don't handle bio based drivers in blk_revalidate_disk_zones
bio based drivers only need to update q->nr_zones.  Do that manually
instead of overloading blk_revalidate_disk_zones to keep that function
simpler for the next round of changes that will rely even more on the
request based functionality.

Reviewed-by: Javier González <javier@javigon.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-01-07 16:02:50 -08:00
Christoph Hellwig
290fc473cc block: allocate the zone bitmaps lazily
Allocate the conventional zone bitmap and the sequential zone locking
bitmap only when we find a zone of the respective type.  This avoids
wasting memory on the conventional zone bitmap for devices that only
have sequential zones, and will also prepare for other future changes.

Reviewed-by: Javier González <javier@javigon.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-01-07 16:02:49 -08:00
Christoph Hellwig
a062da74fe block: replace seq_zones_bitmap with conv_zones_bitmap
Invert the meaning of seq_zones_bitmap by keeping a bitmap of
conventional zones.  This allows not having a bitmap for devices
that do not have conventional zones.

Reviewed-by: Javier González <javier@javigon.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-01-07 16:02:49 -08:00
Christoph Hellwig
a354b75ed5 block: simplify blkdev_nr_zones
Simplify the arguments to blkdev_nr_zones by passing a gendisk instead
of the block_device and capacity.  This also removes the need for
__blkdev_nr_zones as all callers are outside the fast path and can
deal with the additional branch.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-01-07 16:02:49 -08:00
Christoph Hellwig
9d7cf94280 block: remove the empty line at the end of blk-zoned.c
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-01-07 16:02:48 -08:00
Christoph Hellwig
202b0716c3 block: rework zone reporting
Avoid the need to allocate a potentially large array of struct blk_zone
in the block layer by switching the ->report_zones method interface to
a callback model. Now the caller simply supplies a callback that is
executed on each reported zone, and private data for it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-01-07 16:02:47 -08:00
Damien Le Moal
18cfc4d87f block: Remove partition support for zoned block devices
No known partitioning tool supports zoned block devices, especially the
host managed flavor with strong sequential write constraints.
Furthermore, there are also no known user nor use cases for partitioned
zoned block devices.

This patch removes partition device creation for zoned block devices,
which allows simplifying the processing of zone commands for zoned
block devices. A warning is added if a partition table is found on the
device.

For report zones operations no zone sector information remapping is
necessary anymore, simplifying the code. Of note is that remapping of
zone reports for DM targets is still necessary as done by
dm_remap_zone_report().

Similarly, remaping of a zone reset bio is not necessary anymore.
Testing for the applicability of the zone reset all request also becomes
simpler and only needs to check that the number of sectors of the
requested zone range is equal to the disk capacity.

Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-01-07 16:02:46 -08:00
Damien Le Moal
345c506d20 block: Simplify report zones execution
All kernel users of blkdev_report_zones() as well as applications use
through ioctl(BLKZONEREPORT) expect to potentially get less zone
descriptors than requested. As such, the use of the internal report
zones command execution loop implemented by blk_report_zones() is
not necessary and can even be harmful to performance by causing the
execution of inefficient small zones report command to service the
reminder of a requested zone array.

This patch removes blk_report_zones(), simplifying the code. Also
remove a now incorrect comment in dm_blk_report_zones().

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Javier Gonzalez <javier@javigon.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-01-07 16:02:45 -08:00
Christoph Hellwig
c193df7366 block: cleanup the !zoned case in blk_revalidate_disk_zones
blk_revalidate_disk_zones is never called for non-zoned devices.  Just
return early and warn instead of trying to handle this case.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-01-07 16:02:45 -08:00
Damien Le Moal
71cf2b3aea block: Enhance blk_revalidate_disk_zones()
For ZBC and ZAC zoned devices, the scsi driver revalidation processing
implemented by sd_revalidate_disk() includes a call to
sd_zbc_read_zones() which executes a full disk zone report used to
check that all zones of the disk are the same size. This processing is
followed by a call to blk_revalidate_disk_zones(), used to initialize
the device request queue zone bitmaps (zone type and zone write lock
bitmaps). To do so, blk_revalidate_disk_zones() also executes a full
device zone report to obtain zone types. As a result, the entire
zoned block device revalidation process includes two full device zone
report.

By moving the zone size checks into blk_revalidate_disk_zones(), this
process can be optimized to a single full device zone report, leading to
shorter device scan and revalidation times. This patch implements this
optimization, reducing the original full device zone report implemented
in sd_zbc_check_zones() to a single, small, report zones command
execution to obtain the size of the first zone of the device. Checks
whether all zones of the device are the same size as the first zone
size are moved to the generic blk_check_zone() function called from
blk_revalidate_disk_zones().

This optimization also has the following benefits:
1) fewer memory allocations in the scsi layer during disk revalidation
   as the potentailly large buffer for zone report execution is not
   needed.
2) Implement zone checks in a generic manner, reducing the burden on
   device driver which only need to obtain the zone size and check that
   this size is a power of 2 number of LBAs. Any new type of zoned
   block device will benefit from this.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-01-07 16:02:45 -08:00
Ajay Joshi
85154041a8 block: add zone open, close and finish ioctl support
Introduce three new ioctl commands BLKOPENZONE, BLKCLOSEZONE and
BLKFINISHZONE to allow applications to control the condition of zones
on a zoned block device through the execution of the REQ_OP_ZONE_OPEN,
REQ_OP_ZONE_CLOSE and REQ_OP_ZONE_FINISH operations.

Contains contributions from Matias Bjorling, Hans Holmberg,
Dmitry Fomichev, Keith Busch, Damien Le Moal and Christoph Hellwig.

Reviewed-by: Javier González <javier@javigon.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ajay Joshi <ajay.joshi@wdc.com>
Signed-off-by: Matias Bjorling <matias.bjorling@wdc.com>
Signed-off-by: Hans Holmberg <hans.holmberg@wdc.com>
Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-01-07 16:02:45 -08:00
Ajay Joshi
60793393f3 block: add zone open, close and finish operations
Zoned block devices (ZBC and ZAC devices) allow an explicit control
over the condition (state) of zones. The operations allowed are:
* Open a zone: Transition to open condition to indicate that a zone will
  actively be written
* Close a zone: Transition to closed condition to release the drive
  resources used for writing to a zone
* Finish a zone: Transition an open or closed zone to the full
  condition to prevent write operations

To enable this control for in-kernel zoned block device users, define
the new request operations REQ_OP_ZONE_OPEN, REQ_OP_ZONE_CLOSE
and REQ_OP_ZONE_FINISH as well as the generic function
blkdev_zone_mgmt() for submitting these operations on a range of zones.
This results in blkdev_reset_zones() removal and replacement with this
new zone magement function. Users of blkdev_reset_zones() (f2fs and
dm-zoned) are updated accordingly.

Contains contributions from Matias Bjorling, Hans Holmberg,
Dmitry Fomichev, Keith Busch, Damien Le Moal and Christoph Hellwig.

Reviewed-by: Javier González <javier@javigon.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ajay Joshi <ajay.joshi@wdc.com>
Signed-off-by: Matias Bjorling <matias.bjorling@wdc.com>
Signed-off-by: Hans Holmberg <hans.holmberg@wdc.com>
Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-01-07 16:02:44 -08:00
Damien Le Moal
7aa2b3379c block: Simplify REQ_OP_ZONE_RESET_ALL handling
There is no need for the function __blkdev_reset_all_zones() as
REQ_OP_ZONE_RESET_ALL can be handled directly in blkdev_reset_zones()
bio loop with an early break from the loop. This patch removes this
function and modifies blkdev_reset_zones(), simplifying the code.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-01-07 16:02:44 -08:00
Damien Le Moal
bdf770eb9c block: Remove REQ_OP_ZONE_RESET plugging
REQ_OP_ZONE_RESET operations cannot be merged as these bios and requests
do not have a size and are never sequential due to the zone start sector
position required for their execution. As a result, there is no point in
using a plug around blkdev_reset_zones() bio issuing loop. This patch
removes this unnecessary plugging.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Javier González <javier@javigon.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-01-07 16:02:44 -08:00
Greg Kroah-Hartman
861433ef01 This is the 5.4.7 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl4LbVwACgkQONu9yGCS
 aT6zdhAAkTwLWNfzyk1cSPKzWdguZWoqAuddmIeCUaDmyPwI6TE5a2J8IfZ7upYU
 4U2J4nO4I9WxVuTUgJpE0wnDidkvL6U7YfbMbqjVkxAfbFboxN8dJYDNTISehK2A
 WgpIpJadhj1M8Akxq0MLxuCMg11UJU2PP5Tc7K5aKgiVVneDodupjY8Ddksuw8SZ
 5Mus33uOjpCvtxt3GZIRgAdduhL3s3h2Vp+dyAzV2eBvSGwd9Rz4/p0OGZytH780
 oywFYzIU7CxtI7pxIQKBxegb4incjWnlRpP3Dk80CNXHzcuU6WGXARoHjgXmWYcu
 b9hX+/fM76qxbxojM1vI9QVuwy5uB++4NMVsX3e0xFxdvkTo2+Y/vbO3sBMmAy5i
 L0S0sftTuE6bg1XCWoeFbLUaXIWF7g0Xbc91VP7Wv5VolpIrwZsVHJNT4Nf8KHM4
 DuRLmrANhU7ax2E26Bbt17/otCFvjyeQj5fggw/1rkEN8fJSY1YU/SWOxizDY6GZ
 S3ovivhqhLIaDPzW+qmphYRGnBDkTq7HxHal8eJoy/cgvFxBOYAbfXiHuPuNP4Kj
 zbIThujSlbI0gNGymoHH8EoVOJeNcK8L2PsilIZdlPDWi45v5tqYIgiYIA7mqqu+
 6O2plNGWbYK2+ARPkCJ08XTdDFSm+B6Cm0+KFvsdjuQ6xNkhMwc=
 =HvEl
 -----END PGP SIGNATURE-----

Merge 5.4.7 into android-5.4

Changes in 5.4.7
	af_packet: set defaule value for tmo
	fjes: fix missed check in fjes_acpi_add
	mod_devicetable: fix PHY module format
	net: dst: Force 4-byte alignment of dst_metrics
	net: gemini: Fix memory leak in gmac_setup_txqs
	net: hisilicon: Fix a BUG trigered by wrong bytes_compl
	net: nfc: nci: fix a possible sleep-in-atomic-context bug in nci_uart_tty_receive()
	net: phy: ensure that phy IDs are correctly typed
	net: qlogic: Fix error paths in ql_alloc_large_buffers()
	net-sysfs: Call dev_hold always in rx_queue_add_kobject
	net: usb: lan78xx: Fix suspend/resume PHY register access error
	nfp: flower: fix stats id allocation
	qede: Disable hardware gro when xdp prog is installed
	qede: Fix multicast mac configuration
	sctp: fix memleak on err handling of stream initialization
	sctp: fully initialize v4 addr in some functions
	selftests: forwarding: Delete IPv6 address at the end
	neighbour: remove neigh_cleanup() method
	bonding: fix bond_neigh_init()
	net: ena: fix default tx interrupt moderation interval
	net: ena: fix issues in setting interrupt moderation params in ethtool
	dpaa2-ptp: fix double free of the ptp_qoriq IRQ
	mlxsw: spectrum_router: Remove unlikely user-triggerable warning
	net: ethernet: ti: davinci_cpdma: fix warning "device driver frees DMA memory with different size"
	net: stmmac: platform: Fix MDIO init for platforms without PHY
	net: dsa: b53: Fix egress flooding settings
	NFC: nxp-nci: Fix probing without ACPI
	btrfs: don't double lock the subvol_sem for rename exchange
	btrfs: do not call synchronize_srcu() in inode_tree_del
	Btrfs: make tree checker detect checksum items with overlapping ranges
	btrfs: return error pointer from alloc_test_extent_buffer
	Btrfs: fix missing data checksums after replaying a log tree
	btrfs: send: remove WARN_ON for readonly mount
	btrfs: abort transaction after failed inode updates in create_subvol
	btrfs: skip log replay on orphaned roots
	btrfs: do not leak reloc root if we fail to read the fs root
	btrfs: handle ENOENT in btrfs_uuid_tree_iterate
	Btrfs: fix removal logic of the tree mod log that leads to use-after-free issues
	ALSA: pcm: Avoid possible info leaks from PCM stream buffers
	ALSA: hda/ca0132 - Keep power on during processing DSP response
	ALSA: hda/ca0132 - Avoid endless loop
	ALSA: hda/ca0132 - Fix work handling in delayed HP detection
	drm/vc4/vc4_hdmi: fill in connector info
	drm/virtio: switch virtio_gpu_wait_ioctl() to gem helper.
	drm: mst: Fix query_payload ack reply struct
	drm/mipi-dbi: fix a loop in debugfs code
	drm/panel: Add missing drm_panel_init() in panel drivers
	drm: exynos: exynos_hdmi: use cec_notifier_conn_(un)register
	drm: Use EOPNOTSUPP, not ENOTSUPP
	drm/amd/display: verify stream link before link test
	drm/bridge: analogix-anx78xx: silence -EPROBE_DEFER warnings
	drm/amd/display: OTC underflow fix
	iio: max31856: add missing of_node and parent references to iio_dev
	iio: light: bh1750: Resolve compiler warning and make code more readable
	drm/amdgpu/sriov: add ring_stop before ring_create in psp v11 code
	drm/amdgpu: grab the id mgr lock while accessing passid_mapping
	drm/ttm: return -EBUSY on pipelining with no_gpu_wait (v2)
	drm/amd/display: Rebuild mapped resources after pipe split
	ath10k: add cleanup in ath10k_sta_state()
	drm/amd/display: Handle virtual signal type in disable_link()
	ath10k: Check if station exists before forwarding tx airtime report
	spi: Add call to spi_slave_abort() function when spidev driver is released
	drm/meson: vclk: use the correct G12A frac max value
	staging: rtl8192u: fix multiple memory leaks on error path
	staging: rtl8188eu: fix possible null dereference
	rtlwifi: prevent memory leak in rtl_usb_probe
	libertas: fix a potential NULL pointer dereference
	Revert "pinctrl: sh-pfc: r8a77990: Fix MOD_SEL1 bit30 when using SSI_SCK2 and SSI_WS2"
	Revert "pinctrl: sh-pfc: r8a77990: Fix MOD_SEL1 bit31 when using SIM0_D"
	ath10k: fix backtrace on coredump
	IB/iser: bound protection_sg size by data_sg size
	drm/komeda: Workaround for broken FLIP_COMPLETE timestamps
	spi: gpio: prevent memory leak in spi_gpio_probe
	media: am437x-vpfe: Setting STD to current value is not an error
	media: cedrus: fill in bus_info for media device
	media: seco-cec: Add a missing 'release_region()' in an error handling path
	media: vim2m: Fix abort issue
	media: vim2m: Fix BUG_ON in vim2m_device_release()
	media: max2175: Fix build error without CONFIG_REGMAP_I2C
	media: ov6650: Fix control handler not freed on init error
	media: i2c: ov2659: fix s_stream return value
	media: ov6650: Fix crop rectangle alignment not passed back
	media: i2c: ov2659: Fix missing 720p register config
	media: ov6650: Fix stored frame format not in sync with hardware
	media: ov6650: Fix stored crop rectangle not in sync with hardware
	tools/power/cpupower: Fix initializer override in hsw_ext_cstates
	media: venus: core: Fix msm8996 frequency table
	ath10k: fix offchannel tx failure when no ath10k_mac_tx_frm_has_freq
	media: vimc: Fix gpf in rmmod path when stream is active
	drm/amd/display: Set number of pipes to 1 if the second pipe was disabled
	pinctrl: devicetree: Avoid taking direct reference to device name string
	drm/sun4i: dsi: Fix TCON DRQ set bits
	drm/amdkfd: fix a potential NULL pointer dereference (v2)
	x86/math-emu: Check __copy_from_user() result
	drm/amd/powerplay: A workaround to GPU RESET on APU
	selftests/bpf: Correct path to include msg + path
	drm/amd/display: set minimum abm backlight level
	media: venus: Fix occasionally failures to suspend
	rtw88: fix NSS of hw_cap
	drm/amd/display: fix struct init in update_bounding_box
	usb: renesas_usbhs: add suspend event support in gadget mode
	crypto: aegis128-neon - use Clang compatible cflags for ARM
	hwrng: omap3-rom - Call clk_disable_unprepare() on exit only if not idled
	regulator: max8907: Fix the usage of uninitialized variable in max8907_regulator_probe()
	tools/memory-model: Fix data race detection for unordered store and load
	media: flexcop-usb: fix NULL-ptr deref in flexcop_usb_transfer_init()
	media: cec-funcs.h: add status_req checks
	media: meson/ao-cec: move cec_notifier_cec_adap_register after hw setup
	drm/bridge: dw-hdmi: Refuse DDC/CI transfers on the internal I2C controller
	samples: pktgen: fix proc_cmd command result check logic
	block: Fix writeback throttling W=1 compiler warnings
	drm/amdkfd: Fix MQD size calculation
	MIPS: futex: Emit Loongson3 sync workarounds within asm
	mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring
	drm/drm_vblank: Change EINVAL by the correct errno
	selftests/bpf: Fix btf_dump padding test case
	libbpf: Fix struct end padding in btf_dump
	libbpf: Fix passing uninitialized bytes to setsockopt
	net/smc: increase device refcount for added link group
	team: call RCU read lock when walking the port_list
	media: cx88: Fix some error handling path in 'cx8800_initdev()'
	crypto: inside-secure - Fix a maybe-uninitialized warning
	crypto: aegis128/simd - build 32-bit ARM for v8 architecture explicitly
	misc: fastrpc: fix memory leak from miscdev->name
	ASoC: SOF: enable sync_write in hdac_bus
	media: ti-vpe: vpe: Fix Motion Vector vpdma stride
	media: ti-vpe: vpe: fix a v4l2-compliance warning about invalid pixel format
	media: ti-vpe: vpe: fix a v4l2-compliance failure about frame sequence number
	media: ti-vpe: vpe: Make sure YUYV is set as default format
	media: ti-vpe: vpe: fix a v4l2-compliance failure causing a kernel panic
	media: ti-vpe: vpe: ensure buffers are cleaned up properly in abort cases
	drm/amd/display: Properly round nominal frequency for SPD
	drm/amd/display: wait for set pipe mcp command completion
	media: ti-vpe: vpe: fix a v4l2-compliance failure about invalid sizeimage
	drm/amd/display: add new active dongle to existent w/a
	syscalls/x86: Use the correct function type in SYSCALL_DEFINE0
	drm/amd/display: Fix dongle_caps containing stale information.
	extcon: sm5502: Reset registers during initialization
	drm/amd/display: Program DWB watermarks from correct state
	x86/mm: Use the correct function type for native_set_fixmap()
	ath10k: Correct error handling of dma_map_single()
	rtw88: coex: Set 4 slot mode for A2DP
	drm/bridge: dw-hdmi: Restore audio when setting a mode
	perf test: Report failure for mmap events
	perf report: Add warning when libunwind not compiled in
	perf test: Avoid infinite loop for task exit case
	perf vendor events arm64: Fix Hisi hip08 DDRC PMU eventname
	usb: usbfs: Suppress problematic bind and unbind uevents.
	drm/amd/powerplay: avoid disabling ECC if RAS is enabled for VEGA20
	iio: adc: max1027: Reset the device at probe time
	Bluetooth: btusb: avoid unused function warning
	Bluetooth: missed cpu_to_le16 conversion in hci_init4_req
	Bluetooth: Workaround directed advertising bug in Broadcom controllers
	Bluetooth: hci_core: fix init for HCI_USER_CHANNEL
	bpf/stackmap: Fix deadlock with rq_lock in bpf_get_stack()
	x86/mce: Lower throttling MCE messages' priority to warning
	drm/amd/display: enable hostvm based on roimmu active for dcn2.1
	drm/amd/display: fix header for RN clk mgr
	drm/amdgpu: fix amdgpu trace event print string format error
	staging: iio: ad9834: add a check for devm_clk_get
	power: supply: cpcap-battery: Check voltage before orderly_poweroff
	perf tests: Disable bp_signal testing for arm64
	selftests/bpf: Make a copy of subtest name
	net: hns3: log and clear hardware error after reset complete
	RDMA/hns: Fix wrong parameters when initial mtt of srq->idx_que
	drm/gma500: fix memory disclosures due to uninitialized bytes
	ASoC: soc-pcm: fixup dpcm_prune_paths() loop continue
	rtl8xxxu: fix RTL8723BU connection failure issue after warm reboot
	RDMA/siw: Fix SQ/RQ drain logic
	ipmi: Don't allow device module unload when in use
	x86/ioapic: Prevent inconsistent state when moving an interrupt
	media: cedrus: Fix undefined shift with a SHIFT_AND_MASK_BITS macro
	media: aspeed: set hsync and vsync polarities to normal before starting mode detection
	drm/nouveau: Don't grab runtime PM refs for HPD IRQs
	media: ov6650: Fix stored frame interval not in sync with hardware
	media: ad5820: Define entity function
	media: ov5640: Make 2592x1944 mode only available at 15 fps
	media: st-mipid02: add a check for devm_gpiod_get_optional
	media: imx7-mipi-csis: Add a check for devm_regulator_get
	media: aspeed: clear garbage interrupts
	media: smiapp: Register sensor after enabling runtime PM on the device
	md: no longer compare spare disk superblock events in super_load
	staging: wilc1000: potential corruption in wilc_parse_join_bss_param()
	md/bitmap: avoid race window between md_bitmap_resize and bitmap_file_clear_bit
	drm: Don't free jobs in wait_event_interruptible()
	EDAC/amd64: Set grain per DIMM
	arm64: psci: Reduce the waiting time for cpu_psci_cpu_kill()
	drm/amd/display: setting the DIG_MODE to the correct value.
	i40e: initialize ITRN registers with correct values
	drm/amd/display: correctly populate dpp refclk in fpga
	i40e: Wrong 'Advertised FEC modes' after set FEC to AUTO
	net: phy: dp83867: enable robust auto-mdix
	drm/tegra: sor: Use correct SOR index on Tegra210
	regulator: core: Release coupled_rdevs on regulator_init_coupling() error
	ubsan, x86: Annotate and allow __ubsan_handle_shift_out_of_bounds() in uaccess regions
	spi: sprd: adi: Add missing lock protection when rebooting
	ACPI: button: Add DMI quirk for Medion Akoya E2215T
	RDMA/qedr: Fix memory leak in user qp and mr
	RDMA/hns: Fix memory leak on 'context' on error return path
	RDMA/qedr: Fix srqs xarray initialization
	RDMA/core: Set DMA parameters correctly
	staging: wilc1000: check if device is initialzied before changing vif
	gpu: host1x: Allocate gather copy for host1x
	net: dsa: LAN9303: select REGMAP when LAN9303 enable
	phy: renesas: phy-rcar-gen2: Fix the array off by one warning
	phy: qcom-usb-hs: Fix extcon double register after power cycle
	s390/time: ensure get_clock_monotonic() returns monotonic values
	s390: add error handling to perf_callchain_kernel
	s390/mm: add mm_pxd_folded() checks to pxd_free()
	net: hns3: add struct netdev_queue debug info for TX timeout
	libata: Ensure ata_port probe has completed before detach
	loop: fix no-unmap write-zeroes request behavior
	net/mlx5e: Verify that rule has at least one fwd/drop action
	pinctrl: sh-pfc: sh7734: Fix duplicate TCLK1_B
	ALSA: bebob: expand sleep just after breaking connections for protocol version 1
	iio: dln2-adc: fix iio_triggered_buffer_postenable() position
	libbpf: Fix error handling in bpf_map__reuse_fd()
	Bluetooth: Fix advertising duplicated flags
	ALSA: pcm: Fix missing check of the new non-cached buffer type
	spi: sifive: disable clk when probe fails and remove
	ASoC: SOF: imx: fix reverse CONFIG_SND_SOC_SOF_OF dependency
	pinctrl: qcom: sc7180: Add missing tile info in SDC_QDSD_PINGROUP/UFS_RESET
	pinctrl: amd: fix __iomem annotation in amd_gpio_irq_handler()
	ixgbe: protect TX timestamping from API misuse
	cpufreq: sun50i: Fix CPU speed bin detection
	media: rcar_drif: fix a memory disclosure
	media: v4l2-core: fix touch support in v4l_g_fmt
	nvme: introduce "Command Aborted By host" status code
	media: staging/imx: Use a shorter name for driver
	nvmem: imx-ocotp: reset error status on probe
	nvmem: core: fix nvmem_cell_write inline function
	ASoC: SOF: topology: set trigger order for FE DAI link
	media: vivid: media_device_cleanup was called too early
	spi: dw: Fix Designware SPI loopback
	bnx2x: Fix PF-VF communication over multi-cos queues.
	spi: img-spfi: fix potential double release
	ALSA: timer: Limit max amount of slave instances
	RDMA/core: Fix return code when modify_port isn't supported
	drm: msm: a6xx: fix debug bus register configuration
	rtlwifi: fix memory leak in rtl92c_set_fw_rsvdpagepkt()
	perf probe: Fix to find range-only function instance
	perf cs-etm: Fix definition of macro TO_CS_QUEUE_NR
	perf probe: Fix to list probe event with correct line number
	perf jevents: Fix resource leak in process_mapfile() and main()
	perf probe: Walk function lines in lexical blocks
	perf probe: Fix to probe an inline function which has no entry pc
	perf probe: Fix to show ranges of variables in functions without entry_pc
	perf probe: Fix to show inlined function callsite without entry_pc
	libsubcmd: Use -O0 with DEBUG=1
	perf probe: Fix to probe a function which has no entry pc
	perf tools: Fix cross compile for ARM64
	perf tools: Splice events onto evlist even on error
	drm/amdgpu: disallow direct upload save restore list from gfx driver
	drm/amd/powerplay: fix struct init in renoir_print_clk_levels
	drm/amdgpu: fix potential double drop fence reference
	ice: Check for null pointer dereference when setting rings
	xen/gntdev: Use select for DMA_SHARED_BUFFER
	perf parse: If pmu configuration fails free terms
	perf probe: Skip overlapped location on searching variables
	net: avoid potential false sharing in neighbor related code
	perf probe: Return a better scope DIE if there is no best scope
	perf probe: Fix to show calling lines of inlined functions
	perf probe: Skip end-of-sequence and non statement lines
	perf probe: Filter out instances except for inlined subroutine and subprogram
	libbpf: Fix negative FD close() in xsk_setup_xdp_prog()
	s390/bpf: Use kvcalloc for addrs array
	cgroup: freezer: don't change task and cgroups status unnecessarily
	selftests: proc: Make va_max 1MB
	drm/amdgpu: Avoid accidental thread reactivation.
	media: exynos4-is: fix wrong mdev and v4l2 dev order in error path
	ath10k: fix get invalid tx rate for Mesh metric
	fsi: core: Fix small accesses and unaligned offsets via sysfs
	selftests: net: Fix printf format warnings on arm
	media: pvrusb2: Fix oops on tear-down when radio support is not present
	soundwire: intel: fix PDI/stream mapping for Bulk
	crypto: atmel - Fix authenc support when it is set to m
	ice: delay less
	media: si470x-i2c: add missed operations in remove
	media: cedrus: Use helpers to access capture queue
	media: v4l2-ctrl: Lock main_hdl on operations of requests_queued.
	iio: cros_ec_baro: set info_mask_shared_by_all_available field
	EDAC/ghes: Fix grain calculation
	media: vicodec: media_device_cleanup was called too early
	media: vim2m: media_device_cleanup was called too early
	spi: pxa2xx: Add missed security checks
	ASoC: rt5677: Mark reg RT5677_PWR_ANLG2 as volatile
	iio: dac: ad5446: Add support for new AD5600 DAC
	bpf, testing: Workaround a verifier failure for test_progs
	ASoC: Intel: kbl_rt5663_rt5514_max98927: Add dmic format constraint
	net: dsa: sja1105: Disallow management xmit during switch reset
	r8169: respect EEE user setting when restarting network
	s390/disassembler: don't hide instruction addresses
	net: ethernet: ti: Add dependency for TI_DAVINCI_EMAC
	nvme: Discard workaround for non-conformant devices
	parport: load lowlevel driver if ports not found
	bcache: fix static checker warning in bcache_device_free()
	cpufreq: Register drivers only after CPU devices have been registered
	qtnfmac: fix debugfs support for multiple cards
	qtnfmac: fix invalid channel information output
	x86/crash: Add a forward declaration of struct kimage
	qtnfmac: fix using skb after free
	RDMA/efa: Clear the admin command buffer prior to its submission
	tracing: use kvcalloc for tgid_map array allocation
	MIPS: ralink: enable PCI support only if driver for mt7621 SoC is selected
	tracing/kprobe: Check whether the non-suffixed symbol is notrace
	bcache: fix deadlock in bcache_allocator
	iwlwifi: mvm: fix unaligned read of rx_pkt_status
	ASoC: wm8904: fix regcache handling
	regulator: core: Let boot-on regulators be powered off
	spi: tegra20-slink: add missed clk_unprepare
	tun: fix data-race in gro_normal_list()
	xhci-pci: Allow host runtime PM as default also for Intel Ice Lake xHCI
	crypto: virtio - deal with unsupported input sizes
	mmc: tmio: Add MMC_CAP_ERASE to allow erase/discard/trim requests
	btrfs: don't prematurely free work in end_workqueue_fn()
	btrfs: don't prematurely free work in run_ordered_work()
	sched/uclamp: Fix overzealous type replacement
	ASoC: wm2200: add missed operations in remove and probe failure
	spi: st-ssc4: add missed pm_runtime_disable
	ASoC: wm5100: add missed pm_runtime_disable
	perf/core: Fix the mlock accounting, again
	selftests, bpf: Fix test_tc_tunnel hanging
	selftests, bpf: Workaround an alu32 sub-register spilling issue
	bnxt_en: Return proper error code for non-existent NVM variable
	net: phy: avoid matching all-ones clause 45 PHY IDs
	firmware_loader: Fix labels with comma for builtin firmware
	ASoC: Intel: bytcr_rt5640: Update quirk for Acer Switch 10 SW5-012 2-in-1
	x86/insn: Add some Intel instructions to the opcode map
	net-af_xdp: Use correct number of channels from ethtool
	brcmfmac: remove monitor interface when detaching
	perf session: Fix decompression of PERF_RECORD_COMPRESSED records
	perf probe: Fix to show function entry line as probe-able
	s390/crypto: Fix unsigned variable compared with zero
	s390/kasan: support memcpy_real with TRACE_IRQFLAGS
	bnxt_en: Improve RX buffer error handling.
	iwlwifi: check kasprintf() return value
	fbtft: Make sure string is NULL terminated
	ASoC: soc-pcm: check symmetry before hw_params
	net: ethernet: ti: ale: clean ale tbl on init and intf restart
	mt76: fix possible out-of-bound access in mt7615_fill_txs/mt7603_fill_txs
	s390/cpumf: Adjust registration of s390 PMU device drivers
	crypto: sun4i-ss - Fix 64-bit size_t warnings
	crypto: sun4i-ss - Fix 64-bit size_t warnings on sun4i-ss-hash.c
	mac80211: consider QoS Null frames for STA_NULLFUNC_ACKED
	crypto: vmx - Avoid weird build failures
	libtraceevent: Fix memory leakage in copy_filter_type
	mips: fix build when "48 bits virtual memory" is enabled
	drm/amdgpu: fix bad DMA from INTERRUPT_CNTL2
	ice: Only disable VF state when freeing each VF resources
	ice: Fix setting coalesce to handle DCB configuration
	net: phy: initialise phydev speed and duplex sanely
	tools, bpf: Fix build for 'make -s tools/bpf O=<dir>'
	RDMA/bnxt_re: Fix missing le16_to_cpu
	RDMA/bnxt_re: Fix stat push into dma buffer on gen p5 devices
	bpf: Provide better register bounds after jmp32 instructions
	RDMA/bnxt_re: Fix chip number validation Broadcom's Gen P5 series
	ibmvnic: Fix completion structure initialization
	net: wireless: intel: iwlwifi: fix GRO_NORMAL packet stalling
	MIPS: futex: Restore \n after sync instructions
	btrfs: don't prematurely free work in reada_start_machine_worker()
	btrfs: don't prematurely free work in scrub_missing_raid56_worker()
	Revert "mmc: sdhci: Fix incorrect switch to HS mode"
	mmc: mediatek: fix CMD_TA to 2 for MT8173 HS200/HS400 mode
	tpm_tis: reserve chip for duration of tpm_tis_core_init
	tpm: fix invalid locking in NONBLOCKING mode
	iommu: fix KASAN use-after-free in iommu_insert_resv_region
	iommu: set group default domain before creating direct mappings
	iommu/vt-d: Fix dmar pte read access not set error
	iommu/vt-d: Set ISA bridge reserved region as relaxable
	iommu/vt-d: Allocate reserved region for ISA with correct permission
	can: xilinx_can: Fix missing Rx can packets on CANFD2.0
	can: m_can: tcan4x5x: add required delay after reset
	can: j1939: j1939_sk_bind(): take priv after lock is held
	can: flexcan: fix possible deadlock and out-of-order reception after wakeup
	can: flexcan: poll MCR_LPM_ACK instead of GPR ACK for stop mode acknowledgment
	can: kvaser_usb: kvaser_usb_leaf: Fix some info-leaks to USB devices
	selftests: net: tls: remove recv_rcvbuf test
	spi: dw: Correct handling of native chipselect
	spi: cadence: Correct handling of native chipselect
	usb: xhci: Fix build warning seen with CONFIG_PM=n
	drm/amdgpu: fix uninitialized variable pasid_mapping_needed
	ath10k: Revert "ath10k: add cleanup in ath10k_sta_state()"
	RDMA/siw: Fix post_recv QP state locking
	md: avoid invalid memory access for array sb->dev_roles
	s390/ftrace: fix endless recursion in function_graph tracer
	ARM: dts: Fix vcsi regulator to be always-on for droid4 to prevent hangs
	can: flexcan: add low power enter/exit acknowledgment helper
	usbip: Fix receive error in vhci-hcd when using scatter-gather
	usbip: Fix error path of vhci_recv_ret_submit()
	spi: fsl: don't map irq during probe
	spi: fsl: use platform_get_irq() instead of of_irq_to_resource()
	efi/memreserve: Register reservations as 'reserved' in /proc/iomem
	cpufreq: Avoid leaving stale IRQ work items during CPU offline
	KEYS: asymmetric: return ENOMEM if akcipher_request_alloc() fails
	mm: vmscan: protect shrinker idr replace with CONFIG_MEMCG
	USB: EHCI: Do not return -EPIPE when hub is disconnected
	intel_th: pci: Add Comet Lake PCH-V support
	intel_th: pci: Add Elkhart Lake SOC support
	intel_th: Fix freeing IRQs
	intel_th: msu: Fix window switching without windows
	platform/x86: hp-wmi: Make buffer for HPWMI_FEATURE2_QUERY 128 bytes
	staging: comedi: gsc_hpdi: check dma_alloc_coherent() return value
	tty/serial: atmel: fix out of range clock divider handling
	serial: sprd: Add clearing break interrupt operation
	pinctrl: baytrail: Really serialize all register accesses
	clk: imx: clk-imx7ulp: Add missing sentinel of ulp_div_table
	clk: imx: clk-composite-8m: add lock to gate/mux
	clk: imx: pll14xx: fix clk_pll14xx_wait_lock
	ext4: fix ext4_empty_dir() for directories with holes
	ext4: check for directory entries too close to block end
	ext4: unlock on error in ext4_expand_extra_isize()
	ext4: validate the debug_want_extra_isize mount option at parse time
	iocost: over-budget forced IOs should schedule async delay
	KVM: PPC: Book3S HV: Fix regression on big endian hosts
	kvm: x86: Host feature SSBD doesn't imply guest feature SPEC_CTRL_SSBD
	kvm: x86: Host feature SSBD doesn't imply guest feature AMD_SSBD
	KVM: arm/arm64: Properly handle faulting of device mappings
	KVM: arm64: Ensure 'params' is initialised when looking up sys register
	x86/intel: Disable HPET on Intel Coffee Lake H platforms
	x86/MCE/AMD: Do not use rdmsr_safe_on_cpu() in smca_configure()
	x86/MCE/AMD: Allow Reserved types to be overwritten in smca_banks[]
	x86/mce: Fix possibly incorrect severity calculation on AMD
	powerpc/vcpu: Assume dedicated processors as non-preempt
	powerpc/irq: fix stack overflow verification
	ocxl: Fix concurrent AFU open and device removal
	mmc: sdhci-msm: Correct the offset and value for DDR_CONFIG register
	mmc: sdhci-of-esdhc: Revert "mmc: sdhci-of-esdhc: add erratum A-009204 support"
	mmc: sdhci: Update the tuning failed messages to pr_debug level
	mmc: sdhci-of-esdhc: fix P2020 errata handling
	mmc: sdhci: Workaround broken command queuing on Intel GLK
	mmc: sdhci: Add a quirk for broken command queuing
	nbd: fix shutdown and recv work deadlock v2
	iwlwifi: pcie: move power gating workaround earlier in the flow
	Linux 5.4.7

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I3585238149235bf73bb453e25861d9a6b9193dfa
2019-12-31 17:56:13 +01:00
Tejun Heo
377a8744c3 iocost: over-budget forced IOs should schedule async delay
commit d7bd15a138aef3be227818aad9c501e43c89c8c5 upstream.

When over-budget IOs are force-issued through root cgroup,
iocg_kick_delay() adjusts the async delay accordingly but doesn't
actually schedule async throttle for the issuing task.  This bug is
pretty well masked because sooner or later the offending threads are
gonna get directly throttled on regular IOs or have async delay
scheduled by mem_cgroup_throttle_swaprate().

However, it can affect control quality on filesystem metadata heavy
operations.  Let's fix it by invoking blkcg_schedule_throttle() when
iocg_kick_delay() says async delay is needed.

Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: 7caa47151a ("blkcg: implement blk-iocost")
Cc: stable@vger.kernel.org
Reported-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-31 16:46:19 +01:00
Greg Kroah-Hartman
63dd580f09 This is the 5.4.6 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl397mMACgkQONu9yGCS
 aT4pqxAAu5o3/xNNdKcfR6GkobAEHq/62MuBpQmqt3Ii8G9JSleASQmsYyZZVHI6
 JiMrmWiULJ1T2R8lUz8Li2PumIvmPSaW6H9VjiaaGz6U8XSJZzrxhgdNkibz4uzJ
 JhNaikLo4mWz3p/O7OkvFoHjMGmgc3m2rjuukMOUokQCQFYMrKms8FjFzKHk/87H
 RfvIHtwcvL6aVv3BzHXC8od3mC69uE56+zdB9lBYPeH38EjShtcd58jsnLYusSnM
 BqFChcYqHC5WHZ8WfWcLmcmgkaKotoxzhgX/YUpXo1pScfxht3rHqE0h/XB/aPFR
 U8V7gT1af0cbumB7bHDKje7ROyPQUoxrrsZtYYct0DS831sAFTfiTac4NlyElnIv
 PgknutRdK3FwD+GjI5BCHveGyiucKQhet+qTglzg8J942PQjdy7Bl8tIV2smqHrA
 0/I66jcusr1G7leD/QjAc8Sli6tX9LJslW/SJXlgdxdfQ9bptRnl8aOfh3ZQILOS
 lqCm297APCi4bVS4YFrLg6kc+FPMtAW7+oIXarbhNtxgW1P9vuNOhS0c7qRH/51i
 j6WPjqfJA0itcKI3bZUlaZR6kzKhkgTnvy6phIxMpaQxdkNh+vuBvLzK/dP9o0Hv
 sgZ+fcAZjqzAKjOFJ1kXBNv9AN2mGKN9cw+6zvngcybMv9aKUWk=
 =V0vt
 -----END PGP SIGNATURE-----

Merge 5.4.6 into android-5.4

Changes in 5.4.6
	USB: Fix incorrect DMA allocations for local memory pool drivers
	mmc: block: Make card_busy_detect() a bit more generic
	mmc: block: Add CMD13 polling for MMC IOCTLS with R1B response
	mmc: core: Drop check for mmc_card_is_removable() in mmc_rescan()
	mmc: core: Re-work HW reset for SDIO cards
	PCI/switchtec: Read all 64 bits of part_event_bitmap
	PCI/PM: Always return devices to D0 when thawing
	PCI: pciehp: Avoid returning prematurely from sysfs requests
	PCI: Fix Intel ACS quirk UPDCR register address
	PCI/MSI: Fix incorrect MSI-X masking on resume
	PCI: Do not use bus number zero from EA capability
	PCI: rcar: Fix missing MACCTLR register setting in initialization sequence
	PCI: Apply Cavium ACS quirk to ThunderX2 and ThunderX3
	PM / QoS: Redefine FREQ_QOS_MAX_DEFAULT_VALUE to S32_MAX
	block: fix "check bi_size overflow before merge"
	xtensa: use MEMBLOCK_ALLOC_ANYWHERE for KASAN shadow map
	gfs2: Multi-block allocations in gfs2_page_mkwrite
	gfs2: fix glock reference problem in gfs2_trans_remove_revoke
	xtensa: fix TLB sanity checker
	xtensa: fix syscall_set_return_value
	rpmsg: glink: Set tail pointer to 0 at end of FIFO
	rpmsg: glink: Fix reuse intents memory leak issue
	rpmsg: glink: Fix use after free in open_ack TIMEOUT case
	rpmsg: glink: Put an extra reference during cleanup
	rpmsg: glink: Fix rpmsg_register_device err handling
	rpmsg: glink: Don't send pending rx_done during remove
	rpmsg: glink: Free pending deferred work on remove
	cifs: smbd: Return -EAGAIN when transport is reconnecting
	cifs: smbd: Only queue work for error recovery on memory registration
	cifs: smbd: Add messages on RDMA session destroy and reconnection
	cifs: smbd: Return -EINVAL when the number of iovs exceeds SMBDIRECT_MAX_SGE
	cifs: smbd: Return -ECONNABORTED when trasnport is not in connected state
	cifs: Don't display RDMA transport on reconnect
	CIFS: Respect O_SYNC and O_DIRECT flags during reconnect
	CIFS: Close open handle after interrupted close
	CIFS: Do not miss cancelled OPEN responses
	CIFS: Fix NULL pointer dereference in mid callback
	cifs: Fix retrieval of DFS referrals in cifs_mount()
	ARM: dts: s3c64xx: Fix init order of clock providers
	ARM: tegra: Fix FLOW_CTLR_HALT register clobbering by tegra_resume()
	vfio/pci: call irq_bypass_unregister_producer() before freeing irq
	dma-buf: Fix memory leak in sync_file_merge()
	drm/panfrost: Fix a race in panfrost_ioctl_madvise()
	drm/panfrost: Fix a BO leak in panfrost_ioctl_mmap_bo()
	drm/panfrost: Fix a race in panfrost_gem_free_object()
	drm/mgag200: Extract device type from flags
	drm/mgag200: Store flags from PCI driver data in device structure
	drm/mgag200: Add workaround for HW that does not support 'startadd'
	drm/mgag200: Flag all G200 SE A machines as broken wrt <startadd>
	drm: meson: venc: cvbs: fix CVBS mode matching
	dm mpath: remove harmful bio-based optimization
	dm btree: increase rebalance threshold in __rebalance2()
	dm clone metadata: Track exact changes per transaction
	dm clone metadata: Use a two phase commit
	dm clone: Flush destination device before committing metadata
	dm thin metadata: Add support for a pre-commit callback
	dm thin: Flush data device before committing metadata
	scsi: ufs: Disable autohibern8 feature in Cadence UFS
	scsi: iscsi: Fix a potential deadlock in the timeout handler
	scsi: qla2xxx: Ignore NULL pointer in tcm_qla2xxx_free_mcmd
	scsi: qla2xxx: Initialize free_work before flushing it
	scsi: qla2xxx: Added support for MPI and PEP regions for ISP28XX
	scsi: qla2xxx: Change discovery state before PLOGI
	scsi: qla2xxx: Correctly retrieve and interpret active flash region
	scsi: qla2xxx: Fix incorrect SFUB length used for Secure Flash Update MB Cmd
	drm/nouveau/kms/nv50-: Call outp_atomic_check_view() before handling PBN
	drm/nouveau/kms/nv50-: Store the bpc we're using in nv50_head_atom
	drm/nouveau/kms/nv50-: Limit MST BPC to 8
	drm/i915/fbc: Disable fbc by default on all glk+
	drm/radeon: fix r1xx/r2xx register checker for POT textures
	drm/dp_mst: Correct the bug in drm_dp_update_payload_part1()
	drm/amd/display: re-enable wait in pipelock, but add timeout
	drm/amd/display: add default clocks if not able to fetch them
	drm/amdgpu: initialize vm_inv_eng0_sem for gfxhub and mmhub
	drm/amdgpu: invalidate mmhub semaphore workaround in gmc9/gmc10
	drm/amdgpu/gfx10: explicitly wait for cp idle after halt/unhalt
	drm/amdgpu/gfx10: re-init clear state buffer after gpu reset
	drm/i915/gvt: Fix cmd length check for MI_ATOMIC
	drm/amdgpu: avoid using invalidate semaphore for picasso
	drm/amdgpu: add invalidate semaphore limit for SRIOV and picasso in gmc9
	ALSA: hda: Fix regression by strip mask fix
	Linux 5.4.6

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ieb34254e2c00cee10d0012aaaf8fef323280c04f
2019-12-21 11:19:45 +01:00
Andreas Gruenbacher
06ad673b6c block: fix "check bi_size overflow before merge"
commit cc90bc68422318eb8e75b15cd74bc8d538a7df29 upstream.

This partially reverts commit e3a5d8e386.

Commit e3a5d8e386 ("check bi_size overflow before merge") adds a bio_full
check to __bio_try_merge_page.  This will cause __bio_try_merge_page to fail
when the last bi_io_vec has been reached.  Instead, what we want here is only
the bi_size overflow check.

Fixes: e3a5d8e386 ("block: check bi_size overflow before merge")
Cc: stable@vger.kernel.org # v5.4+
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-21 11:04:32 +01:00
Greg Kroah-Hartman
7dc1159904 This is the 5.4.4 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl35Ju4ACgkQONu9yGCS
 aT7IMQ//Vs+kE7VCDeHfzNu4ivh3+X0bleYWo/OPxNQRFx7IL4Lb2jVjWrMnAGld
 u8H31nVaL28bhJAcQJg+O/OD3AXWQ8nzRKixfVfwd669Zv1ggaLM8MW9xuTBwmQs
 ciFrQ4GirfjvUP0VdkpsSLp+bbi61nkqGB4WHgX3gL+8LWxtpE8nFlh+8P+3TT9Z
 h4BuYQHhGF8JyhOFKhfWbWAFUoHLsR7Aa7TPOeQPXGfzWBaSfISA/UVo6N7QGpVw
 4DP5rc4Wb+tzNAJHkkgzbSDzuM6L6BHrO3SQCisd0Viw9XYO9M0U9NVbExtu9x9l
 M/sqE61cX1AxUmjstdgca37vyHCntJ+wMT7WRnOBVJfodZDjB/6wzPz8rWIZrSX+
 +uXSJF8Xpp5FuvB0td0CQoyUsnrMDnwWbjnMnlVXY6mPcgD5fgB9dTDJN3FEQ8t6
 MixN3JBy1KseY9ihe9cINaR0CBKqyogOwbGrqqw3XJNWzpJ5xgxhLuSc2PyuDLwZ
 bDaj7K9Ukx4n0QzXWvW5pZTQi+yNVc7DUVOKFDXTf2xR2/KvEVNW25gL7oBxrTTu
 q5gw4bBkO0KsbgofTMWUyUfO3aYhDqc7H4yfRRbc/Q08hiJHORFC2jhLXG9oubNN
 QrZ4AxJvzRSYl5vwrVpHW9vnlPe5SuJvRbkMN8164togc9BMNbc=
 =qUmE
 -----END PGP SIGNATURE-----

Merge 5.4.4 into android-5.4

Changes in 5.4.4
	usb: gadget: configfs: Fix missing spin_lock_init()
	usb: gadget: pch_udc: fix use after free
	nvme: Namepace identification descriptor list is optional
	Revert "nvme: Add quirk for Kingston NVME SSD running FW E8FK11.T"
	scsi: lpfc: Fix bad ndlp ptr in xri aborted handling
	scsi: zfcp: trace channel log even for FCP command responses
	scsi: qla2xxx: Do command completion on abort timeout
	scsi: qla2xxx: Fix driver unload hang
	scsi: qla2xxx: Fix double scsi_done for abort path
	scsi: qla2xxx: Fix memory leak when sending I/O fails
	compat_ioctl: add compat_ptr_ioctl()
	ceph: fix compat_ioctl for ceph_dir_operations
	media: venus: remove invalid compat_ioctl32 handler
	USB: uas: honor flag to avoid CAPACITY16
	USB: uas: heed CAPACITY_HEURISTICS
	USB: documentation: flags on usb-storage versus UAS
	usb: Allow USB device to be warm reset in suspended state
	usb: host: xhci-tegra: Correct phy enable sequence
	binder: fix incorrect calculation for num_valid
	staging: exfat: fix multiple definition error of `rename_file'
	staging: rtl8188eu: fix interface sanity check
	staging: rtl8712: fix interface sanity check
	staging: vchiq: call unregister_chrdev_region() when driver registration fails
	staging: gigaset: fix general protection fault on probe
	staging: gigaset: fix illegal free on probe errors
	staging: gigaset: add endpoint-type sanity check
	usb: xhci: only set D3hot for pci device
	xhci: Fix memory leak in xhci_add_in_port()
	xhci: fix USB3 device initiated resume race with roothub autosuspend
	xhci: Increase STS_HALT timeout in xhci_suspend()
	xhci: handle some XHCI_TRUST_TX_LENGTH quirks cases as default behaviour.
	xhci: make sure interrupts are restored to correct state
	interconnect: qcom: sdm845: Walk the list safely on node removal
	interconnect: qcom: qcs404: Walk the list safely on node removal
	usb: common: usb-conn-gpio: Don't log an error on probe deferral
	ARM: dts: pandora-common: define wl1251 as child node of mmc3
	iio: adis16480: Add debugfs_reg_access entry
	iio: imu: st_lsm6dsx: fix ODR check in st_lsm6dsx_write_raw
	iio: adis16480: Fix scales factors
	iio: humidity: hdc100x: fix IIO_HUMIDITYRELATIVE channel reporting
	iio: imu: inv_mpu6050: fix temperature reporting using bad unit
	iio: adc: ad7606: fix reading unnecessary data from device
	iio: adc: ad7124: Enable internal reference
	USB: atm: ueagle-atm: add missing endpoint check
	USB: idmouse: fix interface sanity checks
	USB: serial: io_edgeport: fix epic endpoint lookup
	usb: roles: fix a potential use after free
	USB: adutux: fix interface sanity check
	usb: core: urb: fix URB structure initialization function
	usb: mon: Fix a deadlock in usbmon between mmap and read
	tpm: add check after commands attribs tab allocation
	tpm: Switch to platform_get_irq_optional()
	EDAC/altera: Use fast register IO for S10 IRQs
	brcmfmac: disable PCIe interrupts before bus reset
	mtd: spear_smi: Fix Write Burst mode
	mtd: rawnand: Change calculating of position page containing BBM
	virt_wifi: fix use-after-free in virt_wifi_newlink()
	virtio-balloon: fix managed page counts when migrating pages between zones
	usb: dwc3: pci: add ID for the Intel Comet Lake -H variant
	usb: dwc3: gadget: Fix logical condition
	usb: dwc3: gadget: Clear started flag for non-IOC
	usb: dwc3: ep0: Clear started flag on completion
	phy: renesas: rcar-gen3-usb2: Fix sysfs interface of "role"
	usb: typec: fix use after free in typec_register_port()
	iwlwifi: pcie: fix support for transmitting SKBs with fraglist
	btrfs: check page->mapping when loading free space cache
	btrfs: use btrfs_block_group_cache_done in update_block_group
	btrfs: use refcount_inc_not_zero in kill_all_nodes
	Btrfs: fix metadata space leak on fixup worker failure to set range as delalloc
	Btrfs: fix negative subv_writers counter and data space leak after buffered write
	btrfs: Avoid getting stuck during cyclic writebacks
	btrfs: Remove btrfs_bio::flags member
	Btrfs: send, skip backreference walking for extents with many references
	btrfs: record all roots for rename exchange on a subvol
	rtlwifi: rtl8192de: Fix missing code to retrieve RX buffer address
	rtlwifi: rtl8192de: Fix missing callback that tests for hw release of buffer
	rtlwifi: rtl8192de: Fix missing enable interrupt flag
	lib: raid6: fix awk build warnings
	ovl: fix lookup failure on multi lower squashfs
	ovl: fix corner case of non-unique st_dev;st_ino
	ovl: relax WARN_ON() on rename to self
	hwrng: omap - Fix RNG wait loop timeout
	dm writecache: handle REQ_FUA
	dm zoned: reduce overhead of backing device checks
	workqueue: Fix spurious sanity check failures in destroy_workqueue()
	workqueue: Fix pwq ref leak in rescuer_thread()
	ASoC: rt5645: Fixed buddy jack support.
	ASoC: rt5645: Fixed typo for buddy jack support.
	ASoC: Jack: Fix NULL pointer dereference in snd_soc_jack_report
	ASoC: fsl_audmix: Add spin lock to protect tdms
	md: improve handling of bio with REQ_PREFLUSH in md_flush_request()
	blk-mq: avoid sysfs buffer overflow with too many CPU cores
	cgroup: pids: use atomic64_t for pids->limit
	wil6210: check len before memcpy() calls
	ar5523: check NULL before memcpy() in ar5523_cmd()
	s390/mm: properly clear _PAGE_NOEXEC bit when it is not supported
	media: hantro: Fix s_fmt for dynamic resolution changes
	media: hantro: Fix motion vectors usage condition
	media: hantro: Fix picture order count table enable
	media: vimc: sen: remove unused kthread_sen field
	media: bdisp: fix memleak on release
	media: radio: wl1273: fix interrupt masking on release
	media: cec.h: CEC_OP_REC_FLAG_ values were swapped
	cpuidle: Do not unset the driver if it is there already
	cpuidle: teo: Ignore disabled idle states that are too deep
	cpuidle: teo: Rename local variable in teo_select()
	cpuidle: teo: Consider hits and misses metrics of disabled states
	cpuidle: teo: Fix "early hits" handling for disabled idle states
	cpuidle: use first valid target residency as poll time
	erofs: zero out when listxattr is called with no xattr
	perf tests: Fix out of bounds memory access
	drm/panfrost: Open/close the perfcnt BO
	powerpc/perf: Disable trace_imc pmu
	intel_th: Fix a double put_device() in error path
	intel_th: pci: Add Ice Lake CPU support
	intel_th: pci: Add Tiger Lake CPU support
	PM / devfreq: Lock devfreq in trans_stat_show
	cpufreq: powernv: fix stack bloat and hard limit on number of CPUs
	ALSA: fireface: fix return value in error path of isochronous resources reservation
	ALSA: oxfw: fix return value in error path of isochronous resources reservation
	ALSA: hda/realtek - Line-out jack doesn't work on a Dell AIO
	ACPI / utils: Move acpi_dev_get_first_match_dev() under CONFIG_ACPI
	ACPI: LPSS: Add LNXVIDEO -> BYT I2C7 to lpss_device_links
	ACPI: LPSS: Add LNXVIDEO -> BYT I2C1 to lpss_device_links
	ACPI: LPSS: Add dmi quirk for skipping _DEP check for some device-links
	ACPI / hotplug / PCI: Allocate resources directly under the non-hotplug bridge
	ACPI: OSL: only free map once in osl.c
	ACPI: bus: Fix NULL pointer check in acpi_bus_get_private_data()
	ACPI: EC: Rework flushing of pending work
	ACPI: PM: Avoid attaching ACPI PM domain to certain devices
	pinctrl: rza2: Fix gpio name typos
	pinctrl: armada-37xx: Fix irq mask access in armada_37xx_irq_set_type()
	pinctrl: samsung: Add of_node_put() before return in error path
	pinctrl: samsung: Fix device node refcount leaks in Exynos wakeup controller init
	pinctrl: samsung: Fix device node refcount leaks in S3C24xx wakeup controller init
	pinctrl: samsung: Fix device node refcount leaks in init code
	pinctrl: samsung: Fix device node refcount leaks in S3C64xx wakeup controller init
	mmc: host: omap_hsmmc: add code for special init of wl1251 to get rid of pandora_wl1251_init_card
	ARM: dts: omap3-tao3530: Fix incorrect MMC card detection GPIO polarity
	RDMA/core: Fix ib_dma_max_seg_size()
	ppdev: fix PPGETTIME/PPSETTIME ioctls
	stm class: Lose the protocol driver when dropping its reference
	coresight: Serialize enabling/disabling a link device.
	powerpc: Allow 64bit VDSO __kernel_sync_dicache to work across ranges >4GB
	powerpc/xive: Prevent page fault issues in the machine crash handler
	powerpc: Allow flush_icache_range to work across ranges >4GB
	powerpc/xive: Skip ioremap() of ESB pages for LSI interrupts
	video/hdmi: Fix AVI bar unpack
	quota: Check that quota is not dirty before release
	ext2: check err when partial != NULL
	seccomp: avoid overflow in implicit constant conversion
	quota: fix livelock in dquot_writeback_dquots
	ext4: Fix credit estimate for final inode freeing
	reiserfs: fix extended attributes on the root directory
	scsi: qla2xxx: Fix SRB leak on switch command timeout
	scsi: qla2xxx: Fix a dma_pool_free() call
	Revert "scsi: qla2xxx: Fix memory leak when sending I/O fails"
	iio: ad7949: kill pointless "readback"-handling code
	iio: ad7949: fix channels mixups
	omap: pdata-quirks: revert pandora specific gpiod additions
	omap: pdata-quirks: remove openpandora quirks for mmc3 and wl1251
	powerpc: Avoid clang warnings around setjmp and longjmp
	powerpc: Fix vDSO clock_getres()
	mm, memfd: fix COW issue on MAP_PRIVATE and F_SEAL_FUTURE_WRITE mappings
	mfd: rk808: Fix RK818 ID template
	mm: memcg/slab: wait for !root kmem_cache refcnt killing on root kmem_cache destruction
	ext4: work around deleting a file with i_nlink == 0 safely
	firmware: qcom: scm: Ensure 'a0' status code is treated as signed
	s390/smp,vdso: fix ASCE handling
	s390/kaslr: store KASLR offset for early dumps
	mm/shmem.c: cast the type of unmap_start to u64
	powerpc: Define arch_is_kernel_initmem_freed() for lockdep
	USB: dummy-hcd: increase max number of devices to 32
	rtc: disable uie before setting time and enable after
	splice: only read in as much information as there is pipe buffer space
	ext4: fix a bug in ext4_wait_for_tail_page_commit
	ext4: fix leak of quota reservations
	blk-mq: make sure that line break can be printed
	workqueue: Fix missing kfree(rescuer) in destroy_workqueue()
	r8169: fix rtl_hw_jumbo_disable for RTL8168evl
	EDAC/ghes: Do not warn when incrementing refcount on 0
	Linux 5.4.4

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I8949a5fb2fbd836ce34907e70906e3aeb8a58b7c
2019-12-17 20:10:28 +01:00
Ming Lei
e13c3c2196 blk-mq: make sure that line break can be printed
commit d2c9be89f8ebe7ebcc97676ac40f8dec1cf9b43a upstream.

8962842ca5ab ("blk-mq: avoid sysfs buffer overflow with too many CPU cores")
avoids sysfs buffer overflow, and reserves one character for line break.
However, the last snprintf() doesn't get correct 'size' parameter passed
in, so fixed it.

Fixes: 8962842ca5ab ("blk-mq: avoid sysfs buffer overflow with too many CPU cores")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Cc: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-17 19:56:53 +01:00
Ming Lei
285b073489 blk-mq: avoid sysfs buffer overflow with too many CPU cores
commit 8962842ca5abdcf98e22ab3b2b45a103f0408b95 upstream.

It is reported that sysfs buffer overflow can be triggered if the system
has too many CPU cores(>841 on 4K PAGE_SIZE) when showing CPUs of
hctx via /sys/block/$DEV/mq/$N/cpu_list.

Use snprintf to avoid the potential buffer overflow.

This version doesn't change the attribute format, and simply stops
showing CPU numbers if the buffer is going to overflow.

Cc: stable@vger.kernel.org
Fixes: 676141e48af7("blk-mq: don't dump CPU -> hw queue map on driver load")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-17 19:56:14 +01:00
Greg Kroah-Hartman
ad5859c6ae Linux 5.4-rc8
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAl3RzgkeHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGN18H/0JZbfIpy8/4Irol
 0va7Aj2fBi1a5oxfqYsMKN0u3GKbN3OV9tQ+7w1eBNGvL72TGadgVTzTY+Im7A9U
 UjboAc7jDPCG+YhIwXFufMiIAq5jDIj6h0LDas7ALsMfsnI/RhTwgNtLTAkyI3dH
 YV/6ljFULwueJHCxzmrYbd1x39PScj3kCNL2pOe6On7rXMKOemY/nbbYYISxY30E
 GMgKApSS+li7VuSqgrKoq5Qaox26LyR2wrXB1ij4pqEJ9xgbnKRLdHuvXZnE+/5p
 46EMirt+yeSkltW3d2/9MoCHaA76ESzWMMDijLx7tPgoTc3RB3/3ZLsm3rYVH+cR
 cRlNNSk=
 =0+Cg
 -----END PGP SIGNATURE-----

Merge 5.4-rc8 into android-mainline

Linux 5.4-rc8

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I1f55e5d34dc78ddb064910ce1e1b7a7b5b39aaba
2019-11-18 08:31:11 +01:00
Jiufei Xue
8b37bc277f iocost: check active_list of all the ancestors in iocg_activate()
There is a bug that checking the same active_list over and over again
in iocg_activate(). The intention of the code was checking whether all
the ancestors and self have already been activated. So fix it.

Fixes: 7caa47151a ("blkcg: implement blk-iocost")
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jiufei Xue <jiufei.xue@linux.alibaba.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-11-14 13:56:54 -07:00
Paolo Valente
478de3380c block, bfq: deschedule empty bfq_queues not referred by any process
Since commit 3726112ec7 ("block, bfq: re-schedule empty queues if
they deserve I/O plugging"), to prevent the service guarantees of a
bfq_queue from being violated, the bfq_queue may be left busy, i.e.,
scheduled for service, even if empty (see comments in
__bfq_bfqq_expire() for details). But, if no process will send
requests to the bfq_queue any longer, then there is no point in
keeping the bfq_queue scheduled for service.

In addition, keeping the bfq_queue scheduled for service, but with no
process reference any longer, may cause the bfq_queue to be freed when
descheduled from service. But this is assumed to never happen, and
causes a UAF if it happens. This, in turn, caused crashes [1, 2].

This commit fixes this issue by descheduling an empty bfq_queue when
it remains with not process reference.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1767539
[2] https://bugzilla.kernel.org/show_bug.cgi?id=205447

Fixes: 3726112ec7 ("block, bfq: re-schedule empty queues if they deserve I/O plugging")
Reported-by: Chris Evich <cevich@redhat.com>
Reported-by: Patrick Dung <patdung100@gmail.com>
Reported-by: Thorsten Schubert <tschubert@bafh.org>
Tested-by: Thorsten Schubert <tschubert@bafh.org>
Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-11-14 07:00:54 -07:00
Junichi Nomura
e3a5d8e386 block: check bi_size overflow before merge
__bio_try_merge_page() may merge a page to bio without bio_full() check
and cause bi_size overflow.

The overflow typically ends up with sd_init_command() warning on zero
segment request with call trace like this:

    ------------[ cut here ]------------
    WARNING: CPU: 2 PID: 1986 at drivers/scsi/scsi_lib.c:1025 scsi_init_io+0x156/0x180
    CPU: 2 PID: 1986 Comm: kworker/2:1H Kdump: loaded Not tainted 5.4.0-rc7 #1
    Workqueue: kblockd blk_mq_run_work_fn
    RIP: 0010:scsi_init_io+0x156/0x180
    RSP: 0018:ffffa11487663bf0 EFLAGS: 00010246
    RAX: 00000000002be0a0 RBX: ffff8e6e9ff30118 RCX: 0000000000000000
    RDX: 00000000ffffffe1 RSI: 0000000000000000 RDI: ffff8e6e9ff30118
    RBP: ffffa11487663c18 R08: ffffa11487663d28 R09: ffff8e6e9ff30150
    R10: 0000000000000001 R11: 0000000000000000 R12: ffff8e6e9ff30000
    R13: 0000000000000001 R14: ffff8e74a1cf1800 R15: ffff8e6e9ff30000
    FS:  0000000000000000(0000) GS:ffff8e6ea7680000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007fff18cf0fe8 CR3: 0000000659f0a001 CR4: 00000000001606e0
    Call Trace:
     sd_init_command+0x326/0xb40 [sd_mod]
     scsi_queue_rq+0x502/0xaa0
     ? blk_mq_get_driver_tag+0xe7/0x120
     blk_mq_dispatch_rq_list+0x256/0x5a0
     ? elv_rb_del+0x24/0x30
     ? deadline_remove_request+0x7b/0xc0
     blk_mq_do_dispatch_sched+0xa3/0x140
     blk_mq_sched_dispatch_requests+0xfb/0x170
     __blk_mq_run_hw_queue+0x81/0x130
     blk_mq_run_work_fn+0x1b/0x20
     process_one_work+0x179/0x390
     worker_thread+0x4f/0x3e0
     kthread+0x105/0x140
     ? max_active_store+0x80/0x80
     ? kthread_bind+0x20/0x20
     ret_from_fork+0x35/0x40
    ---[ end trace f9036abf5af4a4d3 ]---
    blk_update_request: I/O error, dev sdd, sector 2875552 op 0x1:(WRITE) flags 0x0 phys_seg 0 prio class 0
    XFS (sdd1): writeback error on sector 2875552

__bio_try_merge_page() should check the overflow before actually doing
merge.

Fixes: 07173c3ec2 ("block: enable multipage bvecs")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-11-12 07:26:27 -07:00
Greg Kroah-Hartman
682d8bf784 Linux 5.4-rc7
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAl3IqJQeHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGOiUH+gOEDwid5OODaFAd
 CggXugdFIlBZefKqGVNW5sjgX8pxFWHXuEMC8iNb6QXtQZdFrI6LFf9hhUDmzQtm
 6y1LPxxEiTZjObMEsBNylb7tyzgujFHcAlp0Zro3w/HLCqmYTSP3FF46i2u6KZfL
 XhkpM4X7R7qxlfpdhlfESv/ElRGocZe6SwXfC7pcPo5flFcmkdu9ijqhNd/6CZ/h
 Nf9rTsD/wEDVUelFbgVN+LJzlaB0tsyc4Zbof07n8OsFZjhdEOop8gfM/kTBLcyY
 6bh66SfDScdsNnC/l8csbPjSZRx+i+nQs67DyhGNnsSAFgHBZdC4Tb/2mDCwhCLR
 dUvuYZc=
 =1N6F
 -----END PGP SIGNATURE-----

Merge tag 'v5.4-rc7' into android-mainline

Linux 5.4-rc7

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I505207a0a6f68ccc3519d7f190d8faf25d9d479a
2019-11-11 06:10:55 +01:00
Tejun Heo
b0814361a2 blkcg: make blkcg_print_stat() print stats only for online blkgs
blkcg_print_stat() iterates blkgs under RCU and doesn't test whether
the blkg is online.  This can call into pd_stat_fn() on a pd which is
still being initialized leading to an oops.

The heaviest operation - recursively summing up rwstat counters - is
already done while holding the queue_lock.  Expand queue_lock to cover
the other operations and skip the blkg if it isn't online yet.  The
online state is protected by both blkcg and queue locks, so this
guarantees that only online blkgs are processed.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Roman Gushchin <guro@fb.com>
Cc: Josef Bacik <jbacik@fb.com>
Fixes: 903d23f0a3 ("blk-cgroup: allow controllers to output their own stats")
Cc: stable@vger.kernel.org # v4.19+
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-11-06 17:08:38 -07:00
Greg Kroah-Hartman
2a71bdee3f Linux 5.4-rc6
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAl2/T6oeHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGB7kH/2asrl7RylHPQfsI
 pkjPPq32MHLq6Zmr8y0N0hyJCm1Dxu8qCIktqrEV5vsbKdv5pb8EMdQRlhJUtR8e
 TZdYDGHiL0sFb2HYiEvL0qD9BNeI+Kftw/kUffVXRzyMWex/f5S6mW5QNTuv9SQT
 Zfa+sXreFPCCyd3jhQFRyguogaCXBmTYvO6glmc96Yi4nA1URtIxNXhXumoklElF
 8Ka7UqtoJk2nPns+oV9I5xohghgJHHjA3A96WURku1UdO9dRoHiyS05RjnijBxsk
 ffenk09qbGvnvvgP93Q23CoTO8ndIm12ZL8C9jX49CS21j5SVG0PLPhS08f70vEf
 h5K/OtE=
 =nmDP
 -----END PGP SIGNATURE-----

Merge 5.4-rc6 into android-mainline

Linux 5.4-rc6

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I211f7159a46cf2a3dbb18afe56777cae1c13ac73
2019-11-04 06:51:47 +01:00
Dan Carpenter
41591a51f0 iocost: don't nest spin_lock_irq in ioc_weight_write()
This code causes a static analysis warning:

    block/blk-iocost.c:2113 ioc_weight_write() error: double lock 'irq'

We disable IRQs in blkg_conf_prep() and re-enable them in
blkg_conf_finish().  IRQ disable/enable should not be nested because
that means the IRQs will be enabled at the first unlock instead of the
second one.

Fixes: 7caa47151a ("blkcg: implement blk-iocost")
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-10-31 11:40:57 -06:00
Satya Tangirala
600e29fce0 FROMLIST: block: blk-crypto for Inline Encryption
We introduce blk-crypto, which manages programming keyslots for struct
bios. With blk-crypto, filesystems only need to call bio_crypt_set_ctx with
the encryption key, algorithm and data_unit_num; they don't have to worry
about getting a keyslot for each encryption context, as blk-crypto handles
that. Blk-crypto also makes it possible for layered devices like device
mapper to make use of inline encryption hardware.

Blk-crypto delegates crypto operations to inline encryption hardware when
available, and also contains a software fallback to the kernel crypto API.
For more details, refer to Documentation/block/inline-encryption.rst.

Bug: 137270441
Test: tested as series; see Ie1b77f7615d6a7a60fdc9105c7ab2200d17636a8
Change-Id: I7df59fef0c1e90043b1899c5a95973e23afac0c5
Signed-off-by: Satya Tangirala <satyat@google.com>
Link: https://patchwork.kernel.org/patch/11214731/
2019-10-30 21:59:38 +00:00
Satya Tangirala
d85bf5e127 ANDROID: block: Fix bio_crypt_should_process WARN_ON
bio_crypt_should_process would WARN that the bio did not have a
keyslot in any keyslot manager even when we were on the decrypt path
of blk-crypto, which is a bug. The WARN is now conditional on the
caller being responible for handling encryption rather than blk-crypto
(i.e. the WARN happens only if this function return true).

Bug: 137270441
Test: tested as series; see Ie1b77f7615d6a7a60fdc9105c7ab2200d17636a8
Change-Id: I01aa7a04a5ab9c9e579bde8a06d095916d880e2c
Signed-off-by: Satya Tangirala <satyat@google.com>
2019-10-30 21:57:08 +00:00
Satya Tangirala
10f1b43cbc FROMLIST: block: Add encryption context to struct bio
We must have some way of letting a storage device driver know what
encryption context it should use for en/decrypting a request. However,
it's the filesystem/fscrypt that knows about and manages encryption
contexts. As such, when the filesystem layer submits a bio to the block
layer, and this bio eventually reaches a device driver with support for
inline encryption, the device driver will need to have been told the
encryption context for that bio.

We want to communicate the encryption context from the filesystem layer
to the storage device along with the bio, when the bio is submitted to the
block layer. To do this, we add a struct bio_crypt_ctx to struct bio, which
can represent an encryption context (note that we can't use the bi_private
field in struct bio to do this because that field does not function to pass
information across layers in the storage stack). We also introduce various
functions to manipulate the bio_crypt_ctx and make the bio/request merging
logic aware of the bio_crypt_ctx.

Bug: 137270441
Test: tested as series; see Ie1b77f7615d6a7a60fdc9105c7ab2200d17636a8
Change-Id: I479de9ec13758f1978b34d897e6956e680caeb92
Signed-off-by: Satya Tangirala <satyat@google.com>
Link: https://patchwork.kernel.org/patch/11214719/
2019-10-30 14:14:59 -07:00
Satya Tangirala
aac6c3decd FROMLIST: block: Keyslot Manager for Inline Encryption
Inline Encryption hardware allows software to specify an encryption context
(an encryption key, crypto algorithm, data unit num, data unit size, etc.)
along with a data transfer request to a storage device, and the inline
encryption hardware will use that context to en/decrypt the data. The
inline encryption hardware is part of the storage device, and it
conceptually sits on the data path between system memory and the storage
device.

Inline Encryption hardware implementations often function around the
concept of "keyslots". These implementations often have a limited number
of "keyslots", each of which can hold an encryption context (we say that
an encryption context can be "programmed" into a keyslot). Requests made
to the storage device may have a keyslot associated with them, and the
inline encryption hardware will en/decrypt the data in the requests using
the encryption context programmed into that associated keyslot. As
keyslots are limited, and programming keys may be expensive in many
implementations, and multiple requests may use exactly the same encryption
contexts, we introduce a Keyslot Manager to efficiently manage keyslots.
The keyslot manager also functions as the interface that upper layers will
use to program keys into inline encryption hardware. For more information
on the Keyslot Manager, refer to documentation found in
block/keyslot-manager.c and linux/keyslot-manager.h.

Bug: 137270441
Test: tested as series; see Ie1b77f7615d6a7a60fdc9105c7ab2200d17636a8
Change-Id: Iea1ee5a7eec46cb50d33cf1e2d20dfb7335af4ed
Signed-off-by: Satya Tangirala <satyat@google.com>
Link: https://patchwork.kernel.org/patch/11214713/
2019-10-30 13:15:53 -07:00
Tejun Heo
307f4065b9 blk-rq-qos: fix first node deletion of rq_qos_del()
rq_qos_del() incorrectly assigns the node being deleted to the head if
it was the first on the list in the !prev path.  Fix it by iterating
with ** instead.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Josef Bacik <josef@toxicpanda.com>
Fixes: a79050434b ("blk-rq-qos: refactor out common elements of blk-wbt")
Cc: stable@vger.kernel.org # v4.19+
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-10-15 10:13:13 -06:00
Tejun Heo
9d179b8654 blkcg: Fix multiple bugs in blkcg_activate_policy()
blkcg_activate_policy() has the following bugs.

* cf09a8ee19 ("blkcg: pass @q and @blkcg into
  blkcg_pol_alloc_pd_fn()") added @blkcg to ->pd_alloc_fn(); however,
  blkcg_activate_policy() ends up using pd's allocated for the root
  blkcg for all preallocations, so ->pd_init_fn() for non-root blkcgs
  can be passed in pd's which are allocated for the root blkcg.

  For blk-iocost, this means that ->pd_init_fn() can write beyond the
  end of the allocated object as it determines the length of the flex
  array at the end based on the blkcg's nesting level.

* Each pd is initialized as they get allocated.  If alloc fails, the
  policy will get freed with pd's initialized on it.

* After the above partial failure, the partial pds are not freed.

This patch fixes all the above issues by

* Restructuring blkcg_activate_policy() so that alloc and init passes
  are separate.  Init takes place only after all allocs succeeded and
  on failure all allocated pds are freed.

* Unifying and fixing the cleanup of the remaining pd_prealloc.

Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: cf09a8ee19 ("blkcg: pass @q and @blkcg into blkcg_pol_alloc_pd_fn()")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-10-15 10:13:00 -06:00
Damien Le Moal
7a7c5e715e block: Fix elv_support_iosched()
A BIO based request queue does not have a tag_set, which prevent testing
for the flag BLK_MQ_F_NO_SCHED indicating that the queue does not
require an elevator. This leads to an incorrect initialization of a
default elevator in some cases such as BIO based null_blk
(queue_mode == BIO) with zoned mode enabled as the default elevator in
this case is mq-deadline instead of "none".

Fix this by testing for a NULL queue mq_ops field which indicates that
the queue is BIO based and should not have an elevator.

Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Bob Liu <bob.liu@oracle.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-10-14 13:54:09 -06:00
Harshad Shirwadkar
b84477d3eb blk-wbt: fix performance regression in wbt scale_up/scale_down
scale_up wakes up waiters after scaling up. But after scaling max, it
should not wake up more waiters as waiters will not have anything to
do. This patch fixes this by making scale_up (and also scale_down)
return when threshold is reached.

This bug causes increased fdatasync latency when fdatasync and dd
conv=sync are performed in parallel on 4.19 compared to 4.14. This
bug was introduced during refactoring of blk-wbt code.

Fixes: a79050434b ("blk-rq-qos: refactor out common elements of blk-wbt")
Cc: stable@vger.kernel.org
Cc: Josef Bacik <jbacik@fb.com>
Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-10-06 09:26:41 -06:00
Randy Dunlap
a9eb49c964 block: sed-opal: fix sparse warning: convert __be64 data
sparse warns about incorrect type when using __be64 data.
It is not being converted to CPU-endian but it should be.

Fixes these sparse warnings:

../block/sed-opal.c:375:20: warning: incorrect type in assignment (different base types)
../block/sed-opal.c:375:20:    expected unsigned long long [usertype] align
../block/sed-opal.c:375:20:    got restricted __be64 const [usertype] alignment_granularity
../block/sed-opal.c:376:25: warning: incorrect type in assignment (different base types)
../block/sed-opal.c:376:25:    expected unsigned long long [usertype] lowest_lba
../block/sed-opal.c:376:25:    got restricted __be64 const [usertype] lowest_aligned_lba

Fixes: 455a7b238c ("block: Add Sed-opal library")
Cc: Scott Bauer <scott.bauer@intel.com>
Cc: Rafael Antognolli <rafael.antognolli@intel.com>
Cc: linux-block@vger.kernel.org
Reviewed-by: Jon Derrick <jonathan.derrick@intel.com>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-10-03 14:21:32 -06:00