mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-09-22 12:42:50 +00:00
nfsd: Fix memory leak in nfsd_getxattr
Fix a memory leak in nfsd_getxattr. nfsd_getxattr should free up memory that it allocated if vfs_getxattr fails. Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
This commit is contained in:
parent
1cd9cd161c
commit
6c6a426fdc
1 changed files with 5 additions and 1 deletions
|
@ -410,6 +410,7 @@ out_nfserr:
|
||||||
static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf)
|
static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf)
|
||||||
{
|
{
|
||||||
ssize_t buflen;
|
ssize_t buflen;
|
||||||
|
ssize_t ret;
|
||||||
|
|
||||||
buflen = vfs_getxattr(dentry, key, NULL, 0);
|
buflen = vfs_getxattr(dentry, key, NULL, 0);
|
||||||
if (buflen <= 0)
|
if (buflen <= 0)
|
||||||
|
@ -419,7 +420,10 @@ static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf)
|
||||||
if (!*buf)
|
if (!*buf)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
return vfs_getxattr(dentry, key, *buf, buflen);
|
ret = vfs_getxattr(dentry, key, *buf, buflen);
|
||||||
|
if (ret < 0)
|
||||||
|
kfree(*buf);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue