From patchwork Sun Nov 13 21:21:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 9424983 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 9014D6047D for ; Sun, 13 Nov 2016 21:25:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FB93288A2 for ; Sun, 13 Nov 2016 21:25:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7350828906; Sun, 13 Nov 2016 21:25:26 +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 EC79F288A2 for ; Sun, 13 Nov 2016 21:25:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935303AbcKMVYU (ORCPT ); Sun, 13 Nov 2016 16:24:20 -0500 Received: from mail.sigma-star.at ([95.130.255.111]:46007 "EHLO mail.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964933AbcKMVWJ (ORCPT ); Sun, 13 Nov 2016 16:22:09 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.sigma-star.at (Postfix) with ESMTP id 6768B24E001E; Sun, 13 Nov 2016 22:22:06 +0100 (CET) Received: from linux.site (richard.vpn.sigmapriv.at [10.3.0.5]) by mail.sigma-star.at (Postfix) with ESMTPSA id CA0BF24E0011; Sun, 13 Nov 2016 22:22:04 +0100 (CET) From: Richard Weinberger To: linux-mtd@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, dedekind1@gmail.com, adrian.hunter@intel.com, tytso@mit.edu, jaegeuk@kernel.org, david@sigma-star.at, wd@denx.de, sbabic@denx.de, dengler@linutronix.de, ebiggers@google.com, mhalcrow@google.com, hch@infradead.org, Richard Weinberger Subject: [PATCH 26/29] ubifs: Use a random number for cookies Date: Sun, 13 Nov 2016 22:21:09 +0100 Message-Id: <1479072072-6844-27-git-send-email-richard@nod.at> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1479072072-6844-1-git-send-email-richard@nod.at> References: <1479072072-6844-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 8d9946082665..eafddb2b30e3 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 */