Re: [PATCH] Btrfs: potential NULL dereferences

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

 



Roel Kluin <roel.kluin@xxxxxxxxx> writes:

> Allocations may fail, prevent NULL dereferences.
>
> Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
> ---
> In several sections of fs/btrfs code a kmalloc() occurs without a
> check whether it succeeded. this potentially leads to dereferences
> of a NULL pointer. Are there reasons why we do not check the
> allocations? Did I choose an incorrect way to err out? please
> review.

Yes, the erroring out needs much more work because often
the callers don't handle errors and it can need quite a lot of surgery
Until that is done it's actually better to oops than to silently
leak resources. BUG_ON(name == NULL) is also fairly useless
because it oopses anyways in a obvious way.

I had some patches to add more error handling for ENOMEM, but it's
fairly complicated. Should probably resurrect my old patchkit. It
still wasn't fully complete.

-Andi


-- 
ak@xxxxxxxxxxxxxxx -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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