From: Krishna Kumar <krkumar2@in.ibm.com>
To: linux-nfs@vger.kernel.org
Cc: Krishna Kumar <krkumar2@in.ibm.com>
Subject: [PATCH] nfsd: Change error handling in _get_posix_acl and it's callers
Date: Wed, 22 Oct 2008 14:48:48 +0530 [thread overview]
Message-ID: <20081022091848.22100.80769.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20081022091836.22100.57827.sendpatchset-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
From: Krishna Kumar <krkumar2@in.ibm.com>
Change _get_posix_acl to return NULL on buflen == 0, and change users of
this function to handle error cases.
Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
---
fs/nfsd/vfs.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff -ruNp 2.6.27-org/fs/nfsd/vfs.c 2.6.27-new/fs/nfsd/vfs.c
--- 2.6.27-org/fs/nfsd/vfs.c 2008-10-22 14:19:15.000000000 +0530
+++ 2.6.27-new/fs/nfsd/vfs.c 2008-10-22 14:35:16.000000000 +0530
@@ -503,13 +503,11 @@ static struct posix_acl *
_get_posix_acl(struct dentry *dentry, char *key)
{
void *buf = NULL;
- struct posix_acl *pacl = NULL;
+ struct posix_acl *pacl;
int buflen;
buflen = nfsd_getxattr(dentry, key, &buf);
- if (!buflen)
- buflen = -ENODATA;
- if (buflen <= 0)
+ if (buflen < 0)
return ERR_PTR(buflen);
pacl = posix_acl_from_xattr(buf, buflen);
@@ -526,7 +524,7 @@ nfsd4_get_nfs4_acl(struct svc_rqst *rqst
unsigned int flags = 0;
pacl = _get_posix_acl(dentry, POSIX_ACL_XATTR_ACCESS);
- if (IS_ERR(pacl) && PTR_ERR(pacl) == -ENODATA)
+ if (!pacl)
pacl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL);
if (IS_ERR(pacl)) {
error = PTR_ERR(pacl);
@@ -536,9 +534,7 @@ nfsd4_get_nfs4_acl(struct svc_rqst *rqst
if (S_ISDIR(inode->i_mode)) {
dpacl = _get_posix_acl(dentry, POSIX_ACL_XATTR_DEFAULT);
- if (IS_ERR(dpacl) && PTR_ERR(dpacl) == -ENODATA)
- dpacl = NULL;
- else if (IS_ERR(dpacl)) {
+ if (IS_ERR(dpacl)) {
error = PTR_ERR(dpacl);
dpacl = NULL;
goto out;
next prev parent reply other threads:[~2008-10-22 9:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-22 9:18 [PATCH] nfsd: Fix memory leak in nfsd_getxattr Krishna Kumar
[not found] ` <20081022091836.22100.57827.sendpatchset-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-10-22 9:18 ` Krishna Kumar [this message]
[not found] ` <20081022091848.22100.80769.sendpatchset-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-10-22 18:17 ` [PATCH] nfsd: Change error handling in _get_posix_acl and it's callers J. Bruce Fields
2008-10-22 20:12 ` J. Bruce Fields
2008-10-22 18:11 ` [PATCH] nfsd: Fix memory leak in nfsd_getxattr J. Bruce Fields
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081022091848.22100.80769.sendpatchset@localhost.localdomain \
--to=krkumar2@in.ibm.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.