Commit 177f8fc4 authored by Al Viro's avatar Al Viro Committed by Mike Marshall

orangefs: sanitize ->llseek()

a) open files can't have NULL inodes
b) it's SEEK_END, not ORANGEFS_SEEK_END; no need to get cute.
c) make_bad_inode() on lseek()?
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarMike Marshall <hubcap@omnibond.com>
parent 7df240d7
...@@ -652,14 +652,9 @@ static int orangefs_fsync(struct file *file, ...@@ -652,14 +652,9 @@ static int orangefs_fsync(struct file *file,
static loff_t orangefs_file_llseek(struct file *file, loff_t offset, int origin) static loff_t orangefs_file_llseek(struct file *file, loff_t offset, int origin)
{ {
int ret = -EINVAL; int ret = -EINVAL;
struct inode *inode = file->f_path.dentry->d_inode; struct inode *inode = file_inode(file);
if (!inode) { if (origin == SEEK_END) {
gossip_err("orangefs_file_llseek: invalid inode (NULL)\n");
return ret;
}
if (origin == ORANGEFS_SEEK_END) {
/* /*
* revalidate the inode's file size. * revalidate the inode's file size.
* NOTE: We are only interested in file size here, * NOTE: We are only interested in file size here,
...@@ -674,7 +669,6 @@ static loff_t orangefs_file_llseek(struct file *file, loff_t offset, int origin) ...@@ -674,7 +669,6 @@ static loff_t orangefs_file_llseek(struct file *file, loff_t offset, int origin)
__FILE__, __FILE__,
__func__, __func__,
__LINE__); __LINE__);
orangefs_make_bad_inode(inode);
return ret; return ret;
} }
} }
...@@ -684,7 +678,7 @@ static loff_t orangefs_file_llseek(struct file *file, loff_t offset, int origin) ...@@ -684,7 +678,7 @@ static loff_t orangefs_file_llseek(struct file *file, loff_t offset, int origin)
" | inode size is %lu\n", " | inode size is %lu\n",
(long)offset, (long)offset,
origin, origin,
(unsigned long)file->f_path.dentry->d_inode->i_size); (unsigned long)i_size_read(inode));
return generic_file_llseek(file, offset, origin); return generic_file_llseek(file, offset, origin);
} }
......
...@@ -70,7 +70,6 @@ ...@@ -70,7 +70,6 @@
#define ORANGEFS_DEVREQ_MAGIC 0x20030529 #define ORANGEFS_DEVREQ_MAGIC 0x20030529
#define ORANGEFS_LINK_MAX 0x000000FF #define ORANGEFS_LINK_MAX 0x000000FF
#define ORANGEFS_PURGE_RETRY_COUNT 0x00000005 #define ORANGEFS_PURGE_RETRY_COUNT 0x00000005
#define ORANGEFS_SEEK_END 0x00000002
#define ORANGEFS_MAX_NUM_OPTIONS 0x00000004 #define ORANGEFS_MAX_NUM_OPTIONS 0x00000004
#define ORANGEFS_MAX_MOUNT_OPT_LEN 0x00000080 #define ORANGEFS_MAX_MOUNT_OPT_LEN 0x00000080
#define ORANGEFS_MAX_FSKEY_LEN 64 #define ORANGEFS_MAX_FSKEY_LEN 64
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment