Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3528641pxf; Mon, 15 Mar 2021 11:34:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy86m0b8Y4LNKQh/W9o3SkX3JlohGRYpvCNpMcVTJujRT3W+nQZayJAW4y8rBw3c3zcRAbL X-Received: by 2002:a17:906:d153:: with SMTP id br19mr24649724ejb.360.1615833258832; Mon, 15 Mar 2021 11:34:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833258; cv=none; d=google.com; s=arc-20160816; b=JKpzVZ8XSooknPDE9Lkv90z1q2+LyPgc3EJ7BsTRtvuXMk8FdaaxRyt+AmsRVLFDRx IF1crFzC1E7KXcPknTSRrkePibxmoToHn0BwQC4bY+xcepd1RzmIrquecMBlzOjLOa8g d0NI1thIL1aAXAGSyycKtVZCniEeIG01o2kt2lv67HruH3ZZ9w5iCrYhTDb9SC3fjuLT cFeMeVxe5rw6V8/4aHiigmKxlIVkvqAuMhYErWyoiyUeS0ifgKKGZDkJ7e1d/FPVjjGL wHpqlPMvCtJ8+329WSSlmFJX/z/02BsGfZzfs7f4F2W0MIWoTtabH+QpBCCCzHhiwONT G+zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Dbnn0l209OcnbBrh8CA3NGfrd5rYZDoG7wCTg7o1o9M=; b=nV0KFKDfzEioU/ncCZOJ1hPQws/G73KDfnp9ZEDEFSa+WYQHYt3UevYscD4acyIm6J owtKBlnu8h/lpkeiKxlPMmU/oJsfQY0RdjXLza5tc+sI/S+hV3HIqXBGr3bG83VnKIh1 Uf1Dui3nzltfbD2MIXSTeR5T3c6rNHM3Gu6ZXQUwhC6WOdYX3d3RkAlOsi22FkR+PERf +Z5nKWfNxuJ7PYQqlzhFp3qINwfgoVfEOqnZr30NAxc31u2XGyDP/0IENbucwDsHbJdV No7+cErrwLNTr2laBLEPGYZijRa922klzuF9wkcj3vxdRODGskALFkBFmrV2z5TkBDoK Z7Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BwlcehKW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e7si10836776ejz.428.2021.03.15.11.33.56; Mon, 15 Mar 2021 11:34:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BwlcehKW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238587AbhCOOmn (ORCPT + 99 others); Mon, 15 Mar 2021 10:42:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:49580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234317AbhCOODM (ORCPT ); Mon, 15 Mar 2021 10:03:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3EA1664EEF; Mon, 15 Mar 2021 14:03:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816991; bh=XFnEJAJEGP1dMB9+leoyqbn0dOzO/j7o4mhWP36zdiE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BwlcehKWP5ruTcdaqkGv+BJ2TlNlmm0Sp/3atSXPh/t2gG8OgU4jAthm5NDOX/+6t r7opNO9Bj69hTYqlhKAxQ6rKE692dMJ9pUcChYW2PnPwpMUgjOZNOVSBX0njuIdEFP ain1kBryFo7Wsn6lPqTmbBUjgaONzDvRwFrhB33M= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ondrej Mosnacek , James Morris , Paul Moore , Anna Schumaker , Sasha Levin Subject: [PATCH 5.11 248/306] NFSv4.2: fix return value of _nfs4_get_security_label() Date: Mon, 15 Mar 2021 14:55:11 +0100 Message-Id: <20210315135516.028281292@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Ondrej Mosnacek [ Upstream commit 53cb245454df5b13d7063162afd7a785aed6ebf2 ] An xattr 'get' handler is expected to return the length of the value on success, yet _nfs4_get_security_label() (and consequently also nfs4_xattr_get_nfs4_label(), which is used as an xattr handler) returns just 0 on success. Fix this by returning label.len instead, which contains the length of the result. Fixes: aa9c2669626c ("NFS: Client implementation of Labeled-NFS") Signed-off-by: Ondrej Mosnacek Reviewed-by: James Morris Reviewed-by: Paul Moore Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- fs/nfs/nfs4proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index fc8bbfd9beb3..7eb44f37558c 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -5972,7 +5972,7 @@ static int _nfs4_get_security_label(struct inode *inode, void *buf, return ret; if (!(fattr.valid & NFS_ATTR_FATTR_V4_SECURITY_LABEL)) return -ENOENT; - return 0; + return label.len; } static int nfs4_get_security_label(struct inode *inode, void *buf, -- 2.30.1