Re: [PATCH v1 06/10] IB/uverbs: Add a simple allocator to uverbs_attr_bundle

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

 



On Thu, Aug 09, 2018 at 08:14:40PM -0600, Jason Gunthorpe wrote:
> From: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
> 
> This is similar in spirit to devm, it keeps track of any allocations
> linked to this method call and ensures they are all freed when the method
> exits. Further, if there is space in the internal/onstack buffer then the
> allocator will hand out that memory and avoid an expensive call to
> kalloc/kfree in the syscall path.
> 
> Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
> Reviewed-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> ---

[...]

>  
> -#define UVERBS_OPTIMIZE_USING_STACK_SZ  256
> +static void bundle_destroy(struct bundle_priv *pbundle)
> +{
> +	struct bundle_alloc_head *memblock;
> +
> +	for (memblock = pbundle->allocated_mem; memblock;
> +	     memblock = memblock->next)
> +		kvfree(memblock);

Use after free? Have I missed something?

> +}
> +
>  static long ib_uverbs_cmd_verbs(struct ib_device *ib_dev,
>  				struct ib_uverbs_file *file,
>  				struct ib_uverbs_ioctl_hdr *hdr,
> @@ -382,11 +440,11 @@ static long ib_uverbs_cmd_verbs(struct ib_device *ib_dev,



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux