Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp5278385imd; Tue, 30 Oct 2018 15:00:54 -0700 (PDT) X-Google-Smtp-Source: AJdET5dbMxzWmSWvGl4ImQtfWN88YMQLFCDo2OlBj8Oy9RsOIQ2GEa9jZdD7JSilRaSBHhrPAeD3 X-Received: by 2002:a62:b802:: with SMTP id p2-v6mr470413pfe.1.1540936853989; Tue, 30 Oct 2018 15:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540936853; cv=none; d=google.com; s=arc-20160816; b=SKwndbnDpSJtuA6AeisakGu06V47N4dlIMowd49T/W1Qg3VLl8M+YXYJ+/CznG1GZa OvjH0Vlzu998tph11b1i25JytyjsOiMiOWk4SpEdlyOMf20TeLSjI0cQkv5FHak/tnmR nHbQTuvnGQV56WG13DfLOSVvxGSODGlscUmwZtCTRWVsuhlx6tT8wzA9NmLg04XewCiw eeIYZubvuFCyua4x1FOSk9oA73NJuaU8ek1WDJ5X7mg9BkaLYB4cLY+NOyu8m6Ci+loZ OmlTVfeYX8pBdeNgR4P8hJBmvcaT+A5f/VZozIfysEISD3vk3nsP0D4Yhy1JpWTtQdgx /GQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from; bh=3KIQ2/dSY7hPvlzURLoRBSz8ctr3UKVWip56RXSzxUg=; b=MCmJZZ5n7l8wrma+++g26ebFZcaOgfhn26vzhSKEwg9MKnRCw+FF6B6eRHaqpN+pe9 ChjwGhwj2YLMsUbUtG6Mgg6OFWEsdobSvZy+G6YV+UkvaCliKEv/c0u4iIl9bOacYmzw /ZQ2r1P2Q8HVh8MXK69gkn/BzN6VmWbmFOWJMNOG/vl7SmG4zdKi2cvSGvD2vWVpKaN2 A4UbxvZtgHq6XUOG668PGQKrNZ1o+sI0f8Una+C8s9YaPmX8hrsaxV6csX1li05wB/gx ri/ZiDYCOvemnykN6I7KMIePlzgC1nWX/Unp4lgG5uXXt86kXY9F3luXWb4k2PcUmRa5 yndw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s22-v6si35000932pfs.13.2018.10.30.15.00.37; Tue, 30 Oct 2018 15:00:53 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728376AbeJaGyI (ORCPT + 99 others); Wed, 31 Oct 2018 02:54:08 -0400 Received: from relay.sw.ru ([185.231.240.75]:46020 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725743AbeJaGyH (ORCPT ); Wed, 31 Oct 2018 02:54:07 -0400 Received: from [172.16.24.21] by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1gHc2H-0003hQ-Vl; Wed, 31 Oct 2018 00:58:54 +0300 From: Vasily Averin Subject: [PATCH v2 11/11] ext4: access to uninitialized bh fields in ext4_xattr_set_handle() To: linux-ext4@vger.kernel.org, Theodore Ts'o Cc: Andreas Dilger , linux-kernel@vger.kernel.org References: Message-ID: Date: Wed, 31 Oct 2018 00:58:53 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On-stack initialization does not guarantee zeroying of unintialized fields. So is.iloc.bh and bs.bh can be contain garbage of old stack conent. Errors in the beginning of ext4_xattr_set_handle() function lead to jump to "cleanup:" label where brelse(is.iloc.bh) and brelse(bs.bh) can access uninitialized bh fields of on-stack located "is" and "bs" structures. Issue was inherited from ext3 and was present in first ext4 commit. Fixes ac27a0ec112a ("ext4: initial copy of files from ext3") # 2.6.19 Signed-off-by: Vasily Averin --- fs/ext4/xattr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index dc1aeab06dba..aae12425597e 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -2303,9 +2303,11 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, }; struct ext4_xattr_ibody_find is = { .s = { .not_found = -ENODATA, }, + .iloc = { .bh = NULL, }, }; struct ext4_xattr_block_find bs = { .s = { .not_found = -ENODATA, }, + .bh = NULL, }; int no_expand; int error; -- 2.17.1