From patchwork Sun Jun 10 05:07:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 10456569 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 54B7C6020F for ; Sun, 10 Jun 2018 05:10:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 462AF20700 for ; Sun, 10 Jun 2018 05:10:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3AC5125D99; Sun, 10 Jun 2018 05:10:29 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 D63B120700 for ; Sun, 10 Jun 2018 05:10:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932207AbeFJFK1 (ORCPT ); Sun, 10 Jun 2018 01:10:27 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:34028 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932180AbeFJFKW (ORCPT ); Sun, 10 Jun 2018 01:10:22 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5A56IvV094976 for ; Sun, 10 Jun 2018 05:10:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=SHZlq561F8CwLXwfVGxHjqUBaU3S0E4KQ+U6TtpXN0c=; b=YfGtZfHkMDfOLMDYrHoueGqnybjSN/mGTtwG8k+TFfMBFgjk6+T1Za1qYEuozR1vqC/3 YLTWlFeSqqq11zDUKqSVnEd0LZU7vsTJai3Mq6/WPJqO/OmXnVC9qeVBqbihrW9e87SF KqJzHzzULbqi02azt3Q7Xjp73BlEj4BvLWolvlTTuuCdj6/nS5cW8f3GpAL9VvFY/5Lm gkEDr+QC1xYPZIJwVwXZ+TmKXqIAhf/zkfTN3NyBdpK09ZAaC70jSpXz9rLB73q7RD00 kyEU+V6pZTaImC2Jneq8CPYsOYxNab25hpJTkV+5PedHxsGXTOJYzd/TjNXDeIdvmXGF og== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2jg7hwstd4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 10 Jun 2018 05:10:22 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w5A5ALK9004986 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 10 Jun 2018 05:10:21 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w5A5AKR6030493 for ; Sun, 10 Jun 2018 05:10:20 GMT Received: from localhost.localdomain (/72.210.40.165) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 09 Jun 2018 22:10:20 -0700 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v2 23/27] xfsprogs: Do not use namechecks on parent pointers Date: Sat, 9 Jun 2018 22:07:48 -0700 Message-Id: <1528607272-11122-24-git-send-email-allison.henderson@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528607272-11122-1-git-send-email-allison.henderson@oracle.com> References: <1528607272-11122-1-git-send-email-allison.henderson@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8919 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=527 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806100059 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Attribute names of parent pointers are not strings. So avoid doing namechecks for these attributes. Signed-off-by: Allison Henderson --- repair/attr_repair.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/repair/attr_repair.c b/repair/attr_repair.c index 8b1b8a7..b8b0768 100644 --- a/repair/attr_repair.c +++ b/repair/attr_repair.c @@ -308,8 +308,9 @@ process_shortform_attr( /* namecheck checks for / and null terminated for file names. * attributes names currently follow the same rules. */ - if (namecheck((char *)¤tentry->nameval[0], - currententry->namelen)) { + if (!(currententry->flags & XFS_ATTR_PARENT) && + namecheck((char *)¤tentry->nameval[0], + currententry->namelen)) { do_warn( _("entry contains illegal character in shortform attribute name\n")); junkit = 1; @@ -470,8 +471,9 @@ process_leaf_attr_local( xfs_attr_leaf_name_local_t *local; local = xfs_attr3_leaf_name_local(leaf, i); - if (local->namelen == 0 || namecheck((char *)&local->nameval[0], - local->namelen)) { + if (!(entry->flags & XFS_ATTR_PARENT) && + (local->namelen == 0 || namecheck((char *)&local->nameval[0], + local->namelen))) { do_warn( _("attribute entry %d in attr block %u, inode %" PRIu64 " has bad name (namelen = %d)\n"), i, da_bno, ino, local->namelen); @@ -525,13 +527,15 @@ process_leaf_attr_remote( remotep = xfs_attr3_leaf_name_remote(leaf, i); - if (remotep->namelen == 0 || namecheck((char *)&remotep->name[0], - remotep->namelen) || + if (!(entry->flags & XFS_ATTR_PARENT) && + (remotep->namelen == 0 || + namecheck((char *)&remotep->name[0], + remotep->namelen) || be32_to_cpu(entry->hashval) != libxfs_da_hashname((unsigned char *)&remotep->name[0], remotep->namelen) || be32_to_cpu(entry->hashval) < last_hashval || - be32_to_cpu(remotep->valueblk) == 0) { + be32_to_cpu(remotep->valueblk) == 0)) { do_warn( _("inconsistent remote attribute entry %d in attr block %u, ino %" PRIu64 "\n"), i, da_bno, ino); return -1;