Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp994333lqt; Fri, 7 Jun 2024 05:18:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUpB0DXz1TDUlplQ873Xc2gnE8Fh88OQ4R6pGbUT8xJKQSTkcRROpXIF7kg32IrNlQWvx9OLYZoDbQEjdArEG/1arUmxF1ISatsT0oZAA== X-Google-Smtp-Source: AGHT+IGs1lFw6Vta8r1boNf3B2hXHoJTnoBG5WPC9PZT8g+yiZMDo/kqrFlxPswCodQ7tKntIwgV X-Received: by 2002:a17:90b:1c8c:b0:2c2:3de7:20c0 with SMTP id 98e67ed59e1d1-2c2bcc4cd43mr2211925a91.37.1717762686997; Fri, 07 Jun 2024 05:18:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717762686; cv=pass; d=google.com; s=arc-20160816; b=nl/2LwQBJStB7r5wMNo9ARSOdAeTN/+TBL+wgD1PmqFzV0Hu51nleoTUIJHaVef4yN DsRGQlTjaK/s8bpgCJvONYd4H0KNU4gCFC1DAktIL7YDJ7r8BtDjdxHSDZxfDffkyTbE hMS1Z8F6LsoxtxZ4qKpjti5M4nNc1JTPDg6JzTLyptro8qq5E9smhHTNrWPvVsf/Hvij nWFE4NJfl0kmFtPThVfv5Tyqb4cWHpwMxXrtGk5O0DJD/ZIa6jMlrahgqRA6bn69PQDa U8x7yWpxKjYT6SZ8jkb6kn5Vqu8BuURN/73tyUH4+wnU7uI1S+itcdYwQiLEn6LuStnG GI3w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-signature; bh=5ovyOW9zK48E2EPge8I/zbgW83PBsM38/HIRGE3qOL0=; fh=xoZo938iZo6Zo9BQRi1y1Y/2pdszedQYQQiMhZQzvOk=; b=cyPaQdA82eAbkvgizlyi4ZkKbVk8DJnfKKn3fOP68awNLdocu1CYgGomDXGB7xRhB2 lOd0ewz2WCCQucd/0vhIho4E7yfZg3hiAx4FqD3tIigQ6R+yRd+dkRh19yjlaExygnDn rTslRzYLxBKbqZ/bEjd6jJPFtvy3WNMzxVa65lTlEyLFhCrbZHSoG6bhJTeNnFvxYnu9 bEpa84fES1QxDfZwCxxvLXOP7PGXpnZj+t4sXMBvT0nWrJadhb8rhy99OODaL8rYNcDV Jj6+v1ex8QF8w6Isc9drehOFgMTszfrxu7m2MrqMIYelvXV1H6tW9KA8sD4WVN5T9Rzg U9Rg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b="A/2JORl3"; dkim=pass header.i=@paragon-software.com header.s=mail header.b=HemVv2k0; arc=pass (i=1 spf=pass spfdomain=paragon-software.com dkim=pass dkdomain=paragon-software.com dkim=pass dkdomain=paragon-software.com dmarc=pass fromdomain=paragon-software.com); spf=pass (google.com: domain of linux-kernel+bounces-205999-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205999-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c2806bcf02si4674121a91.106.2024.06.07.05.18.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 05:18:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205999-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b="A/2JORl3"; dkim=pass header.i=@paragon-software.com header.s=mail header.b=HemVv2k0; arc=pass (i=1 spf=pass spfdomain=paragon-software.com dkim=pass dkdomain=paragon-software.com dkim=pass dkdomain=paragon-software.com dmarc=pass fromdomain=paragon-software.com); spf=pass (google.com: domain of linux-kernel+bounces-205999-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205999-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 947442835D7 for ; Fri, 7 Jun 2024 12:18:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 57F73194C65; Fri, 7 Jun 2024 12:16:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="A/2JORl3"; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="HemVv2k0" Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 303D6194A6F; Fri, 7 Jun 2024 12:16:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762582; cv=none; b=F+SoCXKyE3BlqfbUe+pDqXuTfEC4YMroSattFfAnZiWgc40O0WyikGwfLGY2oBmc4UPa1o1versAiM7RnpgzSwRhZuvu21CjkuRlRTmbtpTIg8vV2sO28qvKvYOTEhS4ZSvAlnZQkUXSsRtOFgKDW+arKna+OYigWkGwCE37aqE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762582; c=relaxed/simple; bh=+sh2942xg7otXAhEOsOddtY/dsAfg9v0H5F5AxFP6OI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VI4StMzVO5YRFolRMI9z1irvNEiN2FMqRIbUtV/pHp3tDCaE0VHiZAwiPQQn3gnEGoC+SQUXx0Z+G9szHevH5bi4KHnAKJg5PhU+Q5HOqRnd1zaxWFhU8GbuxfE4NZFYtoG7rCraenJRmsUnp5ZN0DU9j/C+tuauf2vJL0GkxCA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=A/2JORl3; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=HemVv2k0; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 5392E2117; Fri, 7 Jun 2024 12:08:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762104; bh=5ovyOW9zK48E2EPge8I/zbgW83PBsM38/HIRGE3qOL0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=A/2JORl39FcVK4OEEMaucj9YsmfrMeAcUgWPUWnUTJ884uvPjqdB2w/on5LVlgP4A 6uda+AcdxRC3YoN2zvRSoM71RIn+bv7iw2gdRWZo9frRNipuFvo8ogxtRpw7Eg265+ 1G5X4PDzt/r35SvKzxTrY34aV+YH+PocTkC1B7Io= Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayfre-01.paragon-software.com (Postfix) with ESMTPS id 3756F195; Fri, 7 Jun 2024 12:16:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762578; bh=5ovyOW9zK48E2EPge8I/zbgW83PBsM38/HIRGE3qOL0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=HemVv2k0zeMaY109Ljfrfig1KjoWFhUcQW73o6fKzTpoHlR0HRfuBHee8Vdo3a4dU JslCyqtIoAeOfyKG5SOuwBQmRPuIl28TR2HAoWVFM+5nG2sDwGG/nsKKAq1ieDktwu MVlGpKKHTBUCTnmAeKh2S8UmoAtImOhtDJzEh+kk= Received: from ntfs3vm.paragon-software.com (192.168.211.95) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Fri, 7 Jun 2024 15:16:17 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov Subject: [PATCH 11/18] fs/ntfs3: Correct undo if ntfs_create_inode failed Date: Fri, 7 Jun 2024 15:15:41 +0300 Message-ID: <20240607121548.18818-12-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) Clusters allocated for Extended Attributes, must be freed when rolling back inode creation. Fixes: 82cae269cfa95 ("fs/ntfs3: Add initialization of super block") Signed-off-by: Konstantin Komarov --- fs/ntfs3/inode.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index d43a87a79ff2..c9a2f0ee117e 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -1666,7 +1666,9 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir, * The packed size of extended attribute is stored in direntry too. * 'fname' here points to inside new_de. */ - ntfs_save_wsl_perm(inode, &fname->dup.ea_size); + err = ntfs_save_wsl_perm(inode, &fname->dup.ea_size); + if (err) + goto out6; /* * update ea_size in file_name attribute too. @@ -1710,6 +1712,12 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir, goto out2; out6: + attr = ni_find_attr(ni, NULL, NULL, ATTR_EA, NULL, 0, NULL, NULL); + if (attr && attr->non_res) { + /* Delete ATTR_EA, if non-resident. */ + attr_set_size(ni, ATTR_EA, NULL, 0, NULL, 0, NULL, false, NULL); + } + if (rp_inserted) ntfs_remove_reparse(sbi, IO_REPARSE_TAG_SYMLINK, &new_de->ref); -- 2.34.1