aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-04-08 11:57:10 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2018-04-08 11:57:10 -0400
commit30ce4d1903e1d8a7ccd110860a5eef3c638ed8be (patch)
treefe8363d07b0f25e55575199eab2f880508b7afcb
parent8613a209ffa6dd2c19c405fa699a062035dec9b0 (diff)
getname_kernel() needs to make sure that ->name != ->iname in long case
missed it in "kill struct filename.separate" several years ago. Cc: stable@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/namei.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 6e0f6eea9896..3aefcf74f041 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -222,9 +222,10 @@ getname_kernel(const char * filename)
222 if (len <= EMBEDDED_NAME_MAX) { 222 if (len <= EMBEDDED_NAME_MAX) {
223 result->name = (char *)result->iname; 223 result->name = (char *)result->iname;
224 } else if (len <= PATH_MAX) { 224 } else if (len <= PATH_MAX) {
225 const size_t size = offsetof(struct filename, iname[1]);
225 struct filename *tmp; 226 struct filename *tmp;
226 227
227 tmp = kmalloc(sizeof(*tmp), GFP_KERNEL); 228 tmp = kmalloc(size, GFP_KERNEL);
228 if (unlikely(!tmp)) { 229 if (unlikely(!tmp)) {
229 __putname(result); 230 __putname(result);
230 return ERR_PTR(-ENOMEM); 231 return ERR_PTR(-ENOMEM);