When a dentry becomes invalid we can safely kill it and free the
associated memory. This fixes a memory leakage in the tftp and nfs
code as these regularly declare a dentry as invalid.

Signed-off-by: Sascha Hauer <[email protected]>
---
 fs/fs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/fs.c b/fs/fs.c
index f24962d2a6..a9d2cc7088 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1577,6 +1577,7 @@ static struct dentry *lookup_dcache(const struct qstr 
*name,
                        if (!error)
                                d_invalidate(dentry);
                        dput(dentry);
+                       dentry_kill(dentry);
                        return ERR_PTR(error);
                }
        }

-- 
2.39.5


Reply via email to