From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27EB3C2BD09 for ; Wed, 4 Dec 2019 17:58:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E5AD120865 for ; Wed, 4 Dec 2019 17:58:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482318; bh=0VH8yrhi9GC0ENQNA7KNwTLpwZFqByhMisUPcy4OreE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Bj35n3iDpf0/gYCeW38VHoMqRNr4K7Zq1gcSNxQ3fOMVujxGoSUKzfb6qYwQkwEJq Ur7KMJaRV2QEv2xY8cITBhGbVyX8LIRfZCXTxHzPW22sY+5ykvWSTBOKemQ2pfWCI8 5RJZNN3TCiRe9dW5TaC0aLyImDyACRDhGr1REhe8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728851AbfLDR6h (ORCPT ); Wed, 4 Dec 2019 12:58:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:33370 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728812AbfLDR6f (ORCPT ); Wed, 4 Dec 2019 12:58:35 -0500 Received: from localhost (unknown [217.68.49.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 27DC22081B; Wed, 4 Dec 2019 17:58:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482314; bh=0VH8yrhi9GC0ENQNA7KNwTLpwZFqByhMisUPcy4OreE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dK9srWF5LWUjdL4dFMpeSXr6X5pGL4U6wDsnwh/Ri8eiHYS/E9MY3MGTexV+iHW3R 7RazH7dXVWWaxgh018HgMMB1SjwmKqvtpyzhUhQJ1evR7hOPFPMETEFeqpoEx2kDnl pS5D64fKSVKiqOTHKch98UgdSjhV4+4YGYZftk0c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Bowler , "Darrick J. Wong" , Sasha Levin Subject: [PATCH 4.4 36/92] xfs: Align compat attrlist_by_handle with native implementation. Date: Wed, 4 Dec 2019 18:49:36 +0100 Message-Id: <20191204174332.736774344@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204174327.215426506@linuxfoundation.org> References: <20191204174327.215426506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nick Bowler [ Upstream commit c456d64449efe37da50832b63d91652a85ea1d20 ] While inspecting the ioctl implementations, I noticed that the compat implementation of XFS_IOC_ATTRLIST_BY_HANDLE does not do exactly the same thing as the native implementation. Specifically, the "cursor" does not appear to be written out to userspace on the compat path, like it is on the native path. This adjusts the compat implementation to copy out the cursor just like the native implementation does. The attrlist cursor does not require any special compat handling. This fixes xfstests xfs/269 on both IA-32 and x32 userspace, when running on an amd64 kernel. Signed-off-by: Nick Bowler Fixes: 0facef7fb053b ("xfs: in _attrlist_by_handle, copy the cursor back to userspace") Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Sasha Levin --- fs/xfs/xfs_ioctl32.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c index 1a05d8ae327db..e7372cef5ac33 100644 --- a/fs/xfs/xfs_ioctl32.c +++ b/fs/xfs/xfs_ioctl32.c @@ -346,6 +346,7 @@ xfs_compat_attrlist_by_handle( { int error; attrlist_cursor_kern_t *cursor; + compat_xfs_fsop_attrlist_handlereq_t __user *p = arg; compat_xfs_fsop_attrlist_handlereq_t al_hreq; struct dentry *dentry; char *kbuf; @@ -380,6 +381,11 @@ xfs_compat_attrlist_by_handle( if (error) goto out_kfree; + if (copy_to_user(&p->pos, cursor, sizeof(attrlist_cursor_kern_t))) { + error = -EFAULT; + goto out_kfree; + } + if (copy_to_user(compat_ptr(al_hreq.buffer), kbuf, al_hreq.buflen)) error = -EFAULT; -- 2.20.1