Commit c2b93e0699723700f886ce17bb65ffd771195a6d

Authored by Jeff Layton
Committed by Steve French
1 parent ebb3727779

cifs: only set ops for inodes in I_NEW state

It's generally not safe to reset the inode ops once they've been set. In
the case where the inode was originally thought to be a directory and
then later found to be a DFS referral, this can lead to an oops when we
try to trigger an inode op on it after changing the ops to the blank
referral operations.

Cc: <stable@vger.kernel.org>
Reported-and-Tested-by: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>

Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff

... ... @@ -171,7 +171,8 @@
171 171  
172 172 if (fattr->cf_flags & CIFS_FATTR_DFS_REFERRAL)
173 173 inode->i_flags |= S_AUTOMOUNT;
174   - cifs_set_ops(inode);
  174 + if (inode->i_state & I_NEW)
  175 + cifs_set_ops(inode);
175 176 }
176 177  
177 178 void