[Adding Brian to CC list again :)]

On Wed, 17 Apr 2013, Yehuda Sadeh wrote:

> On Wed, Apr 17, 2013 at 9:37 AM, Jeff Mitchell
> <[email protected]> wrote:
> > Henry C Chang wrote:
> >>
> >> I looked into this problem earlier. The problem is that zfs does not
> >> return ERANGE when the size of value buffer passed to getxattr is too
> >> small. zfs returns with truncated xattr value.
> >
> >
> > Is this a bug in ZFS, or simply different behavior?
> 
> Took a brief look at the zfs code, seems like a zfs bug.
> 
> diff --git a/module/zfs/zpl_xattr.c b/module/zfs/zpl_xattr.c
> index c03764f..96db7dd 100644
> --- a/module/zfs/zpl_xattr.c
> +++ b/module/zfs/zpl_xattr.c
> @@ -263,6 +263,9 @@ zpl_xattr_get_sa(struct inode *ip, const char
> *name, void *value, size_t size)
>         if (!size)
>                 return (nv_size);
> 
> +       if (size < nv_size)
> +               return (-ERANGE);
> +
>         memcpy(value, nv_value, MIN(size, nv_size));
> 
>         return (MIN(size, nv_size));
> 
> 
> This should fix it. Not tested of course.
> 
> Yehuda
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to