From patchwork Wed May 31 08:15:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tahsin Erdogan X-Patchwork-Id: 9756225 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C33BC60360 for ; Wed, 31 May 2017 08:26:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B119F1FF8F for ; Wed, 31 May 2017 08:26:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A598C283BD; Wed, 31 May 2017 08:26:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A60D1FF8F for ; Wed, 31 May 2017 08:26:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751379AbdEaI0q (ORCPT ); Wed, 31 May 2017 04:26:46 -0400 Received: from mail-pg0-f50.google.com ([74.125.83.50]:33540 "EHLO mail-pg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751325AbdEaIRJ (ORCPT ); Wed, 31 May 2017 04:17:09 -0400 Received: by mail-pg0-f50.google.com with SMTP id u187so4573773pgb.0 for ; Wed, 31 May 2017 01:17:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AseOwf3YMlFmzOA2h9lCSZGkrG/a7ATFA+deJataaNU=; b=FIaOJivMwCnADMwxdx4pBNvGNgxD/vPZyrzgYtvWSBMii5Nd2iIhYOLX085L3KAN5i tykgZEhcb1Xz8YOsTrZnqKn0CESGv6vUYA5mDMlpuH7/YnDRnDl72/T4vtpwaZt3Sv4m FWt/sNy5LobgDsJoVL1lvJ3dDv9BD+DXeSVXl00ig5uAlcd+JqybfpNbfX+VZJGlhWMS kGeaN+iqWMXR2Oj4LLbhCJvL8BedC2rej2vzhRtsFT6PHgJzjcvo0F1YcD1GOwXxMAsg AqJwTyjaWEWlKkCfCu+Lcg5R7UMCUmPNiQwnkYKFNivVjEy19RKpmFrOJki+NrbDcGlE MxoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AseOwf3YMlFmzOA2h9lCSZGkrG/a7ATFA+deJataaNU=; b=i4EgMfa+4LiDvO+mxSQweoslQiuUAr7pYUEZW/FeAoa9dwmlchSJkeXqDh1nV/NX+6 bdYCZuEOAF0+QqH2aNFqD4kuSfP9mbNsO3xk5KTwusriVE84pj49B0HzYCZzUuFTwGo5 2nBb4ry3fj4hCnvGXbbjiLcJV6w/p775nPTZN6WbVxZyv46KXoaFkQXoueuPIvNga1wL YECKgGK+gOz7W23WJ/E7kUwl0Qr6/SMMur8ZSTkhGzCTghQl5vkmLBPx2K9P3e1lWxdF uSP5U+dpsRefZ3D8lDIgR9ctnPyZAS0CwUG4ufB68n4UiADO21wxMFVWnuSnZpUgeKps 85aA== X-Gm-Message-State: AODbwcBiAEsO6vhXr1aoQZg112PrvkrlWjXx6WSu9/iGKWHUTtRyaiid Y69aTBf23iMBy58T X-Received: by 10.99.120.206 with SMTP id t197mr31336897pgc.64.1496218628441; Wed, 31 May 2017 01:17:08 -0700 (PDT) Received: from tahsin1.svl.corp.google.com ([100.123.230.167]) by smtp.gmail.com with ESMTPSA id g75sm25469724pfd.83.2017.05.31.01.17.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 May 2017 01:17:07 -0700 (PDT) From: Tahsin Erdogan To: Jan Kara , Theodore Ts'o , Andreas Dilger , Dave Kleikamp , Alexander Viro , Mark Fasheh , Joel Becker , Jens Axboe , Deepa Dinamani , Mike Christie , Fabian Frederick , linux-ext4@vger.kernel.org Cc: linux-kernel@vger.kernel.org, jfs-discussion@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, ocfs2-devel@oss.oracle.com, reiserfs-devel@vger.kernel.org, Tahsin Erdogan Subject: [PATCH 16/28] ext4: fix ext4_xattr_cmp() Date: Wed, 31 May 2017 01:15:05 -0700 Message-Id: <20170531081517.11438-16-tahsin@google.com> X-Mailer: git-send-email 2.13.0.219.gdb65acc882-goog In-Reply-To: <20170531081517.11438-1-tahsin@google.com> References: <20170531081517.11438-1-tahsin@google.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When a xattr entry refers to an external inode, the value data is not available in the inline area so we should not attempt to read it using value offset. Signed-off-by: Tahsin Erdogan --- fs/ext4/xattr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 9c243b3510b7..739f73a5a345 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -2169,7 +2169,8 @@ ext4_xattr_cmp(struct ext4_xattr_header *header1, entry1->e_value_inum != entry2->e_value_inum || memcmp(entry1->e_name, entry2->e_name, entry1->e_name_len)) return 1; - if (memcmp((char *)header1 + le16_to_cpu(entry1->e_value_offs), + if (!entry1->e_value_inum && + memcmp((char *)header1 + le16_to_cpu(entry1->e_value_offs), (char *)header2 + le16_to_cpu(entry2->e_value_offs), le32_to_cpu(entry1->e_value_size))) return 1;