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
6 From: Jeff Layton <jlayton@redhat.com>
8 commit c2b93e0699723700f886ce17bb65ffd771195a6d upstream.
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
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>
22 fs/cifs/inode.c | 3 ++-
23 1 file changed, 2 insertions(+), 1 deletion(-)
27 @@ -173,7 +173,8 @@ cifs_fattr_to_inode(struct inode *inode,
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);