From patchwork Thu Dec 1 21:21:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 9456957 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8045B60235 for ; Thu, 1 Dec 2016 21:24:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 721172853F for ; Thu, 1 Dec 2016 21:24:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66A4028541; Thu, 1 Dec 2016 21:24:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 102282853F for ; Thu, 1 Dec 2016 21:24:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760226AbcLAVYC (ORCPT ); Thu, 1 Dec 2016 16:24:02 -0500 Received: from mail.sigma-star.at ([95.130.255.111]:46002 "EHLO mail.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760691AbcLAVVg (ORCPT ); Thu, 1 Dec 2016 16:21:36 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.sigma-star.at (Postfix) with ESMTP id A41AB24E0002; Thu, 1 Dec 2016 22:21:34 +0100 (CET) Received: from linux.site (richard.vpn.sigmapriv.at [10.3.0.5]) by mail.sigma-star.at (Postfix) with ESMTPSA id 6E51224E000F; Thu, 1 Dec 2016 22:21:33 +0100 (CET) From: Richard Weinberger To: linux-mtd@lists.infradead.org Cc: david@sigma-star.at, tytso@mit.edu, dedekind1@gmail.com, ebiggers@google.com, mhalcrow@google.com, adrian.hunter@intel.com, linux-kernel@vger.kernel.org, hch@infradead.org, linux-fsdevel@vger.kernel.org, jaegeuk@kernel.org, dengler@linutronix.de, sbabic@denx.de, wd@denx.de, Richard Weinberger Subject: [PATCH 21/24] ubifs: Use a random number for cookies Date: Thu, 1 Dec 2016 22:21:08 +0100 Message-Id: <1480627271-10441-22-git-send-email-richard@nod.at> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1480627271-10441-1-git-send-email-richard@nod.at> References: <1480627271-10441-1-git-send-email-richard@nod.at> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Richard Weinberger --- fs/ubifs/journal.c | 3 +++ fs/ubifs/ubifs.h | 1 + 2 files changed, 4 insertions(+) diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c index 0698cccc6223..88d33775f18b 100644 --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c @@ -589,6 +589,7 @@ int ubifs_jnl_update(struct ubifs_info *c, const struct inode *dir, dent->nlen = cpu_to_le16(fname_len(nm)); memcpy(dent->name, fname_name(nm), fname_len(nm)); dent->name[fname_len(nm)] = '\0'; + dent->cookie = prandom_u32(); zero_dent_node_unused(dent); ubifs_prep_grp_node(c, dent, dlen, 0); @@ -1124,6 +1125,7 @@ int ubifs_jnl_rename(struct ubifs_info *c, const struct inode *old_dir, dent->nlen = cpu_to_le16(fname_len(new_nm)); memcpy(dent->name, fname_name(new_nm), fname_len(new_nm)); dent->name[fname_len(new_nm)] = '\0'; + dent->cookie = prandom_u32(); zero_dent_node_unused(dent); ubifs_prep_grp_node(c, dent, dlen1, 0); @@ -1142,6 +1144,7 @@ int ubifs_jnl_rename(struct ubifs_info *c, const struct inode *old_dir, dent2->nlen = cpu_to_le16(fname_len(old_nm)); memcpy(dent2->name, fname_name(old_nm), fname_len(old_nm)); dent2->name[fname_len(old_nm)] = '\0'; + dent2->cookie = prandom_u32(); zero_dent_node_unused(dent2); ubifs_prep_grp_node(c, dent2, dlen2, 0); diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index ca33efcb4335..85c74ad98898 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -39,6 +39,7 @@ #include #include #include +#include #include "ubifs-media.h" /* Version of this UBIFS implementation */