From patchwork Mon Jul 3 07:26:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 115205 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp348030vqx; Mon, 3 Jul 2023 00:39:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlF4kxQB0oGMd1AFzdAyQ0Xly1iZTEKod7LBbpX8mjLOlXDg7xEVx0xS55PxBFJhfDldqBf9 X-Received: by 2002:a17:902:e294:b0:1af:adc2:ab5b with SMTP id o20-20020a170902e29400b001afadc2ab5bmr10451612plc.0.1688369950256; Mon, 03 Jul 2023 00:39:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688369950; cv=none; d=google.com; s=arc-20160816; b=Tf6EYeVUbKxyK9NiXIBI8MjqZUGuy0ahFMC/HLEOySkIO/Ckl/Zpr7A9WhCZMJlG6t KCLooTCyMKDqewS2EKlvPzEeCtPFBGz37E0Hxw5TCy56QouYk2RCAtjGxEoZ1eb0tjaY wMIgaRB1oDuF2yUD/bTluWEGEUr2KeSfKoVMPCitMmSWePHrUmS9sTxc78SR3LU7sC5F 4njae0Y3qwQrFWROWD7fczi+L5eM7FfN7xaEU1KxX2RTEc+BcyxD80V246v3+EbJ0PCH muku9SoX9rWKJyQmUODN8wMsN7R0Vr7sEGD+APRjSE41Jvr2xoxSuqqhxbvxGfYbwcZ1 tk6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature; bh=+eBsKb2HTBRR8iMsfkWgMdZnxlIJ4gxnl7NXRmJUV8k=; fh=+YFVdCJq57+piIgB3kUO3LUIuYykw/jnC0zhAUs0Z14=; b=l4WHpqwiltHJ4RswLhRzIP3o1vfne/f9DOcqfkLyKGTMXHSYrMLY0+680w7IHWYlyL 0YdvA0KcAesJF7rJiSU/QiI8S8na1McA1JeVAA7yOcSBsIAblL9cZBP4zDqlFQAhJt4L d9FK3HsYy3BQMOa64dzt4GLhNf/vRIBry/qqZPhEG2Dy8lg6OyDkhHNL3LAY1295V5/+ TfRmY8l03pYavRmX28bCD09FdZ8Yg/ArJ5O+w5CtseGMFu26lOLcCreaTA+GT+83/G1V ++N2RRsjmTb8Fs5Ri19CRWx5r4PfqniSV6dahMjRDz6RJ0WGVLgs11BTRYPXlmGF0prC 4LQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=S0F7IwFq; dkim=pass header.i=@paragon-software.com header.s=mail header.b=ZBp5rhzn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x3-20020a170902b40300b001ae5fe35b6esi17041877plr.261.2023.07.03.00.38.54; Mon, 03 Jul 2023 00:39:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=S0F7IwFq; dkim=pass header.i=@paragon-software.com header.s=mail header.b=ZBp5rhzn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230024AbjGCH0S (ORCPT + 99 others); Mon, 3 Jul 2023 03:26:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229949AbjGCH0Q (ORCPT ); Mon, 3 Jul 2023 03:26:16 -0400 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5638E55; Mon, 3 Jul 2023 00:26:08 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 27D1D1D74; Mon, 3 Jul 2023 07:20:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1688368855; bh=+eBsKb2HTBRR8iMsfkWgMdZnxlIJ4gxnl7NXRmJUV8k=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=S0F7IwFq6c40h6gaEVdITZiroO+ZvZZ7+haTDwG7SUnO9xUWQul5u8vrjXJCUI2zF c49G0p4igW/1KdgwlwzRA0U6GP0EaxMmxiZ9YTB66g9k9NaCAfXn+0e3f4Ix0J/KH0 XJZlEw2GHdOfNcWFHxLLz3BxujT5lf8W2i2kU15k= 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 970F41D1E; Mon, 3 Jul 2023 07:26:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1688369166; bh=+eBsKb2HTBRR8iMsfkWgMdZnxlIJ4gxnl7NXRmJUV8k=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=ZBp5rhznk1XyJ0MlCxs6qu+hl7QD7YL6ibfUhcXAbi0M2+qxtzaQou6K/7emjY8m7 o7dCJJpvZa699JIbR2dGdDTUsfbeieG5EPhehEcBTthpzsqZDK1hmx77LtbSxWdkgp GpkZ3aiTrUf+R/FzV1q4EliIHaVDa2BpEuapv4Hk= Received: from [192.168.211.138] (192.168.211.138) 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; Mon, 3 Jul 2023 10:26:06 +0300 Message-ID: Date: Mon, 3 Jul 2023 11:26:05 +0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: [PATCH 4/8] fs/ntfs3: Don't allow to change label if volume is read-only Content-Language: en-US From: Konstantin Komarov To: CC: Linux Kernel Mailing List , References: In-Reply-To: X-Originating-IP: [192.168.211.138] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770384209281432373?= X-GMAIL-MSGID: =?utf-8?q?1770384209281432373?= Signed-off-by: Konstantin Komarov ---  fs/ntfs3/super.c | 7 ++++++-  1 file changed, 6 insertions(+), 1 deletion(-)          return -ENOMEM; diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index d24f2da36bb2..da739e509269 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -489,7 +489,12 @@ static ssize_t ntfs3_label_write(struct file *file, const char __user *buffer,      int err;      struct super_block *sb = pde_data(file_inode(file));      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)