Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3528973pxf; Mon, 15 Mar 2021 11:34:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHoJRlT3NborWfWRwbdDu9fnbWDw6RwsJsDm4K+oB7tD4BLcxx7od952JC5GQyUnKBB71F X-Received: by 2002:aa7:df84:: with SMTP id b4mr31269118edy.240.1615833289180; Mon, 15 Mar 2021 11:34:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833289; cv=none; d=google.com; s=arc-20160816; b=HEyYJP/PGv6S7mb1mCiuPN0Y0zJATrI9ned/YuzjWu1fHHGv4PN8HS1T0aCW/oq12x PSQOgALvEnVMt7d+hILtm1+5WDEnisVN7zfMsZLW0PtP808mUj9UXileDZWOpYmwTv9b 3RP3QiScFaCRKwqOeeWB81DvqPLtDMa4LuamcsWVylOmGorB6Xfp4+ogjlH9A7uNwA0B L8P2O3JChRB86Q8ynBj0va7oinyBV5bCyDX4kBGbnc42EvPDrDT1zY2JbfAix1a5YjJI z2G6JQAv3QMSeLN65GtyA3FzyUO+kvpkBUN4o7Z6JZGppUVtP+W97bkb01HUtoCw4ibY gjrw== 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=g2/VBIBINqft9J30EBYO96sMWwicVGwRNhEi1o1aKzI=; b=REEjx4Ii83Px7kmYWOR6cOzSukxKx4yrs3X3ApI9jljaTL5BHm+NsgSlzxcHRZaKZj Qs2Skv10VVN742BWHijfEbQMlsZOMYweHAd1IxY/qdCR/RUJpOD/xm8qjXnpNmClchwp RY3wDic9iCxAXbTDrs97rEAkMjJl3M6RcrrFLrh1wD+5l6nrDOGBSc50Dg8zvHjD6e64 sJX5+Yo24QRH2ZRjCvlXWkSXSqHyiec+vYvzaGKiogzh2emLOWx5Ge28iE+2JZNqaXsN /IRfJNWDg4aBQ26/8ScVOoO8o39vj7XVjdDcbKWa2NbGbLOKPmtbEVc+51DMVY64hvYA Gmdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Fd/9gMAa"; 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 b10si10600977edr.441.2021.03.15.11.34.27; Mon, 15 Mar 2021 11:34:49 -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="Fd/9gMAa"; 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 S238179AbhCOOnt (ORCPT + 99 others); Mon, 15 Mar 2021 10:43:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:49974 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231356AbhCOODg (ORCPT ); Mon, 15 Mar 2021 10:03:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EC68264EF1; Mon, 15 Mar 2021 14:03:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615817015; bh=OsN9fP/3Q8x/uk2NpP+b5JvtzITPXV9VGc9C/iPEXmA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fd/9gMAanGlnPqJmvpSzOsb5salbpoj99oPxa7dRvf9JJ5q9iKI5+ObqUqQXLzglN y9m0w5XUwDT7SXiYGELLMqtgCwIsaqfhdCOcM+8oyC+BDhf6xOlPoB4f0bmmBspo5a etEbWywEzhRkPj5WpFWHTQY50VnLkAcptXTYOhxw= 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.10 248/290] NFSv4.2: fix return value of _nfs4_get_security_label() Date: Mon, 15 Mar 2021 14:55:41 +0100 Message-Id: <20210315135550.399707805@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@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 a811d42ffbd1..ba2dfba4854b 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -5967,7 +5967,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