diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-02-27 23:46:16 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-02-27 23:46:16 +0300 |
commit | 691429e13dfaf5b0994b07cc166db41bd608ee3d (patch) | |
tree | bf52870108822c40d9a83d3c402c59d5f15cc6af /drivers | |
parent | 1c271479b56da4a8caf5f56a88432d4260e120fe (diff) | |
parent | 7f6d5b529b7dfe2fca30cbf4bc81e16575090025 (diff) | |
download | linux-691429e13dfaf5b0994b07cc166db41bd608ee3d.tar.xz |
Merge branch 'akpm' (patches from Andrew)
Merge fixes from Andrew Morton:
"10 fixes"
* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
dax: move writeback calls into the filesystems
dax: give DAX clearing code correct bdev
ext4: online defrag not supported with DAX
ext2, ext4: only set S_DAX for regular inodes
block: disable block device DAX by default
ocfs2: unlock inode if deleting inode from orphan fails
mm: ASLR: use get_random_long()
drivers: char: random: add get_random_long()
mm: numa: quickly fail allocations for NUMA balancing on full nodes
mm: thp: fix SMP race condition between THP page fault and MADV_DONTNEED
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/random.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index d0da5d852d41..b583e5336630 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1819,6 +1819,28 @@ unsigned int get_random_int(void) EXPORT_SYMBOL(get_random_int); /* + * Same as get_random_int(), but returns unsigned long. + */ +unsigned long get_random_long(void) +{ + __u32 *hash; + unsigned long ret; + + if (arch_get_random_long(&ret)) + return ret; + + hash = get_cpu_var(get_random_int_hash); + + hash[0] += current->pid + jiffies + random_get_entropy(); + md5_transform(hash, random_int_secret); + ret = *(unsigned long *)hash; + put_cpu_var(get_random_int_hash); + + return ret; +} +EXPORT_SYMBOL(get_random_long); + +/* * randomize_range() returns a start address such that * * [...... <range> .....] |