Go to file
Ming Lei b5903ced25 block: virtio_blk: fix handling single range discard request
[ Upstream commit af822aa68fbdf0a480a17462ed70232998127453 ]

1f23816b8eb8 ("virtio_blk: add discard and write zeroes support") starts
to support multi-range discard for virtio-blk. However, the virtio-blk
disk may report max discard segment as 1, at least that is exactly what
qemu is doing.

So far, block layer switches to normal request merge if max discard segment
limit is 1, and multiple bios can be merged to single segment. This way may
cause memory corruption in virtblk_setup_discard_write_zeroes().

Fix the issue by handling single max discard segment in straightforward
way.

Fixes: 1f23816b8eb8 ("virtio_blk: add discard and write zeroes support")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Changpeng Liu <changpeng.liu@intel.com>
Cc: Daniel Verkamp <dverkamp@chromium.org>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-03-16 16:35:00 +08:00
Documentation kbuild: support LLVM=1 to switch the default tools to Clang/LLVM 2021-03-16 16:34:25 +08:00
LICENSES Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
arch s390/numa: set node distance to LOCAL_DISTANCE 2021-03-16 16:34:56 +08:00
block block: respect queue limit of max discard segment 2021-03-16 16:35:00 +08:00
certs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
crypto crypto: algif_aead - fix uninitialized ctx->init 2021-03-16 16:34:22 +08:00
drivers block: virtio_blk: fix handling single range discard request 2021-03-16 16:35:00 +08:00
fs btrfs: only commit delayed items at fsync if we are logging a directory 2021-03-16 16:34:56 +08:00
include efi: provide empty efi_enter_virtual_mode implementation 2021-03-16 16:34:54 +08:00
init x86: Fix early boot crash on gcc-10, third try 2021-03-16 16:28:02 +08:00
ipc ipc/util.c: sysvipc_find_ipc() incorrectly updates position index 2021-03-16 16:27:51 +08:00
kernel sched/uclamp: Fix a deadlock when enabling uclamp static key 2021-03-16 16:34:55 +08:00
lib test_kmod: avoid potential double free in trigger_config_run_type() 2021-03-16 16:34:21 +08:00
mm mm/vunmap: add cond_resched() in vunmap_pmd_range 2021-03-16 16:34:58 +08:00
net net/sched: act_ct: Fix skb double-free in tcf_ct_handle_fragments() error flow 2021-03-16 16:34:44 +08:00
package config/arm64: OPEN CONFIG_PSI and phytium configs 2021-03-16 11:02:59 +08:00
samples bpf: Fix fds_example SIGSEGV error 2021-03-16 16:33:24 +08:00
scripts kconfig: qconf: fix signal connection to invalid slots 2021-03-16 16:34:39 +08:00
security Smack: prevent underflow in smk_set_cipso() 2021-03-16 16:33:40 +08:00
sound ALSA: usb-audio: Add capture support for Saffire 6 (USB 1.1) 2021-03-16 16:35:00 +08:00
tools selftests/powerpc: Purge extra count_pmc() calls of ebb selftests 2021-03-16 16:34:49 +08:00
usr Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
virt KVM: arm64: Only reschedule if MMU_NOTIFIER_RANGE_BLOCKABLE is not set 2021-03-16 16:34:42 +08:00
.clang-format Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
.cocciconfig Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
.get_maintainer.ignore Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
.gitattributes Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
.gitignore Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
COPYING Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
CREDITS Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
Kbuild Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
Kconfig Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
MAINTAINERS Documentation/llvm: add documentation on building w/ Clang/LLVM 2021-03-16 16:34:24 +08:00
Makefile kbuild: support LLVM=1 to switch the default tools to Clang/LLVM 2021-03-16 16:34:25 +08:00
README Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
README.md Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
backport_remove_lists.txt Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
tools_key.pub Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00

README.md

Tencent Linux Kernel 4.0