CRED: Separate task security context from task_struct
[linux-2.6-block.git] / fs / file_table.c
index efc06faede6c3d6c27c324da2042b7d324e53f8e..3152b53cfab0a1de17de4b77b2d04ae6150e2e60 100644 (file)
@@ -122,8 +122,8 @@ struct file *get_empty_filp(void)
        INIT_LIST_HEAD(&f->f_u.fu_list);
        atomic_long_set(&f->f_count, 1);
        rwlock_init(&f->f_owner.lock);
-       f->f_uid = tsk->fsuid;
-       f->f_gid = tsk->fsgid;
+       f->f_uid = tsk->cred->fsuid;
+       f->f_gid = tsk->cred->fsgid;
        eventpoll_init_file(f);
        /* f->f_version: 0 */
        return f;
@@ -269,6 +269,10 @@ void __fput(struct file *file)
        eventpoll_release(file);
        locks_remove_flock(file);
 
+       if (unlikely(file->f_flags & FASYNC)) {
+               if (file->f_op && file->f_op->fasync)
+                       file->f_op->fasync(-1, file, 0);
+       }
        if (file->f_op && file->f_op->release)
                file->f_op->release(inode, file);
        security_file_free(file);