nfsd: Fix leaked memory in nfs4_make_rec_clidname
Subsystems (2)
PATCH 3/4 nfsd: Fix leaked memory in nfs4_make_rec_clidname
From: Krishna Kumar <[email protected]>
cksum.data is not freed up in one error case. Compile tested.
---
fs/nfsd/nfs4recover.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4recover.c +1 -1
@@ -110,9 +110,9 @@ nfs4_make_rec_clidname(char *dname, strumd5_to_hex (dname, cksum.data); -kfree (cksum.data); status = nfs_ok; out: +kfree (cksum.data);crypto_free_hash (desc.tfm); out_no_tfm:return status;
A message that is not in the archive (sent off-list or not yet received): 20081020061709.18370.85373.sendpatchset-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]
PATCH 4/4 nfsd: Minor cleanup of _get_posix_acl
From: Krishna Kumar <[email protected]>
Rewrite error case to not check twice for !buflen. Compile tested.
--- fs/nfsd/vfs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/nfsd/vfs.c +4 -3
@@ -503,10 +503,11 @@ _get_posix_acl(struct dentry *dentry, chint buflen; buflen =nfsd_getxattr (dentry, key, &buf); -if (!buflen) - buflen = -ENODATA ; -if (buflen <=0 ) +if (buflen <=0 ) { +if (!buflen) + buflen = -ENODATA ;return ERR_PTR (buflen); + } pacl =posix_acl_from_xattr (buf, buflen);kfree (buf);
A message that is not in the archive (sent off-list or not yet received): 20081020061721.18370.93671.sendpatchset-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]
Re: [PATCH 4/4] nfsd: Minor cleanup of _get_posix_acl
Quoted 3 lines · Krishna Kumar
From: Krishna Kumar <[email protected]>
Rewrite error case to not check twice for !buflen. Compile tested.
Is the current code really a problem?
Possibly more interesting to look into:
- Can nfsd_getxattr actually return NULL?
- Why do we need to return ENODATA in that case? (nfsd_get_posix_acl, for example, seems to just end up returning -EINVAL in that case.)
--b.
Quoted 28 lines
Signed-off-by Krishna Kumar <[email protected]>--- fs/nfsd/vfs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)diff -ruNp
linux-2.6.27.org/fs/nfsd/vfs.clinux-2.6.27.new/fs/nfsd/vfs.cfs/nfsd/vfs.c +4
-4@@ -503,10 +503,11 @@ _get_posix_acl(struct dentry *dentry, chint buflen; buflen =nfsd_getxattr (dentry, key, &buf); -if (!buflen) - buflen = -ENODATA ; -if (buflen <=0 ) +if (buflen <=0 ) { +if (!buflen) + buflen = -ENODATA ;return ERR_PTR (buflen); + } pacl =posix_acl_from_xattr (buf, buflen);kfree (buf); --To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
J. Bruce Fields
AppliedQuoted 4 lines · Krishna Kumar
From: Krishna Kumar <[email protected]>
cksum.data is not freed up in one error case. Compile tested.
Thanks, applied.
--b.
Quoted 24 lines
Signed-off-by Krishna Kumar <[email protected]>---
fs/nfsd/nfs4recover.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff -ruNp
linux-2.6.27.org/fs/nfsd/nfs4recover.clinux-2.6.27.new/fs/nfsd/nfs4recover.cfs/nfsd/nfs4recover.c +1
-2@@ -110,9 +110,9 @@ nfs4_make_rec_clidname(char *dname, strumd5_to_hex (dname, cksum.data); -kfree (cksum.data); status = nfs_ok; out: +kfree (cksum.data);crypto_free_hash (desc.tfm); out_no_tfm:return status; --To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html