From: Al Viro Date: Tue, 8 Mar 2016 03:17:07 +0000 (-0500) Subject: ncpfs: fix a braino in OOM handling in ncp_fill_cache() X-Git-Tag: firefly_0821_release~176^2~4^2~51^2~69 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3c92cc68a18238456bda23678d96e91afd9a8f6c;p=firefly-linux-kernel-4.4.55.git ncpfs: fix a braino in OOM handling in ncp_fill_cache() commit 803c00123a8012b3a283c0530910653973ef6d8f upstream. Failing to allocate an inode for child means that cache for *parent* is incompletely populated. So it's parent directory inode ('dir') that needs NCPI_DIR_CACHE flag removed, *not* the child inode ('inode', which is what we'd failed to allocate in the first place). Fucked-up-in: commit 5e993e25 ("ncpfs: get rid of d_validate() nonsense") Fucked-up-by: Al Viro Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c index f0e3e9e747dd..03446c5a3ec1 100644 --- a/fs/ncpfs/dir.c +++ b/fs/ncpfs/dir.c @@ -633,7 +633,7 @@ ncp_fill_cache(struct file *file, struct dir_context *ctx, d_rehash(newdent); } else { spin_lock(&dentry->d_lock); - NCP_FINFO(inode)->flags &= ~NCPI_DIR_CACHE; + NCP_FINFO(dir)->flags &= ~NCPI_DIR_CACHE; spin_unlock(&dentry->d_lock); } } else {