Received: by 10.192.165.148 with SMTP id m20csp2476410imm; Sun, 22 Apr 2018 07:51:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/DvFOBvT9UB7zPnZsdgeZSVP966LyRoJVvPgFKj0wd0BoDMJJLB8/eFcJC7Nsbb6CPoH+H X-Received: by 2002:a17:902:7c0e:: with SMTP id x14-v6mr18011959pll.392.1524408667906; Sun, 22 Apr 2018 07:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524408667; cv=none; d=google.com; s=arc-20160816; b=Q4MsEsIW8c9wVzlYNOQUopRtEp15YOyHYpk7yc+7q/J0M7kOcwLYFlst5Q7Ym9oIkf tFvsO5YY2Ys/Y24GMpySk7cAAA/bOUAHiVZd0oLXSFehg/3mZHmn0LXbYLo3LbxV0s92 HuGgs8Fsh/tDkAnysCXulQ6L2G5PbCqqvC715uAsQnBOM77N21HQJJxKoznOXaDjEgZj imijFloDPcxW3c4ZeWKcYL+QRyznsT/LkhiYRj0y0hsO7jRpp6Hg9Enk96fmzz06c5oP Bj5XWaKBFTnTPjfatRhIvaEVx13iUJWgwNlCK7jKvaulZP2Y74muOz9KBZ0gH30h66Np uK2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=GLHU7wMnj27i068U9c8uUZsH/5EhJwRu04vtIqFgrHo=; b=rPTZOmqQJgC7iEVVZi8hhDbka3iHdf8UVfJSOJkF2QQwrr5VCre7g0lNLXnTWRtgH+ Crz+00rlLfzyCTjCLDDLPP6D3EGPKdTwEm+NcLMWFefBKD987cjQZxR5akrj8vT1w0qt T22wZbZeK1uSrYjJRYzw5vLrD5+PBhUCDoONuGciTMYInlqJQOjPsmRA9NEOSW1I8KrS DBQOvjqz/E1QgkMNnm/7JiZSFoMqoqnBWsz59H/MO5JdQHk13gl6mBhXO0/HalF8q42b NghcMk5dTVQuFpasJkF1ThRRmqFLl3Azafwa/UdXngOxdIzyh2g8xAZ+Ue6nkXkTG/SP 8zkw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p188si8224645pga.206.2018.04.22.07.50.53; Sun, 22 Apr 2018 07:51:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757226AbeDVOtd (ORCPT + 99 others); Sun, 22 Apr 2018 10:49:33 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56934 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757074AbeDVOPi (ORCPT ); Sun, 22 Apr 2018 10:15:38 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1605C4A5; Sun, 22 Apr 2018 14:15:37 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro Subject: [PATCH 4.4 13/97] getname_kernel() needs to make sure that ->name != ->iname in long case Date: Sun, 22 Apr 2018 15:52:51 +0200 Message-Id: <20180422135305.377409538@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135304.577223025@linuxfoundation.org> References: <20180422135304.577223025@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Al Viro commit 30ce4d1903e1d8a7ccd110860a5eef3c638ed8be upstream. missed it in "kill struct filename.separate" several years ago. Cc: stable@vger.kernel.org Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman --- fs/namei.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/namei.c +++ b/fs/namei.c @@ -219,9 +219,10 @@ getname_kernel(const char * filename) if (len <= EMBEDDED_NAME_MAX) { result->name = (char *)result->iname; } else if (len <= PATH_MAX) { + const size_t size = offsetof(struct filename, iname[1]); struct filename *tmp; - tmp = kmalloc(sizeof(*tmp), GFP_KERNEL); + tmp = kmalloc(size, GFP_KERNEL); if (unlikely(!tmp)) { __putname(result); return ERR_PTR(-ENOMEM);