Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3860167pxb; Tue, 17 Nov 2020 05:36:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJwZnNPYCMbYyv1JAi4Q9oKyniqgaSdt2uENzsbZ+MbXdURZoPPagFCgQY3+dtkXauiBhJl9 X-Received: by 2002:a17:906:3a17:: with SMTP id z23mr11465483eje.332.1605620180848; Tue, 17 Nov 2020 05:36:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605620180; cv=none; d=google.com; s=arc-20160816; b=LGD+3o1jQOGmlluaJwwXiAyTDoe93e68PNv7KAsULjgbHBTXlBk8s8as3T4E2xn99n +8CUZTJElZlEV6PseoYQB/iejcxeI+6VVUq/Nck9ob6YjJfPBjC0vlPgxepmEVDZttxl NkOhQx+j27cZIPYRe16iMeGKvEYua6Ig5ivyGxMlNHa0WIdlgxAnhDJWt1NvujXuR+u2 zFfrGFFoMBTmIEV24rG+b0Uz8AnfPy6OLndt2lHqBO9wawnoqNLEyU6wAXzf9LWRfzFf ACBwAdV+yUUxzlf6WbwAXg24D5RpmHjmSHFbcyi3ELv9QtoVUKcdZbqVdlufSstO+sLI iysQ== 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=dwtaKlN+EekpvlZ8Njs9xcNZTFKe52zLwpSkbYWjzWQ=; b=YBNzC7jnE3av5jWQWZ2z0Uk5NCZvwK1cZtgeW7COLDTAJX+APtgJ4PPvkqgJvNDCLs gO0V6cOdO1LNKde9oW+fmuqSd/X+qV5fG1sPhc63dmrZ2QB0cGTbh42HbAFOpjSIbt5u GSl8o1qmHNYpBR3Bk/6/s2K3Nuls9W3hn3XuSiycYeNOirV0IkC4Nify/48rlbi8YR0R AzUZ76NLD4y33d8l2Gpu/wxHfNRD7s/zYPVQ/TCBr4Bl4Ej+WB3diYhOyjtqlKNOSZ1M OO34W6cJhi+G+fxDDyxr5M9500qtzNXICPmsy1FIdUPCj99aWjd4y27pMjjmuaYEVVuU gCQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uBFK31xq; 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=fail (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 lz6si13742656ejb.116.2020.11.17.05.35.57; Tue, 17 Nov 2020 05:36:20 -0800 (PST) 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=@kernel.org header.s=default header.b=uBFK31xq; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732252AbgKQNcM (ORCPT + 99 others); Tue, 17 Nov 2020 08:32:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:41190 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732193AbgKQNbr (ORCPT ); Tue, 17 Nov 2020 08:31:47 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 4CA162078E; Tue, 17 Nov 2020 13:31:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605619906; bh=fLP/TmWcuJGS2zWkd6vJZ2o9VAbP5C2PCdoRjGqmOfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uBFK31xq1GsErWIyJNsYSdzsEp+2LcXnLDEYx/wA4s3YkBBRP1vcTQtu3Z5C72+ei WnwczERs2cCxOS3rkY55MHqySW9C/30PLiR7bK+Wdw32exAy5+J1eHBha8bTx9RfcL YMSe6q9/LwL4rCyXxLcsZz8kOttrccf4bgF269nM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Linus Torvalds , Sasha Levin Subject: [PATCH 5.9 043/255] afs: Fix incorrect freeing of the ACL passed to the YFS ACL store op Date: Tue, 17 Nov 2020 14:03:03 +0100 Message-Id: <20201117122141.047754990@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@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: David Howells [ Upstream commit f4c79144edd8a49ffca8fa737a31d606be742a34 ] The cleanup for the yfs_store_opaque_acl2_operation calls the wrong function to destroy the ACL content buffer. It's an afs_acl struct, not a yfs_acl struct - and the free function for latter may pass invalid pointers to kfree(). Fix this by using the afs_acl_put() function. The yfs_acl_put() function is then no longer used and can be removed. general protection fault, probably for non-canonical address 0x7ebde00000000: 0000 [#1] SMP PTI ... RIP: 0010:compound_head+0x0/0x11 ... Call Trace: virt_to_cache+0x8/0x51 kfree+0x5d/0x79 yfs_free_opaque_acl+0x16/0x29 afs_put_operation+0x60/0x114 __vfs_setxattr+0x67/0x72 __vfs_setxattr_noperm+0x66/0xe9 vfs_setxattr+0x67/0xce setxattr+0x14e/0x184 __do_sys_fsetxattr+0x66/0x8f do_syscall_64+0x2d/0x3a entry_SYSCALL_64_after_hwframe+0x44/0xa9 Fixes: e49c7b2f6de7 ("afs: Build an abstraction around an "operation" concept") Signed-off-by: David Howells Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- fs/afs/xattr.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/fs/afs/xattr.c b/fs/afs/xattr.c index 38884d6c57cdc..95c573dcda116 100644 --- a/fs/afs/xattr.c +++ b/fs/afs/xattr.c @@ -148,11 +148,6 @@ static const struct xattr_handler afs_xattr_afs_acl_handler = { .set = afs_xattr_set_acl, }; -static void yfs_acl_put(struct afs_operation *op) -{ - yfs_free_opaque_acl(op->yacl); -} - static const struct afs_operation_ops yfs_fetch_opaque_acl_operation = { .issue_yfs_rpc = yfs_fs_fetch_opaque_acl, .success = afs_acl_success, @@ -246,7 +241,7 @@ error: static const struct afs_operation_ops yfs_store_opaque_acl2_operation = { .issue_yfs_rpc = yfs_fs_store_opaque_acl2, .success = afs_acl_success, - .put = yfs_acl_put, + .put = afs_acl_put, }; /* -- 2.27.0