From patchwork Tue Sep 26 09:56:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 144971 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp2045100vqu; Tue, 26 Sep 2023 09:32:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGYDkI8CmF5iCaltOrSv5+KWeZN1csgeGvm2S3TiM82isG3vh0khW56XhSJ+bds3bHAC6Ix X-Received: by 2002:a17:902:aa8e:b0:1c5:b1a6:8118 with SMTP id d14-20020a170902aa8e00b001c5b1a68118mr8843847plr.42.1695745964315; Tue, 26 Sep 2023 09:32:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695745964; cv=none; d=google.com; s=arc-20160816; b=mi+nR6oE5v2OcKGsi+BC3ibbKRaqjAdG55PFgzDxtd8pUHjOyZ0gYqUGfLkCbpNWQt PF5udq9g4PSFRTjNmKLYJrc0Qh14iuayM5bb8V7mUPJPzM/sSjcpdZasinvSwL2zrUDI m66TIbHP6o9HHYxWjAGN0oQfT1B04uIYms0LbnSRjZ4xwg1h0BNUgSSzu46RrzKNBCfc 6MIRteceigl9TQ4EwO3hB2WrXQ4l6qlRW7ezm2pbFjPonGE2e+lhw/3K8gxBEyNZikI2 ucD8VLT9NMt/ze/Ba3SVaw7kGame42BOesHu/M+1G4kTKz2Cc2yRi/yEsNOh814XTvSS 8D7A== 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=OjduOup+un8qGaTqAgDN4qohzpVoBogSKK/pi3uPgl8=; fh=P7I85FIabZcM8ojWdeG8ABpTZepe/Xtte9jKWDfUHBM=; b=ZYWmtRjE6i54rxsAY0y29oqa4MUIjyh8KZah2yIhY5VxGINQw3vYVyA1FOVFLkxv1c V/9jxlZwAfGM8cgGLw4gacVsRbxuJit2gi6QARd+GJGoxeQJXiIDTUHLEAAVGPJqWtOZ lgjWmsdGDwQUenCG1aBQ42A3m81XzOZMzWuXajTfe8aMXYmkJ4m+GmQ3fnJAmQyiOa0T 6fmG/QFnCanikQuaAw1UQ9FXN+fDEYWooh/Fd2my8VkO4jVFAqYGcISTcZd8O97vk16l fFqFfK0o1Im+Bj8XsQsOIGGKPgJHQkc6VzZ/lsGKdJ/Zj+TCxetA29LrdMZ9zBK/KuTI cAeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=HIMyLl9r; dkim=pass header.i=@paragon-software.com header.s=mail header.b=QXyZoO1b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id a17-20020a170902ecd100b001c62d5b4e00si2437102plh.508.2023.09.26.09.32.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 09:32:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=HIMyLl9r; dkim=pass header.i=@paragon-software.com header.s=mail header.b=QXyZoO1b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id DFFDC8057DB4; Tue, 26 Sep 2023 02:57:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234318AbjIZJ5G (ORCPT + 27 others); Tue, 26 Sep 2023 05:57:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232180AbjIZJ5E (ORCPT ); Tue, 26 Sep 2023 05:57:04 -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 08CA0FB; Tue, 26 Sep 2023 02:56:57 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id CB48421BC; Tue, 26 Sep 2023 09:51:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695721865; bh=OjduOup+un8qGaTqAgDN4qohzpVoBogSKK/pi3uPgl8=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=HIMyLl9rMNTvWGANMBZ7k7mSFx743msYy8g+KbPRc35kVUui5Qgd+JfssKRCUF0ui twFYLxmtFfDFAjRcjxfXt7yN2F40dZVbX0JZVnAdS7CdKYjqrjG57x/xHjmQyQ4UVE zk0O+hx243YtYUWyghzeculoR16Cnf+FVRwSwCzI= 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 2631B1D45; Tue, 26 Sep 2023 09:56:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695722216; bh=OjduOup+un8qGaTqAgDN4qohzpVoBogSKK/pi3uPgl8=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=QXyZoO1bXsfpERWazQ/dHI//s8xiRczuXczn4XUZ56rPoO9HfV38ePAekMdcfaUY/ OyxcUmV7lg8D7Gw1Pc4+Gy3RKFwS6bD/9xb0nDoIQSlMoF+6JWb0mRW1zu4YHVxG2f x3S2MWJGobvAR2nlXUBUY6T0kBtzEYQMktPSZHeo= Received: from [172.16.192.129] (192.168.211.137) 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; Tue, 26 Sep 2023 12:56:55 +0300 Message-ID: <4fdb4c65-d6db-4a0c-b2cc-296646c1e1fe@paragon-software.com> Date: Tue, 26 Sep 2023 12:56:55 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 6/8] fs/ntfs3: Do not allow to change label if volume is read-only Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> In-Reply-To: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> X-Originating-IP: [192.168.211.137] 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=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Tue, 26 Sep 2023 02:57:12 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778118520110919504 X-GMAIL-MSGID: 1778118520110919504 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 5811da7e9d45..cf0a720523f0 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -497,7 +497,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)