#include <linux/types.h>
#include <linux/sched.h>
#include <linux/slab.h>
+#include <linux/capability.h>
#include <linux/fs.h>
#include <linux/namei.h>
#include <linux/mm.h>
int j = strlen (p);
if (j > 15) j = 15;
- if (IS_RDONLY(inode)) i = 1;
+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt)) i = 1;
if (mnt->mnt_flags & MNT_NOSUID) i |= 2;
if (!sysv_valid_dev(inode->i_sb->s_dev))
return -EOVERFLOW;
int j = strlen (p);
if (j > 15) j = 15;
- if (IS_RDONLY(inode)) i = 1;
+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt)) i = 1;
if (mnt->mnt_flags & MNT_NOSUID) i |= 2;
if (!sysv_valid_dev(inode->i_sb->s_dev))
return -EOVERFLOW;
{
switch (cmd) {
case 1: /* UL_GETFSIZE - in 512B chunks */
- return current->rlim[RLIMIT_FSIZE].rlim_cur >> 9;
+ return current->signal->rlim[RLIMIT_FSIZE].rlim_cur >> 9;
case 2: /* UL_SETFSIZE */
if ((unsigned long)val > (LONG_MAX>>9)) return -ERANGE;
val <<= 9;
- lock_kernel();
- if (val > current->rlim[RLIMIT_FSIZE].rlim_max) {
+ task_lock(current->group_leader);
+ if (val > current->signal->rlim[RLIMIT_FSIZE].rlim_max) {
if (!capable(CAP_SYS_RESOURCE)) {
- unlock_kernel();
+ task_unlock(current->group_leader);
return -EPERM;
}
- current->rlim[RLIMIT_FSIZE].rlim_max = val;
+ current->signal->rlim[RLIMIT_FSIZE].rlim_max = val;
}
- current->rlim[RLIMIT_FSIZE].rlim_cur = val;
- unlock_kernel();
+ current->signal->rlim[RLIMIT_FSIZE].rlim_cur = val;
+ task_unlock(current->group_leader);
return 0;
case 3: /* UL_GMEMLIM */
- return current->rlim[RLIMIT_DATA].rlim_cur;
+ return current->signal->rlim[RLIMIT_DATA].rlim_cur;
case 4: /* UL_GDESLIM */
return NR_OPEN;
}