Re: [PATCH] btrfs: Fix possible NULL pointer dereference in btrfs selftest

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

 




On 2019/3/1 上午12:02, David Sterba wrote:
> On Fri, Feb 22, 2019 at 08:53:50AM +0800, Qu Wenruo wrote:
>> When CONFIG_BTRFS_FS_RUN_SANITY_TESTS is enabled, btrfs will run
>> selftest at module load time.
>>
>> During selftest, we allocate extent buffer using
>> alloc_test_extent_buffer(), instead of alloc_test_extent_buffer().
>>
>> The problem is, unlike alloc_extent_buffer(),
>> alloc_test_extent_buffer() can return NULL pointer instead of error
>> pointer, and callers all expect error pointer other than NULL pointer.
>>
>> So this could lead to NULL pointer dereference during selftest.
>>
>> Fix it by returning error pointer in alloc_test_extent_buffer().
>>
>> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
>> Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
> 
> This patch is obsoleted by https://patchwork.kernel.org/patch/10828221/
> "btrfs: extent_io: Always return error pointer for extent buffer
> allocation failure", right?

Yup.

Thanks,
Qu

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux