Received: by 10.192.165.156 with SMTP id m28csp258917imm; Sun, 15 Apr 2018 22:37:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+mQSDl/fkinLjKPGrv84iGm57SmsHcY4GGBQWaV1a+bmlhUqWxiqZWgZvqUgl+5qPnE6tr X-Received: by 2002:a17:902:22a:: with SMTP id 39-v6mr14255981plc.128.1523857071589; Sun, 15 Apr 2018 22:37:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523857071; cv=none; d=google.com; s=arc-20160816; b=DLSZe1ZF37bvB84mUeS4yES1Zp0InDobbCfAV+nfgmzuvyKleCJwVYopmmVnkODpqG Rv7nqazMSnyuY6fBxYvTNJcHSi374n1S1f4yYomwr+pZsmEVLDgstCIW3mJk2sBzv8ha Wt+mnAjCAp9aHQ+hYks7L0Q8x7O+A/KjGudbXhAz912EgTNF4eGJAxsR9//vpjcOX7JX hobMAqvoNXTLXfY/a/x6I9dq6CKH7i13GQs/rk3gJUllORFMLj2/WZ59aOReGS3plqGp X1Bk8XP13gPBomtwAAo7dcEQTkWIVAuFsx4R+Y6GzWJco0SK09nIkxvcOxTa6XsAAgwN HIIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=5OvVsOyvChnSjXR4HnwkzT6tyPHJHF0mxTLDdbSWycA=; b=R8zf3G9BEDEVptgCARBxXVYqqTVVGUQnXc/Y0QrrB2gEb08QoRmzmGLJluaHFXZucE LFyzwpLuCeSBmYW3vPrp61BVk01HTleRsD+B0lYNtTczMugc2I6yguIcurdgZ7OBv+27 T8Fk15BFomWvu+oloUtuEWRd7GKfUd3jcx+1tvhukk/0mdLytI8/TrLK410s8f+M603W s3W9Er3lhuipHQCnIA/o1RdOlYaA6YPa3YApMA+jbJYlrHdCVd1+IsZYRE3582F72JGX xbIZoJXH4oSm/omNLVVkGH3tfRiuU/2zcTw0EzWP/bjkrqhd7RVZlTWRJm7sBVmYSnYy rcgA== 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 e3si7827124pgs.449.2018.04.15.22.37.14; Sun, 15 Apr 2018 22:37:51 -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 S1753775AbeDPEP1 (ORCPT + 99 others); Mon, 16 Apr 2018 00:15:27 -0400 Received: from smtp4.ccs.ornl.gov ([160.91.203.40]:35548 "EHLO smtp4.ccs.ornl.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753749AbeDPEPZ (ORCPT ); Mon, 16 Apr 2018 00:15:25 -0400 Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp4.ccs.ornl.gov (Postfix) with ESMTP id D10491005199; Mon, 16 Apr 2018 00:15:12 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id CE62E1F8; Mon, 16 Apr 2018 00:15:12 -0400 (EDT) From: James Simmons To: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Oleg Drokin , NeilBrown Cc: Linux Kernel Mailing List , Lustre Development List , James Simmons , James Simmons Subject: [PATCH 12/22] staging: lustre: llite: fix invalid size test in ll_setstripe_ea() Date: Mon, 16 Apr 2018 00:15:01 -0400 Message-Id: <1523852111-17321-13-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523852111-17321-1-git-send-email-jsimmons@infradead.org> References: <1523852111-17321-1-git-send-email-jsimmons@infradead.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The size check at the start of ll_setstripe_ea() is only valid for a directory. Move that check to the section of code handling the S_ISDIR case. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9183 Reviewed-on: https://review.whamcloud.com/27240 Reviewed-by: Dmitry Eremin Reviewed-by: Bob Glossman Reviewed-by: Sebastien Buisson Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/xattr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index 69c5227..42a6fb4 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -234,9 +234,6 @@ static int ll_setstripe_ea(struct dentry *dentry, struct lov_user_md *lump, struct inode *inode = d_inode(dentry); int rc = 0; - if (size != 0 && size < sizeof(struct lov_user_md)) - return -EINVAL; - /* * It is possible to set an xattr to a "" value of zero size. * For this case we are going to treat it as a removal. @@ -269,6 +266,9 @@ static int ll_setstripe_ea(struct dentry *dentry, struct lov_user_md *lump, if (rc == -EEXIST) rc = 0; } else if (S_ISDIR(inode->i_mode)) { + if (size != 0 && size < sizeof(struct lov_user_md)) + return -EINVAL; + rc = ll_dir_setstripe(inode, lump, 0); } -- 1.8.3.1