···486486 if (!(nd.mnt->mnt_flags & MNT_NOEXEC) &&487487 S_ISREG(inode->i_mode)) {488488 int err = vfs_permission(&nd, MAY_EXEC);489489- if (!err && !(inode->i_mode & 0111))490490- err = -EACCES;491489 file = ERR_PTR(err);492490 if (!err) {493491 file = nameidata_to_filp(&nd, O_RDONLY);···920922 int retval;921923922924 mode = inode->i_mode;923923- /*924924- * Check execute perms again - if the caller has CAP_DAC_OVERRIDE,925925- * generic_permission lets a non-executable through926926- */927927- if (!(mode & 0111)) /* with at least _one_ execute bit set */928928- return -EACCES;929925 if (bprm->file->f_op == NULL)930926 return -EACCES;931927
+9-6
fs/lockd/svcsubs.c
···237237nlm_traverse_files(struct nlm_host *host, int action)238238{239239 struct nlm_file *file, **fp;240240- int i;240240+ int i, ret = 0;241241242242 mutex_lock(&nlm_file_mutex);243243 for (i = 0; i < FILE_NRHASH; i++) {244244 fp = nlm_files + i;245245 while ((file = *fp) != NULL) {246246+ file->f_count++;247247+ mutex_unlock(&nlm_file_mutex);248248+246249 /* Traverse locks, blocks and shares of this file247250 * and update file->f_locks count */248248- if (nlm_inspect_file(host, file, action)) {249249- mutex_unlock(&nlm_file_mutex);250250- return 1;251251- }251251+ if (nlm_inspect_file(host, file, action))252252+ ret = 1;252253254254+ mutex_lock(&nlm_file_mutex);255255+ file->f_count--;253256 /* No more references to this file. Let go of it. */254257 if (!file->f_blocks && !file->f_locks255258 && !file->f_shares && !file->f_count) {···265262 }266263 }267264 mutex_unlock(&nlm_file_mutex);268268- return 0;265265+ return ret;269266}270267271268/*
+10-1
fs/namei.c
···227227228228int permission(struct inode *inode, int mask, struct nameidata *nd)229229{230230+ umode_t mode = inode->i_mode;230231 int retval, submask;231232232233 if (mask & MAY_WRITE) {233233- umode_t mode = inode->i_mode;234234235235 /*236236 * Nobody gets write access to a read-only fs.···246246 return -EACCES;247247 }248248249249+250250+ /*251251+ * MAY_EXEC on regular files requires special handling: We override252252+ * filesystem execute permissions if the mode bits aren't set.253253+ */254254+ if ((mask & MAY_EXEC) && S_ISREG(mode) && !(mode & S_IXUGO))255255+ return -EACCES;249256250257 /* Ordinary permission routines do not understand MAY_APPEND. */251258 submask = mask & ~MAY_APPEND;···17741767 if (nd->last_type != LAST_NORM)17751768 goto fail;17761769 nd->flags &= ~LOOKUP_PARENT;17701770+ nd->flags |= LOOKUP_CREATE;17711771+ nd->intent.open.flags = O_EXCL;1777177217781773 /*17791774 * Do the final lookup.