DivestOS/Patches/Linux_CVEs/LVT-2017-0002/0.patch
2017-10-29 04:19:13 -04:00

27 lines
788 B
Diff

From 20ad8a951b24ec89e887070364b386169b3ad89a Mon Sep 17 00:00:00 2001
From: Tom Marshall <tdm.code@gmail.com>
Date: Thu, 18 May 2017 23:50:22 +0000
Subject: [PATCH] kernel: Fix potential refcount leak in su check
Change-Id: I8d2c8bed65a01eb0928308df638a04449a5bd881
---
fs/namei.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/namei.c b/fs/namei.c
index 40d9a30eaf3a..bdfbb34dd137 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2029,8 +2029,10 @@ static int path_lookupat(int dfd, const char *name,
if (!err) {
struct super_block *sb = nd->inode->i_sb;
if (sb->s_flags & MS_RDONLY) {
- if (d_is_su(nd->path.dentry) && !su_visible())
+ if (d_is_su(nd->path.dentry) && !su_visible()) {
+ path_put(&nd->path);
err = -ENOENT;
+ }
}
}