Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3343255pxf; Mon, 15 Mar 2021 07:34:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzM/4dbsJrUEdaLyic0guhPBlseqXAzZWhhO4pyXOqTCV+Ay3i+CKAo48q66CnRlGeDIPnw X-Received: by 2002:a17:906:a248:: with SMTP id bi8mr23849184ejb.260.1615818875794; Mon, 15 Mar 2021 07:34:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615818875; cv=none; d=google.com; s=arc-20160816; b=dcUnN0uue/AJZxGIfH3/a+iz6qXamv85NesKErjIjWRgUSa2lDZMZz2T6RD8DUO7mF f9nLXiEji7kLQmPG02QDnhoK/qYjdff+ImIdqomsqfOcBsRom2aUfn6096khVmxHCpJM BpHtDFKF4Lvebopo5aBgrrYU5VW6s5ITF3icTT8sfb7Mj9Dv4uUkrNooJhmmrebNIuck aSmVkkatJsoml1ynnAdGc1G7PYL7M+LAFni83+vD0uWFUjZlbE2PVKevgIGZfdXeOTMy aNml//1+Hp5+fGJ+aKbWzsHrtYxdANgq04PmQvdxZwAeS4NuTiens/qqh3wUKVEYr33m Cu3Q== 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=IH316y3JltglCy0oZliANIv3PZOPzhfkD/AmY9O6TQY=; b=wdQgVvmHv2FNbeV6CZfjZPLAEZFr+msfbg4eFgRjnsNTKKWjkGXmg9c92zGSXuRBeb yvvai8aiBFnmW8o8w9mAU5Y4FFPXOMFDpwXIsE4oT8XDochaskWHbeRxG+hMbuYdcIQy 4rEVVHjTRF0lWv+it8bNN5pX2fc6XLYyQpr+z3Z/Q5w5UJeOAeJ3AAWvl/nLcVKNIHxL Iss9VcGa1awmOuBei2yHEDQHrdCLitu9M0XTPwADEsl0tsn60SN2bjrpjhZ+25ohTn+7 Ie9MjYivYuIaEJmnKJ2iFQYAjLz9z+e8hBm0F2r6gGaLI9blUo9Gl1hUJds5O+KWlsuQ b8gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n2Jea4D+; 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 bd18si10425851edb.609.2021.03.15.07.34.13; Mon, 15 Mar 2021 07:34:35 -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=n2Jea4D+; 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 S239296AbhCOOcK (ORCPT + 99 others); Mon, 15 Mar 2021 10:32:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:37612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230434AbhCOOBL (ORCPT ); Mon, 15 Mar 2021 10:01:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 49E8064F2B; Mon, 15 Mar 2021 14:00:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816843; bh=Wa90X9vXBOO3moEzXEjFE1Ixk3F+JZkxsk5mJsZRdEk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n2Jea4D+OSLFnEViLtJB9XKVC/S9wt1Xm9jIK5JA8SRUzf9FVI+Miusm8HA5CGdJ+ O1BZtgerXMXavS64YWqYkNacpWmfbh0DhoZyph06lRGP+Ktuor9tdEikW/IGb0TBw8 Qu1k+vBfCfFHdeFxbFWn7fiyWlg5JQsiQVpZs7Ho= 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.4 148/168] NFSv4.2: fix return value of _nfs4_get_security_label() Date: Mon, 15 Mar 2021 14:56:20 +0100 Message-Id: <20210315135555.204934521@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135550.333963635@linuxfoundation.org> References: <20210315135550.333963635@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 30e44b33040a..b2119159dead 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -5830,7 +5830,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