]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.4.48/cifs-only-set-ops-for-inodes-in-i_new-state.patch
Linux 4.14.117
[thirdparty/kernel/stable-queue.git] / releases / 3.4.48 / cifs-only-set-ops-for-inodes-in-i_new-state.patch
1 From c2b93e0699723700f886ce17bb65ffd771195a6d Mon Sep 17 00:00:00 2001
2 From: Jeff Layton <jlayton@redhat.com>
3 Date: Tue, 7 May 2013 11:28:31 -0400
4 Subject: cifs: only set ops for inodes in I_NEW state
5
6 From: Jeff Layton <jlayton@redhat.com>
7
8 commit c2b93e0699723700f886ce17bb65ffd771195a6d upstream.
9
10 It's generally not safe to reset the inode ops once they've been set. In
11 the case where the inode was originally thought to be a directory and
12 then later found to be a DFS referral, this can lead to an oops when we
13 try to trigger an inode op on it after changing the ops to the blank
14 referral operations.
15
16 Reported-and-Tested-by: Sachin Prabhu <sprabhu@redhat.com>
17 Signed-off-by: Jeff Layton <jlayton@redhat.com>
18 Signed-off-by: Steve French <smfrench@gmail.com>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20
21 ---
22 fs/cifs/inode.c | 3 ++-
23 1 file changed, 2 insertions(+), 1 deletion(-)
24
25 --- a/fs/cifs/inode.c
26 +++ b/fs/cifs/inode.c
27 @@ -173,7 +173,8 @@ cifs_fattr_to_inode(struct inode *inode,
28
29 if (fattr->cf_flags & CIFS_FATTR_DFS_REFERRAL)
30 inode->i_flags |= S_AUTOMOUNT;
31 - cifs_set_ops(inode);
32 + if (inode->i_state & I_NEW)
33 + cifs_set_ops(inode);
34 }
35
36 void