[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1479072072-6844-27-git-send-email-richard@nod.at>
Date: Sun, 13 Nov 2016 22:21:09 +0100
From: Richard Weinberger <richard@....at>
To: linux-mtd@...ts.infradead.org
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
dedekind1@...il.com, adrian.hunter@...el.com, tytso@....edu,
jaegeuk@...nel.org, david@...ma-star.at, wd@...x.de,
sbabic@...x.de, dengler@...utronix.de, ebiggers@...gle.com,
mhalcrow@...gle.com, hch@...radead.org,
Richard Weinberger <richard@....at>
Subject: [PATCH 26/29] ubifs: Use a random number for cookies
Signed-off-by: Richard Weinberger <richard@....at>
---
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 <linux/security.h>
#include <linux/xattr.h>
#include <linux/fscrypto.h>
+#include <linux/random.h>
#include "ubifs-media.h"
/* Version of this UBIFS implementation */
--
2.7.3
Powered by blists - more mailing lists