From e49be14b8d80e23bb7c53d78c21717a474ade76b Mon Sep 17 00:00:00 2001 From: Dan Robertson Date: Tue, 19 Feb 2019 02:56:43 +0000 Subject: btrfs: init csum_list before possible free The scrub_ctx csum_list member must be initialized before scrub_free_ctx is called. If the csum_list is not initialized beforehand, the list_empty call in scrub_free_csums will result in a null deref if the allocation fails in the for loop. Fixes: a2de733c78fa ("btrfs: scrub") CC: stable@vger.kernel.org # 3.0+ Reviewed-by: Nikolay Borisov Signed-off-by: Dan Robertson Reviewed-by: David Sterba Signed-off-by: David Sterba --- fs/btrfs/scrub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 669bedfec4a9..a99588536c79 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -584,6 +584,7 @@ static noinline_for_stack struct scrub_ctx *scrub_setup_ctx( sctx->pages_per_rd_bio = SCRUB_PAGES_PER_RD_BIO; sctx->curr = -1; sctx->fs_info = fs_info; + INIT_LIST_HEAD(&sctx->csum_list); for (i = 0; i < SCRUB_BIOS_PER_SCTX; ++i) { struct scrub_bio *sbio; @@ -608,7 +609,6 @@ static noinline_for_stack struct scrub_ctx *scrub_setup_ctx( atomic_set(&sctx->workers_pending, 0); atomic_set(&sctx->cancel_req, 0); sctx->csum_size = btrfs_super_csum_size(fs_info->super_copy); - INIT_LIST_HEAD(&sctx->csum_list); spin_lock_init(&sctx->list_lock); spin_lock_init(&sctx->stat_lock); -- cgit v1.2.3 14ceddf9a74ff5c0'>treecommitdiffstats
AgeCommit message (Expand)AuthorFilesLines
2025-09-28KEYS: X.509: Fix Basic Constraints CA flag parsingFan Wu1-4/+12
2025-09-20crypto: anubis - simplify return statement in anubis_mod_initThorsten Blum1-4/+1
2025-09-20crypto: hisilicon/qm - set NULL to qm->debug.qm_diff_regsChenghai Huang1-0/+1
2025-09-20crypto: hisilicon/qm - clear all VF configurations in the hardwareWeili Qian1-13/+12
2025-09-20crypto: hisilicon - enable error reporting againWeili Qian4-0/+41
2025-09-20crypto: hisilicon/qm - mask axi error before memory initWeili Qian5-122/+257
2025-09-20crypto: hisilicon/qm - invalidate queues in useWeili Qian1-13/+40
2025-09-20crypto: qat - Return pointer directly in adf_ctl_alloc_resourcesHerbert Xu1-18/+13
2025-09-20crypto: aspeed - Fix dma_unmap_sg() directionThomas Fourier1-1/+1
2025-09-20rhashtable: Use rcu_dereference_all and rcu_dereference_all_checkHerbert Xu2-7/+33
2025-09-20crypto: comp - Use same definition of context alloc and free opsDan Moulding8-24/+29
2025-09-13crypto: omap - convert from tasklet to BH workqueueRyo Takakura4-23/+26
2025-09-13crypto: qat - Replace kzalloc() + copy_from_user() with memdup_user()Thorsten Blum1-10/+3
2025-09-13crypto: caam - double the entropy delay interval for retryGaurav Jain1-2/+2
2025-09-13padata: WQ_PERCPU added to alloc_workqueue usersMarco Crivellari1-2/+3
2025-09-13padata: replace use of system_unbound_wq with system_dfl_wqMarco Crivellari1-2/+2
2025-09-13crypto: cryptd - WQ_PERCPU added to alloc_workqueue usersMarco Crivellari1-1/+2
2025-09-13crypto: chelsio - Use library to prepare HMAC keysEric Biggers3-203/+63
2025-09-13crypto: qat - Use library to prepare HMAC keysEric Biggers2-137/+61
2025-09-13crypto: tegra - Use int type to store negative error codesQianfeng Rong1-1/+2
2025-09-13crypto: hisilicon/sec - Use int type to store negative error codesQianfeng Rong1-1/+2
2025-09-13crypto: ccp - Use int type to store negative error codesQianfeng Rong1-1/+2
2025-09-13crypto: ccp - Fix incorrect payload size calculation in psp_poulate_hsti()Yunseong Kim1-1/+1
2025-09-13crypto: atmel - Fix dma_unmap_sg() directionThomas Fourier1-1/+1
2025-09-13crypto: rockchip - Fix dma_unmap_sg() nents valueThomas Fourier1-1/+1
2025-09-13crytpo: sun8i-ce - factor out prepare/unprepare from sun8i_ce_hash_run()Ovidiu Panait1-16/+46
2025-09-13crypto: sun8i-ce - save hash buffers and dma info to request contextOvidiu Panait2-45/+49
2025-09-13crypto: sun8i-ce - pass task descriptor to cipher prepare/unprepareOvidiu Panait1-22/+11
2025-09-13crypto: sun8i-ce - fold sun8i_ce_cipher_run() into sun8i_ce_cipher_do_one()Ovidiu Panait1-19/+16
2025-09-13crypto: sun8i-ce - move bounce_iv and backup_iv to request contextOvidiu Panait3-25/+13
2025-09-13crypto: sun8i-ce - add a new function for dumping task descriptorsOvidiu Panait1-7/+9
2025-09-13crypto: sun8i-ce - remove unnecessary __maybe_unused annotationsOvidiu Panait3-3/+3
2025-09-13crypto: sun8i-ce - remove boilerplate in sun8i_ce_hash_digest()Ovidiu Panait1-6/+2
2025-09-13crypto: sun8i-ce - remove channel timeout fieldOvidiu Panait6-9/+3
2025-09-06crypto: hisilicon/zip - add hashjoin, gather, and UDMA data move featuresZhushuai Yin4-9/+33
2025-09-06crypto: hisilicon/zip - add lz4 and lz77_only to algorithm sysfsChenghai Huang1-0/+7
2025-09-06crypto: ti - Enable compile testing for dthev2Herbert Xu2-2/+2
2025-09-06crypto: hisilicon/sec2 - Fix false-positive warning of uninitialised qp_ctxHerbert Xu1-5/+3
2025-09-06rhashtable: Use __always_inline instead of inlineMenglong Dong1-21/+21
2025-09-06crypto: caam - switch to use devm_kmemdup_array()Zhang Enpei1-3/+3
2025-09-06crypto: xilinx - Add TRNG driver for VersalHarsh Jain4-0/+424