From: Christoph Hellwig <hch@lst.de>
To: Steve French <smfrench@austin.rr.com>
Cc: linux-kernel@vger.kernel.org, hch@lst.de, akpm@linux-foundation.org
Subject: Re: + cifs-remove-unneeded-checks.patch added to -mm tree
Date: Mon, 2 Apr 2007 22:12:57 +0200 [thread overview]
Message-ID: <20070402201257.GA8705@lst.de> (raw)
In-Reply-To: <1175546161.4306.9.camel@smf-t60p.smfdom>
On Mon, Apr 02, 2007 at 03:36:01PM -0500, Steve French wrote:
> I merged most of Christoph's cifs-remove-unneeded-checks patch into the
> cifs-2.6 development tree. The part I did not merge was a little harder
> to verify and vaguely reminded me of the old bug report. The part I
> left out is attached (I don't mind leaving that part in mm a little
> longer to make sure it is safe).
diff -Nau /home/stevef/linux-2.6/fs/cifs/file.c /home/stevef/virtfs-2.6/fs/cifs/file.c
--- /home/stevef/linux-2.6/fs/cifs/file.c 2007-04-02 13:55:36.000000000 -0500
+++ /home/stevef/virtfs-2.6/fs/cifs/file.c 2007-04-02 13:48:29.000000000 -0500
@@ -352,8 +352,6 @@
int disposition = FILE_OPEN;
__u16 netfid;
- if (inode == NULL)
- return -EBADF;
This is cifs_reopen_file. One of the callers (find_writable_file) calls
this with the &cifs_inode->vfs_inode as inode argument, which can't be
NULL per definition. All other callers pass
file->f_path.dentry->d_inode as inode argument, which per definition is
not never zero, because there are not file structs arount that don't
point to an inode.
Note that you could nicely simplify the find_writable_file calling
conventions by not passing the inode argument explicitly at all, but
rather always deriving it from file->f_path.dentry->d_inode inside
the function body.
if (file->private_data) {
pCifsFile = (struct cifsFileInfo *)file->private_data;
} else
@@ -367,12 +365,6 @@
return 0;
}
- if (file->f_path.dentry == NULL) {
- up(&pCifsFile->fh_sem);
- cFYI(1, ("failed file reopen, no valid name if dentry freed"));
- FreeXid(xid);
- return -EBADF;
- }
@@ -784,6 +776,7 @@
ssize_t cifs_user_write(struct file *file, const char __user *write_data,
size_t write_size, loff_t *poffset)
{
+ struct inode *inode = file->f_path.dentry->d_inode;
int rc = 0;
unsigned int bytes_written = 0;
unsigned int total_written;
@@ -831,11 +824,6 @@
return -EBADF;
}
if (open_file->invalidHandle) {
- if ((file->f_path.dentry == NULL) ||
- (file->f_path.dentry->d_inode == NULL)) {
- FreeXid(xid);
- return total_written;
- }
Same again here, there's no fscking chance read/write could ever work
without a dentry or inode.
prev parent reply other threads:[~2007-04-02 20:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <OFD0781213.454F562D-ON872572B1.0067861B-862572B1.00679895@us.ibm.com>
2007-04-02 20:36 ` + cifs-remove-unneeded-checks.patch added to -mm tree Steve French
2007-04-02 20:12 ` Christoph Hellwig [this message]
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=20070402201257.GA8705@lst.de \
--to=hch@lst.de \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=smfrench@austin.rr.com \
/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