diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2017-08-06 20:37:05 -0300 |
---|---|---|
committer | Otavio Salvador <otavio@ossystems.com.br> | 2017-08-06 20:37:05 -0300 |
commit | 05dc27c41664353ba0ab77aeb1e948ce88f3f1d1 (patch) | |
tree | e655cbf9b2b529c5c95cb975c697cc86b9bebeb1 /drivers/char | |
parent | 09845b886c1198c9461de424ffd95dde363324c1 (diff) | |
parent | 1af952704416d76ad86963f04feb10a3da143901 (diff) |
Merge tag 'v4.1.43' into 4.1-2.0.x-imx
Linux 4.1.43
* tag 'v4.1.43': (182 commits)
Linux 4.1.43
HID: core: prevent out-of-bound readings
ipvs: SNAT packet replies only for NATed connections
Revert "dmaengine: ep93xx: Don't drain the transfers in terminate_all()"
staging: comedi: ni_mio_common: fix E series ni_ai_insn_read() data
kvm: vmx: Do not disable intercepts for BNDCFGS
tracing: Use SOFTIRQ_OFFSET for softirq dectection for more accurate results
PM / QoS: return -EINVAL for bogus strings
sched/topology: Optimize build_group_mask()
sched/topology: Fix overlapping sched_group_mask
crypto: caam - fix signals handling
crypto: atmel - only treat EBUSY as transient if backlog
crypto: talitos - Extend max key length for SHA384/512-HMAC and AEAD
Add "shutdown" to "struct class".
mnt: Make propagate_umount less slow for overlapping mount propagation trees
mnt: In propgate_umount handle visiting mounts in any order
mnt: In umount propagation reparent in a separate pass
vt: fix unchecked __put_user() in tioclinux ioctls
exec: Limit arg stack to at most 75% of _STK_LIM
s390: reduce ELF_ET_DYN_BASE
...
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/random.c | 26 | ||||
-rw-r--r-- | drivers/char/virtio_console.c | 2 |
2 files changed, 26 insertions, 2 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index 9cd6968e2f92..d55156fc064d 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1714,13 +1714,15 @@ int random_int_secret_init(void) return 0; } +static DEFINE_PER_CPU(__u32 [MD5_DIGEST_WORDS], get_random_int_hash) + __aligned(sizeof(unsigned long)); + /* * Get a random word for internal kernel use only. Similar to urandom but * with the goal of minimal entropy pool depletion. As a result, the random * value is not cryptographically secure but for several uses the cost of * depleting entropy is too high */ -static DEFINE_PER_CPU(__u32 [MD5_DIGEST_WORDS], get_random_int_hash); unsigned int get_random_int(void) { __u32 *hash; @@ -1741,6 +1743,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> .....] diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 810b171b55b7..374b0006aa7a 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -1864,7 +1864,7 @@ static void config_work_handler(struct work_struct *work) { struct ports_device *portdev; - portdev = container_of(work, struct ports_device, control_work); + portdev = container_of(work, struct ports_device, config_work); if (!use_multiport(portdev)) { struct virtio_device *vdev; struct port *port; |