From: Prasad P Subject: Re: [PATCH] Fix incorrect assignment Date: Thu, 25 Oct 2007 10:26:14 -0500 Message-ID: References: <20071024205736.GL29830@fieldses.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2025350691==" Cc: nfs-bounces@lists.sourceforge.net, nfs@lists.sourceforge.net, smfltc@us.ibm.com To: "J. Bruce Fields" Return-path: In-Reply-To: <20071024205736.GL29830@fieldses.org> List-Id: "Discussion of NFS under Linux development, interoperability, and testing." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nfs-bounces@lists.sourceforge.net Errors-To: nfs-bounces@lists.sourceforge.net --===============2025350691== Content-type: multipart/alternative; Boundary="0__=08BBF9ECDFC7FC228f9e8a93df938690918c08BBF9ECDFC7FC22" Content-Disposition: inline --0__=08BBF9ECDFC7FC228f9e8a93df938690918c08BBF9ECDFC7FC22 Content-type: text/plain; charset=US-ASCII nfs-bounces@lists.sourceforge.net wrote on 10/24/2007 03:57:36 PM: > On Wed, Oct 24, 2007 at 03:14:32PM -0500, Prasad P wrote: > > > > > > Dereferenced pointer "dentry" without checking and assigned to inode > > in the declaration. > > Seems reasonable, but: looking at nfsd_dispatch(), it appears that the > encode function is never called in this case (since rq_vers == 2 and > nfsacld_proc_getacl() would have returned an error if it couldn't find a > dentry). Am I missing something? Do you have a test case? > > --b. No, I don't have a test case. This error was found by coverity scan. After declaration of the variables, we actually check the dentry and dentry->d_inode, and if they are not NULL, assign dentry->d_inode to inode variable. if (dentry == NULL || dentry->d_inode == NULL) return 0; inode = dentry->d_inode; > > > > > > Cc: Steve French > > Signed-off-by: Prasad V Potluri > > --- > > > > diff -uprN a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c > > --- a/fs/nfsd/nfs2acl.c 2007-10-09 15:31:38.000000000 -0500 > > +++ b/fs/nfsd/nfs2acl.c 2007-10-24 14:03:13.000000000 -0500 > > @@ -221,7 +221,7 @@ static int nfsaclsvc_encode_getaclres(st > > struct nfsd3_getaclres *resp) > > { > > struct dentry *dentry = resp->fh.fh_dentry; > > - struct inode *inode = dentry->d_inode; > > + struct inode *inode; > > struct kvec *head = rqstp->rq_res.head; > > unsigned int base; > > int n; > > -- > > Thanks. > > > > Regards, > > Prasad Potluri > > email: pvp at-sign us dot ibm dot com > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. > > Still grepping through log files to find problems? Stop. > > Now Search log events and configuration files using AJAX and a browser. > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > _______________________________________________ > > NFS maillist - NFS@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/nfs > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > NFS maillist - NFS@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/nfs Thanks. Regards, Prasad Potluri email: pvp at-sign us dot ibm dot com --0__=08BBF9ECDFC7FC228f9e8a93df938690918c08BBF9ECDFC7FC22 Content-type: text/html; charset=US-ASCII Content-Disposition: inline

nfs-bounces@lists.sourceforge.net wrote on 10/24/2007 03:57:36 PM:

> On Wed, Oct 24, 2007 at 03:14:32PM -0500, Prasad P wrote:
> >
> >
> > Dereferenced pointer "dentry" without checking and assigned to inode
> > in the declaration.
>
> Seems reasonable, but: looking at nfsd_dispatch(), it appears that the
> encode function is never called in this case (since rq_vers == 2 and
> nfsacld_proc_getacl() would have returned an error if it couldn't find a
> dentry).  Am I missing something?  Do you have a test case?
>
> --b.

No, I don't have a test case.  This error was found by coverity scan.

After declaration of the variables, we actually check the dentry and
dentry->d_inode, and if they are not NULL, assign dentry->d_inode to inode
variable.

if (dentry == NULL || dentry->d_inode == NULL)
return 0;
inode = dentry->d_inode;

>
>
> >
> > Cc: Steve French <smfltc@us.ibm.com>
> > Signed-off-by: Prasad V Potluri <pvp@us.ibm.com>
> > ---
> >
> > diff -uprN a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c
> > --- a/fs/nfsd/nfs2acl.c 2007-10-09 15:31:38.000000000 -0500
> > +++ b/fs/nfsd/nfs2acl.c 2007-10-24 14:03:13.000000000 -0500
> > @@ -221,7 +221,7 @@ static int nfsaclsvc_encode_getaclres(st
> >             struct nfsd3_getaclres *resp)
> >  {
> >       struct dentry *dentry = resp->fh.fh_dentry;
> > -     struct inode *inode = dentry->d_inode;
> > +     struct inode *inode;
> >       struct kvec *head = rqstp->rq_res.head;
> >       unsigned int base;
> >       int n;
> > --
> > Thanks.
> >
> > Regards,
> > Prasad Potluri
> > email: pvp at-sign us dot ibm dot com
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems?  Stop.
> > Now Search log events and configuration files using AJAX and a browser.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > _______________________________________________
> > NFS maillist  -  NFS@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/nfs
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> NFS maillist  -  NFS@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nfs
Thanks.


Regards,
Prasad Potluri
email: pvp at-sign us dot ibm dot com
--0__=08BBF9ECDFC7FC228f9e8a93df938690918c08BBF9ECDFC7FC22-- --===============2025350691== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ --===============2025350691== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ NFS maillist - NFS@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nfs --===============2025350691==--