Re: null_handle_cmd() doesn't initialize data when reading

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020-05-10 03:03, Alexander Potapenko wrote:
> Thanks for the explanation!
> The code has changed recently, and my patch does not apply anymore,
> yet the problem still persists.
> I ended up just calling null_handle_rq() at the end of
> null_process_cmd(), but we probably need a cleaner fix.

Does this (totally untested) patch help? copy_to_nullb() guarantees that
it will write some data to the pages that it allocates but does not
guarantee yet that all data of the pages it allocates is initialized.

diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c
index 8efd8778e209..06f5761fccb6 100644
--- a/drivers/block/null_blk_main.c
+++ b/drivers/block/null_blk_main.c
@@ -848,7 +848,7 @@ static struct nullb_page *null_insert_page(struct
nullb *nullb,

 	spin_unlock_irq(&nullb->lock);

-	t_page = null_alloc_page(GFP_NOIO);
+	t_page = null_alloc_page(GFP_NOIO | __GFP_ZERO);
 	if (!t_page)
 		goto out_lock;




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux