Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2969510imu; Sun, 9 Dec 2018 13:56:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/VUGwW2Py1cVyXnO0/FiEVc5y3/tKETsxyowP/eJnHTqLunMarU/h/4bn0yll3PTr3wi9P4 X-Received: by 2002:a63:c447:: with SMTP id m7mr8751699pgg.27.1544392598796; Sun, 09 Dec 2018 13:56:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544392598; cv=none; d=google.com; s=arc-20160816; b=NzdKsW6/m6sEqKmmDGVC0AKrXkPJ2dzaSdrxEQAbWoAVq1uKBBrAWfUoo4+yta+rTU YIt/ru+9+jcEp+XeucF4zSthqkf29b4g/x0iBJxKc6kwdmg0nbQ4OwpgjgMB3+Pcy3QV s0CjXfK8hxSo/EwbvnNmKFHJ0KGEJvN6feGrgDqsPz2CVm9Xv+0M4HScsTjVzDbHoOnb BjfqfRAFCftYg7+x+8AlFPfMvtX9Q3g1g7uZnqQhaLOtNuEeqfe5UqKb/dSGCrU1BhOV PVuyvT2gWo8ruj+zlwOVAaIc6RVgwwWdtDfmyjeqqD+POdiPXQJwpw+0wkiKEPrxCxx1 c7JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=5gpjXFiHaT/Hmch24/4CWbdpMwsGMaW1Hx6+NPkKB6A=; b=hEvwcXdPh/Pfr/gyXoOEXAKVFqQOWA353xE6LMGp5nzMsDM4TrJPhAr1axW3u0T0Br Q3ki5PBY6Uoq9S5p8lHolFwYSU+b4xG5F+KT8V26Dr9+/XBDgV5mf8SprwxxSTPAF6V8 Egql2NZs9W6CnM97zerM4fxX+i5hYWfvnK7UobOG6KHBaywYb1D9RDG46o+jdy9pOerR VZHRl0hnOHdxO+06xUfpGAPiIVG9wLaeNLFyV473Edqk6G4N/WP0xQE5+mUiMpNG/jDs R+RFE30KnZfo8myZrn9y68wA3m6Y65JBqysoupIt704Ir6XmVIHgdGJBc1jH6228OXBI BdNQ== 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 ay7si8205409plb.410.2018.12.09.13.56.23; Sun, 09 Dec 2018 13:56:38 -0800 (PST) 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 S1726658AbeLIVzb (ORCPT + 99 others); Sun, 9 Dec 2018 16:55:31 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34828 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726421AbeLIVzO (ORCPT ); Sun, 9 Dec 2018 16:55:14 -0500 Received: from pub.yeoldevic.com ([81.174.156.145] helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gW72d-0002im-Uy; Sun, 09 Dec 2018 21:55:12 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gW72b-0003KN-Fm; Sun, 09 Dec 2018 21:55:09 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Wen Xu" , "Theodore Ts'o" Date: Sun, 09 Dec 2018 21:50:33 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 090/328] ext4: check for NUL characters in extended attribute's name In-Reply-To: X-SA-Exim-Connect-IP: 81.174.156.145 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.62-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Theodore Ts'o commit 7d95178c77014dbd8dce36ee40bbbc5e6c121ff5 upstream. Extended attribute names are defined to be NUL-terminated, so the name must not contain a NUL character. This is important because there are places when remove extended attribute, the code uses strlen to determine the length of the entry. That should probably be fixed at some point, but code is currently really messy, so the simplest fix for now is to simply validate that the extended attributes are sane. https://bugzilla.kernel.org/show_bug.cgi?id=200401 Reported-by: Wen Xu Signed-off-by: Theodore Ts'o [bwh: Backported to 3.16: return -EIO instead of -EFSCORRUPTED] Signed-off-by: Ben Hutchings --- fs/ext4/xattr.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -193,6 +193,8 @@ ext4_xattr_check_names(struct ext4_xattr struct ext4_xattr_entry *next = EXT4_XATTR_NEXT(e); if ((void *)next >= end) return -EIO; + if (strnlen(e->e_name, e->e_name_len) != e->e_name_len) + return -EIO; e = next; }