From: Jeff Layton <jlayton@redhat.com>
To: Jiri Slaby <jslaby@suse.cz>
Cc: sfrench@samba.org, linux-kernel@vger.kernel.org,
jirislaby@gmail.com, linux-cifs@vger.kernel.org
Subject: Re: [PATCH 2/4] FS: cifs, remove unneeded NULL tests
Date: Wed, 27 Oct 2010 12:13:38 -0400 [thread overview]
Message-ID: <20101027121338.2984b9d8@corrin.poochiereds.net> (raw)
In-Reply-To: <1288180220-19869-1-git-send-email-jslaby@suse.cz>
On Wed, 27 Oct 2010 13:50:20 +0200
Jiri Slaby <jslaby@suse.cz> wrote:
> Stanse found that pSMBFile in cifs_ioctl and file->f_path.dentry in
> cifs_user_write are dereferenced prior their test to NULL.
>
> The alternative is not to dereference them before the tests. The patch is
> to point out the problem, you have to decide.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Steve French <sfrench@samba.org>
> Cc: linux-cifs@vger.kernel.org
> ---
> fs/cifs/file.c | 2 +-
> fs/cifs/ioctl.c | 4 ----
> 2 files changed, 1 insertions(+), 5 deletions(-)
>
> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> index 45af003..db7eaf7 100644
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -1031,7 +1031,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
> cifs_stats_bytes_written(pTcon, total_written);
>
> /* since the write may have blocked check these pointers again */
> - if ((file->f_path.dentry) && (file->f_path.dentry->d_inode)) {
> + if (file->f_path.dentry->d_inode) {
^^^^^^
This check is bogus too. An open filp on a negative dentry
isn't possible, right?
> struct inode *inode = file->f_path.dentry->d_inode;
> /* Do not update local mtime - server will set its actual value on write
> * inode->i_ctime = inode->i_mtime =
> diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c
> index 077bf75..2fa22f2 100644
> --- a/fs/cifs/ioctl.c
> +++ b/fs/cifs/ioctl.c
> @@ -63,8 +63,6 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
> #ifdef CONFIG_CIFS_POSIX
> case FS_IOC_GETFLAGS:
> if (CIFS_UNIX_EXTATTR_CAP & caps) {
> - if (pSMBFile == NULL)
> - break;
> rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid,
> &ExtAttrBits, &ExtAttrMask);
> if (rc == 0)
> @@ -80,8 +78,6 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
> rc = -EFAULT;
> break;
> }
> - if (pSMBFile == NULL)
> - break;
> /* rc= CIFSGetExtAttr(xid,tcon,pSMBFile->netfid,
> extAttrBits, &ExtAttrMask);*/
> }
Acked-by: Jeff Layton <jlayton@redhat.com>
next prev parent reply other threads:[~2010-10-27 16:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-27 11:50 Jiri Slaby
2010-10-27 16:13 ` Jeff Layton [this message]
2010-10-27 16:14 ` Christoph Hellwig
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=20101027121338.2984b9d8@corrin.poochiereds.net \
--to=jlayton@redhat.com \
--cc=jirislaby@gmail.com \
--cc=jslaby@suse.cz \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sfrench@samba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®