xfs
[Top] [All Lists]

Re: [PATCH 3/8] xfs: handle kmalloc failure when reading attrs

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 3/8] xfs: handle kmalloc failure when reading attrs
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Fri, 2 Mar 2012 02:49:20 -0500
Cc: xfs@xxxxxxxxxxx
In-reply-to: <1330661507-1121-4-git-send-email-david@xxxxxxxxxxxxx>
References: <1330661507-1121-1-git-send-email-david@xxxxxxxxxxxxx> <1330661507-1121-4-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
I think the subject should be more like:

xfs: fallback to vmalloc for large buffers in xfs_attrmulti_attr_get

> +     kbuf = kmem_zalloc(*len, KM_SLEEP | KM_MAYFAIL);
> +     if (!kbuf) {
> +             kbuf = kmem_zalloc_large(*len);
> +             if (!kbuf)
> +                     return ENOMEM;
> +     }
>  
>       error = xfs_attr_get(XFS_I(inode), name, kbuf, (int *)len, flags);
>       if (error)
> @@ -457,7 +460,7 @@ xfs_attrmulti_attr_get(
>               error = EFAULT;
>  
>   out_kfree:
> -     kfree(kbuf);
> +     kmem_free(kbuf);

kmem_free doesn't handle vmalloced buffers from kmem_zalloc_large, you
need to use kmem_free_large for them.

<Prev in Thread] Current Thread [Next in Thread>