Received: by 10.192.165.156 with SMTP id m28csp231384imm; Tue, 17 Apr 2018 09:12:09 -0700 (PDT) X-Google-Smtp-Source: AIpwx48A+Ihr6pjp3m66+F0eG53rhaRR8JNGo4Bd/+EduANL/Ftmhyhf39FGBuadPjjkRFDpeGGF X-Received: by 10.98.89.70 with SMTP id n67mr2565914pfb.150.1523981529491; Tue, 17 Apr 2018 09:12:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523981529; cv=none; d=google.com; s=arc-20160816; b=bmONzVuToEcsyvWTDsCaUDTNnfaDHeu1RjoerlT3o+tKQZWPl805nLduv5VhC/vfG7 33txe0UtCxk3UN9evEAvCw1xXXU7bk2InPS3ItN2T7iY94qfzFXB4Hl1lcddDwDoHt5d 1Q1NTQzRkb36/ZeLZ1GaQ/uTPM/G8IHSebhbSKfbMfhlZYWKplhH+rYJZzUMOgWwxgPz tP6Aia7jk5Th2QVQ2IItkVOnUKb+8jKVtC++8v/vUm5C8NgDcPBgWotfaLfTzS+MBw1O 0yxamoVT5EeiUgfaJ/ZOh6x0ck1MllrbXT+VIMSFni/pTOtBEzzlb//T+oAS/dlr4IAc MtxA== 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=7H/BShoOjiR0DutAihJ7yLYiYv6UCTpHNFLI2ILhEZ0=; b=ue8iqRp+4FgyGGRV0v+Ok4mpUUTSgFZgU3Cjegz7WwOn14o75vx6WLSBOw0aS3DeyL 8mgmVWeXj+tbqcOu6f78KfKbv6VuMtwKJkgYnicpyJuvqBjXmiACYLwVwh930tW3WpIV DbVd9A/iCIkPcL9FkYU/UoOQn5A07W3kEAD6wY+T6wHhj5ZS2FVtF8IdqHDuEKUXcEEt 94uPcuyeNX2bDQgwuUz6T2i3HiLoNLscLENnaaulJ0z19Dox9ml4hHDjZvxa7AbvEuy1 XU1nqzrntC9WE45INmgxfb3LvLeAA/EPen7MhYEpgW0uADusZWDfIIM6WVn9IWmeHePy ITQw== 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 n7si5332414pgt.480.2018.04.17.09.11.55; Tue, 17 Apr 2018 09:12:09 -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 S1755853AbeDQQK2 (ORCPT + 99 others); Tue, 17 Apr 2018 12:10:28 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36410 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755507AbeDQQK0 (ORCPT ); Tue, 17 Apr 2018 12:10:26 -0400 Received: from localhost (unknown [46.44.180.42]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D70CDD0B; Tue, 17 Apr 2018 16:10:25 +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.9 58/66] getname_kernel() needs to make sure that ->name != ->iname in long case Date: Tue, 17 Apr 2018 17:59:31 +0200 Message-Id: <20180417155648.392395989@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180417155645.868055442@linuxfoundation.org> References: <20180417155645.868055442@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.9-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 @@ -221,9 +221,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);