Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2422145rdh; Sun, 29 Oct 2023 15:55:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnOLA6ayk0UHYmvy4M2Fal8y+3XL2Vp3ta8xreVLvVsy/6eOILozMt0VNIC9pHhiCMJRgL X-Received: by 2002:a05:6808:118:b0:3b0:d583:dc4 with SMTP id b24-20020a056808011800b003b0d5830dc4mr10131523oie.54.1698620126555; Sun, 29 Oct 2023 15:55:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698620126; cv=none; d=google.com; s=arc-20160816; b=UJVGpf2vQF6NJMwGwDi5gjRrmzrZHjLxlZUaCfE4djQR/cuV63Xko8IiTRYunCKoy6 9x/jwX5+85Km/FWhMN0Xv0OmWOh/MhVTwfsrtKFkfsB4m4lWSKI2xBujV159RnjOt+zF 1v7ml+iYKJo0/nFWs9nhSkNkpWP+knzsKWkqoIDYut8EP+apHXxSN1U17RtYkXIFKrS1 hgwiC+OnQnqL9PaRapl+UeN2lyGy0IM6+tCUCFKTlxyb3e/LGqevdbnYrijaUzfbUSL6 yYu3T5PTYjXCzn5oDxkbcwcWtVWRI7EZhgs8Ly/CpJpzW40SiUgSmdlYVcKpT4Co8k5A pI2w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+g9aT9gXhWYQelfr/FN68OM2m/qOhRyA+n2jKkqN3as=; fh=IVcZYgopwke+Bc9cmwdOT5yAIhnLPNAsBqE9TuY8J+c=; b=PfGbXIJ47yE1hdq3DhgBe0IyiQuXlwGv4tTUw/iKFOo+nAuGFc6WepqjJ80W/NfkjU AA7u5EGZZQoFst/mCgOtL0ZNDMOorNln7wgDPKDjpluSldI9w8yta2KMdXtMK+h0hwu/ tUGj6sKi2tBtFD9Iie+wR0FY9TlDDKYmHDTcxxpJ/FL/+R5v2IaaVdmUl2akn8dghEdM VSf/GKmux50515x4pVbxiQkCacy7yZMzYqqL6E5dmP2m2dBI3R3foSUikl5S7wg8ELOS cspNh+QnoWQpJYbt2YwwoQE3wdTlkkhsRl3YA3dGJbqqK4irO20GV7jMvB5yz7iQLh3Y Ke1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YnmNtxG8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id v24-20020a63f218000000b005a1d8815ec0si2323527pgh.37.2023.10.29.15.55.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 15:55:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YnmNtxG8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 7899F80ACB51; Sun, 29 Oct 2023 15:55:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231206AbjJ2WzU (ORCPT + 99 others); Sun, 29 Oct 2023 18:55:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230468AbjJ2WzB (ORCPT ); Sun, 29 Oct 2023 18:55:01 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4BC3D9; Sun, 29 Oct 2023 15:54:58 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2808C433CA; Sun, 29 Oct 2023 22:54:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698620098; bh=9IB4jibcd1bRPkDCXBfrMALn/uwVsE1uo1hzrNtcqdA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YnmNtxG86mgc4DTzk2Yyvcd7rQvOi4DY5q+PKC8UpZQYxpOltjlsh5y5+mRec4Fe8 GMlubFX5u/4qB6EvdiHGIx0dGITqB2Mr3ygHvRo2iq434b10k2nL2LyfP+E50JsPae IhlJ6IoM3nYE2tgPW9Exb8IQaDo93rsvUWUEHaaDoRnJ54oN4/6jLY12hpC88uPsDZ TWrlQcQ6BSWwIZbi57auT4Yg+j2kGqEDOP6DImLkG2/zXx0tJoIaSUTEeDxwnWYt/6 im2NJOool3GrWMV4aIbY+akT02qxhQUuagDNsfPuVDP1HbMzEvoPXmQ5OrgoZDKyHR 5hi2P4eSOIA8Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Konstantin Komarov , Sasha Levin , ntfs3@lists.linux.dev Subject: [PATCH AUTOSEL 6.5 10/52] fs/ntfs3: Do not allow to change label if volume is read-only Date: Sun, 29 Oct 2023 18:52:57 -0400 Message-ID: <20231029225441.789781-10-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231029225441.789781-1-sashal@kernel.org> References: <20231029225441.789781-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.5.9 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 29 Oct 2023 15:55:25 -0700 (PDT) From: Konstantin Komarov [ Upstream commit e52dce610a2d53bf2b5e94a8843c71cb73a91ea5 ] Signed-off-by: Konstantin Komarov Signed-off-by: Sasha Levin --- fs/ntfs3/super.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 055c3764af26e..9d84f66e6a458 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -498,7 +498,12 @@ static ssize_t ntfs3_label_write(struct file *file, const char __user *buffer, struct super_block *sb = pde_data(file_inode(file)); struct ntfs_sb_info *sbi = sb->s_fs_info; ssize_t ret = count; - u8 *label = kmalloc(count, GFP_NOFS); + u8 *label; + + if (sb_rdonly(sb)) + return -EROFS; + + label = kmalloc(count, GFP_NOFS); if (!label) return -ENOMEM; -- 2.42.0