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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47E1BC47088 for ; Wed, 30 Nov 2022 18:54:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231579AbiK3Syz (ORCPT ); Wed, 30 Nov 2022 13:54:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231578AbiK3Syy (ORCPT ); Wed, 30 Nov 2022 13:54:54 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0CFE8567A for ; Wed, 30 Nov 2022 10:54:53 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3F42161D54 for ; Wed, 30 Nov 2022 18:54:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50903C433D6; Wed, 30 Nov 2022 18:54:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1669834492; bh=OzCaS/ncy15m/HGrWUluJOVV1MGaGAVRNZxdDTVR+Ws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UlvDMSkT1wWiUB+jG/JyGuxxBsUDFgjvDB4UNAqFSdJlh/pqZfIi8ppiamu+xfMLp 0AFIt6fi/fRwh76w8kaeMSPlMtktAsIOTwpB8DuAEuBwEWSHmk3zRdslSPyB7vdg3I Vd4m8bTim9M/UaHtbdQlXlBmGhVVfGfBmD6b69c8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Anand Jain , David Sterba Subject: [PATCH 6.0 274/289] btrfs: free btrfs_path before copying subvol info to userspace Date: Wed, 30 Nov 2022 19:24:19 +0100 Message-Id: <20221130180550.312866531@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221130180544.105550592@linuxfoundation.org> References: <20221130180544.105550592@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Anand Jain commit 013c1c5585ebcfb19c88efe79063d0463b1b6159 upstream. btrfs_ioctl_get_subvol_info() frees the search path after the userspace copy from the temp buffer @subvol_info. This can lead to a lock splat warning. Fix this by freeing the path before we copy it to userspace. CC: stable@vger.kernel.org # 4.19+ Signed-off-by: Anand Jain Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/ioctl.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -3105,6 +3105,8 @@ static int btrfs_ioctl_get_subvol_info(s } } + btrfs_free_path(path); + path = NULL; if (copy_to_user(argp, subvol_info, sizeof(*subvol_info))) ret = -EFAULT;