Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 16512
b: refs/heads/master
c: 9f708e4
h: refs/heads/master
v: v3
  • Loading branch information
Neil Brown authored and Linus Torvalds committed Jan 6, 2006
1 parent b960182 commit 8b0a9fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a334de28665b14f0a33df82699fa9a78cfeedf31
refs/heads/master: 9f708e40fe040e79f6c393a282f0701c9f8dc174
20 changes: 12 additions & 8 deletions trunk/fs/nfsd/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,16 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
return err;
}

static void kill_suid(struct dentry *dentry)
{
struct iattr ia;
ia.ia_valid = ATTR_KILL_SUID | ATTR_KILL_SGID;

down(&dentry->d_inode->i_sem);
notify_change(dentry, &ia);
up(&dentry->d_inode->i_sem);
}

static inline int
nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
loff_t offset, struct kvec *vec, int vlen,
Expand Down Expand Up @@ -933,14 +943,8 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
}

/* clear setuid/setgid flag after write */
if (err >= 0 && (inode->i_mode & (S_ISUID | S_ISGID))) {
struct iattr ia;
ia.ia_valid = ATTR_KILL_SUID | ATTR_KILL_SGID;

down(&inode->i_sem);
notify_change(dentry, &ia);
up(&inode->i_sem);
}
if (err >= 0 && (inode->i_mode & (S_ISUID | S_ISGID)))
kill_suid(dentry);

if (err >= 0 && stable) {
static ino_t last_ino;
Expand Down

0 comments on commit 8b0a9fe

Please sign in to comment.