Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1935715imj; Fri, 8 Feb 2019 09:39:37 -0800 (PST) X-Google-Smtp-Source: AHgI3IbsoKrYrP6CdswvTT3Z083kGEowSlgRXOzSD/iz/ObwJb3qi805WuYXncz+STs1C6dGLLEK X-Received: by 2002:a62:5fc4:: with SMTP id t187mr23640355pfb.66.1549647577754; Fri, 08 Feb 2019 09:39:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549647577; cv=none; d=google.com; s=arc-20160816; b=J+DL4iCOb4RnOJEQz2d42CdJsE49QfKsjbq9KsB0rkhWXZFYn+aZ5J+ZdwIo4u5z1/ OQTVIfK3OgXK5EAG6xvP+4obgbD8NrIOo6ZqV8AAzHCeMCZZOBVa7NxhO8jkzYecrUoY ym1j1ROd2vtVsSgZKfDUdsoObvmHzwByjQNr7wT1dwmlaIuxu5IYv/Y0UlrMoWladEoe XoVDowm7e+XeidSDmRwWHS5Sa/20QJUUnO+ZU8b0jeTtY7diNVb+SXLlpQuYnjvW2wk2 TlmJxGO1HceomwKhW/LL6NA+Q4wj0eDKGeFsTa10jvfzyzioLGjCqMA2ZRgmkCGcsqjS bugQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=/48HGg+33SRO0lkRonK7zd7mhVUUhsHQ0929pL4R4rI=; b=oCjV+fNNft7oPYvN9TGXteXUMDZCZ+fPL3qCexh6tpwz86ayP19yxI/0xY/JC/KJRu Vw+sKq6UdRoHNgs9q2wk7g/f2EQ46Jo1Nzv+b+A/Tuz7Zhha2/YM+SLkESJATLWZjp0z 4g6fx8E/02ZqqHfprIY/ZvLnZzVij963Sk0B9HKvMfqLEB0PSoxIEnP1BNtiPQGOjDiL O1qmbQornZ9ydeAY1aM6AW8jLoiW7yZx7QGoK5ci+WyMYUWURTP4O0prdEpxwdhh2OqD y/HdzKi3EhB9KHm5okzRmsO5B4+M5ztkBkB9dLnAazlfzHSO00XugviZQhHwH+KwFFaa EqWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@digidescorp.com header.s=google header.b=bBtfyIzh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t3si2723617pgl.108.2019.02.08.09.39.21; Fri, 08 Feb 2019 09:39:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@digidescorp.com header.s=google header.b=bBtfyIzh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728407AbfBHRhI (ORCPT + 99 others); Fri, 8 Feb 2019 12:37:08 -0500 Received: from mail-it1-f194.google.com ([209.85.166.194]:33109 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728141AbfBHRf3 (ORCPT ); Fri, 8 Feb 2019 12:35:29 -0500 Received: by mail-it1-f194.google.com with SMTP id q78so9316858itc.0 for ; Fri, 08 Feb 2019 09:35:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digidescorp.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/48HGg+33SRO0lkRonK7zd7mhVUUhsHQ0929pL4R4rI=; b=bBtfyIzhLUdRgnMl4RNRmSpqKPPgtUbO3+QacKCcGzGXowrypAcsD3C/oSOZy8kLuE kmgDRpvRDbKTq2jSZBthdeRtrcSuuX4HYNq5FWvWSWMIzppmSwI6y/Cn+MGPBLW5/G/9 jrJlrbTAA1/idTyYYCZ1/Blx893FffaTisUPA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/48HGg+33SRO0lkRonK7zd7mhVUUhsHQ0929pL4R4rI=; b=Tun54djwcH5ilQTMvp7AupQENW0qQnOUNbNyBoxo8/OsrL16JtDIjfH6MnPpvsG0KG iaDrZL8KoMLOmp7b9nd9ZNRrDKQcsvGkBpuPQ4/x0qBoDJSZvtVCoQ2CmXzciyIr2GTf qP1Jz8CuM70YPQ+kYAOfuqU3LWQT4TlybHTzMBtK0E+xHylQZfOo9MvLnw+wRmDnwoIa HDtFCIXyD/iTvDsKg4IJXA2lFomov2Yif2L8OfSDmUe4LkBsOob8lSmDVbSvnXJQLxiG aQ2BIcXWEzam5UbRC0NR5gJ1lixOprCvZ1yE3CTiKtSbhW69aiPOVWwMNBbr/HBm4gVh F+wA== X-Gm-Message-State: AHQUAuZBs1uVxPMl5RerihVyANmQ/qPbPPellEa9Y9le3nePj8NI9Bjl 1uLv5SqY33ishbC5bb62eZTV4A== X-Received: by 2002:a6b:ec08:: with SMTP id c8mr6730109ioh.37.1549647328785; Fri, 08 Feb 2019 09:35:28 -0800 (PST) Received: from iscandar.digidescorp.com (104-51-28-62.lightspeed.cicril.sbcglobal.net. [104.51.28.62]) by smtp.googlemail.com with ESMTPSA id k1sm1198861iob.2.2019.02.08.09.35.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Feb 2019 09:35:28 -0800 (PST) From: Steve Magnani X-Google-Original-From: Steve Magnani To: jack@suse.com Cc: linux-kernel@vger.kernel.org, "Steven J . Magnani" Subject: [PATCH 2/2] udf: finalize integrity descriptor before writeback Date: Fri, 8 Feb 2019 11:34:55 -0600 Message-Id: <20190208173455.20151-3-steve@digidescorp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190208173455.20151-1-steve@digidescorp.com> References: <20190208173455.20151-1-steve@digidescorp.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make sure the CRC and tag checksum of the Logical Volume Integrity Descriptor are valid before the structure is written out to disk. Otherwise, unless the filesystem is unmounted gracefully, the on-disk LVID will be invalid - which is unnecessary filesystem damage. Signed-off-by: Steven J. Magnani --- --- a/fs/udf/super.c 2019-02-08 10:39:48.351039434 -0600 +++ b/fs/udf/super.c 2019-02-08 10:42:26.017400020 -0600 @@ -1856,8 +1856,8 @@ u64 lvid_get_unique_id(struct super_bloc if (!(++uniqueID & 0xFFFFFFFF)) uniqueID += 16; lvhd->uniqueID = cpu_to_le64(uniqueID); + udf_updated_lvid(sb); mutex_unlock(&sbi->s_alloc_mutex); - mark_buffer_dirty(bh); return ret; } @@ -2154,11 +2154,20 @@ static int udf_sync_fs(struct super_bloc mutex_lock(&sbi->s_alloc_mutex); if (sbi->s_lvid_dirty) { + struct buffer_head *bh = sbi->s_lvid_bh; + + if (bh) { + struct logicalVolIntegrityDesc *lvid; + + lvid = (struct logicalVolIntegrityDesc *)bh->b_data; + udf_finalize_lvid(lvid); + } + /* * Blockdevice will be synced later so we don't have to submit * the buffer for IO */ - mark_buffer_dirty(sbi->s_lvid_bh); + mark_buffer_dirty(bh); sb->s_dirt = 0; sbi->s_lvid_dirty = 0; }