summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@fb.com>2020-04-16 14:46:12 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-06-22 09:05:26 +0200
commit74bee8344b7defb5dd41de37290df51bc9e12f5e (patch)
tree459af8f7555d2f678f065c2d759a203bf28d2e51 /security
parent3bd1e2596ba3c97cb183380284566ea52716ae8a (diff)
btrfs: fix error handling when submitting direct I/O bio
[ Upstream commit 6d3113a193e3385c72240096fe397618ecab6e43 ] In btrfs_submit_direct_hook(), if a direct I/O write doesn't span a RAID stripe or chunk, we submit orig_bio without cloning it. In this case, we don't increment pending_bios. Then, if btrfs_submit_dio_bio() fails, we decrement pending_bios to -1, and we never complete orig_bio. Fix it by initializing pending_bios to 1 instead of incrementing later. Fixing this exposes another bug: we put orig_bio prematurely and then put it again from end_io. Fix it by not putting orig_bio. After this change, pending_bios is really more of a reference count, but I'll leave that cleanup separate to keep the fix small. Fixes: e65e15355429 ("btrfs: fix panic caused by direct IO") CC: stable@vger.kernel.org # 4.4+ Reviewed-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'security')
0 files changed, 0 insertions, 0 deletions