lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d4463564-7593-4956-a598-c7ec8fa8f851@gmail.com>
Date: Sun, 6 Oct 2024 12:33:58 +0530
From: Suraj Sonawane <surajsonawane0215@...il.com>
To: Keith Busch <kbusch@...nel.org>
Cc: hch@...radead.org, axboe@...nel.dk, linux-block@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: Explanation on Uninitialized Variable bio in blk_rq_prep_clone

On 04/10/24 20:09, Keith Busch wrote:
> On Fri, Oct 04, 2024 at 07:40:37PM +0530, SurajSonawane2415 wrote:
>> In the function blk_rq_prep_clone, the variable bio is declared but can remain uninitialized
>> if the allocation with bio_alloc_clone fails. This can lead to undefined behavior when the
>> function attempts to free bio in the error handling section using bio_put(bio).
>> By initializing bio to NULL at declaration, we ensure that the cleanup code will only
>> interact with bio if it has been successfully allocated.
> 
> I don't think your explanation makes sense. The line where
> bio_alloc_clone happens:
> 
> 	bio = bio_alloc_clone(rq->q->disk->part0, bio_src, gfp_mask, bs);
> 
> If it fails, then bio is initialized to NULL.
You're correct, bio_alloc_clone returns NULL if it fails, so there’s no 
uninitialized bio after that. My initial explanation wasn’t fully 
accurate, but initializing bio to NULL is just a safety measure for any 
unexpected issues later on. Or i am just trying to solve this issue by 
smatch tool: block/blk-mq.c:3199 blk_rq_prep_clone() error: 
uninitialized symbol 'bio'.

Thanks for the clarification.

Best regards,
Suraj

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ