Skip to content

Commit 423b8ba

Browse files
committed
Merge branch 'akpm' (patches from Andrew)
Merge misc fixes from Andrew Morton: "11 fixes" * emailed patches from Andrew Morton <[email protected]>: MAINTAINERS: add files related to kdump z3fold: fix use-after-free when freeing handles sparc32: use PUD rather than PGD to get PMD in srmmu_nocache_init() MAINTAINERS: update email address for Naoya Horiguchi sh: include linux/time_types.h for sockios kasan: disable branch tracing for core runtime selftests/vm/write_to_hugetlbfs.c: fix unused variable warning selftests/vm/.gitignore: add mremap_dontunmap rapidio: fix an error in get_user_pages_fast() error handling x86: bitops: fix build regression device-dax: don't leak kernel memory to user space after unloading kmem
2 parents 23f0dac + ca6edee commit 423b8ba

File tree

12 files changed

+46
-28
lines changed

12 files changed

+46
-28
lines changed

MAINTAINERS

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7829,7 +7829,7 @@ T: git git://linuxtv.org/media_tree.git
78297829
F: drivers/media/platform/sti/hva
78307830

78317831
HWPOISON MEMORY FAILURE HANDLING
7832-
M: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
7832+
M: Naoya Horiguchi <naoya.[email protected]>
78337833
78347834
S: Maintained
78357835
F: mm/hwpoison-inject.c
@@ -9185,6 +9185,11 @@ L: [email protected]
91859185
S: Maintained
91869186
W: http://lse.sourceforge.net/kdump/
91879187
F: Documentation/admin-guide/kdump/
9188+
F: fs/proc/vmcore.c
9189+
F: include/linux/crash_core.h
9190+
F: include/linux/crash_dump.h
9191+
F: include/uapi/linux/vmcore.h
9192+
F: kernel/crash_*.c
91889193

91899194
KEENE FM RADIO TRANSMITTER DRIVER
91909195
M: Hans Verkuil <[email protected]>

arch/sh/include/uapi/asm/sockios.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#ifndef __ASM_SH_SOCKIOS_H
33
#define __ASM_SH_SOCKIOS_H
44

5+
#include <linux/time_types.h>
6+
57
/* Socket-level I/O control calls. */
68
#define FIOGETOWN _IOR('f', 123, int)
79
#define FIOSETOWN _IOW('f', 124, int)

arch/sparc/mm/srmmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ static void __init srmmu_nocache_init(void)
333333
pgd = pgd_offset_k(vaddr);
334334
p4d = p4d_offset(__nocache_fix(pgd), vaddr);
335335
pud = pud_offset(__nocache_fix(p4d), vaddr);
336-
pmd = pmd_offset(__nocache_fix(pgd), vaddr);
336+
pmd = pmd_offset(__nocache_fix(pud), vaddr);
337337
pte = pte_offset_kernel(__nocache_fix(pmd), vaddr);
338338

339339
pteval = ((paddr >> 4) | SRMMU_ET_PTE | SRMMU_PRIV);

arch/x86/include/asm/bitops.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ static __always_inline void
5252
arch_set_bit(long nr, volatile unsigned long *addr)
5353
{
5454
if (__builtin_constant_p(nr)) {
55-
asm volatile(LOCK_PREFIX "orb %1,%0"
55+
asm volatile(LOCK_PREFIX "orb %b1,%0"
5656
: CONST_MASK_ADDR(nr, addr)
57-
: "iq" (CONST_MASK(nr) & 0xff)
57+
: "iq" (CONST_MASK(nr))
5858
: "memory");
5959
} else {
6060
asm volatile(LOCK_PREFIX __ASM_SIZE(bts) " %1,%0"
@@ -72,9 +72,9 @@ static __always_inline void
7272
arch_clear_bit(long nr, volatile unsigned long *addr)
7373
{
7474
if (__builtin_constant_p(nr)) {
75-
asm volatile(LOCK_PREFIX "andb %1,%0"
75+
asm volatile(LOCK_PREFIX "andb %b1,%0"
7676
: CONST_MASK_ADDR(nr, addr)
77-
: "iq" (CONST_MASK(nr) ^ 0xff));
77+
: "iq" (~CONST_MASK(nr)));
7878
} else {
7979
asm volatile(LOCK_PREFIX __ASM_SIZE(btr) " %1,%0"
8080
: : RLONG_ADDR(addr), "Ir" (nr) : "memory");
@@ -123,9 +123,9 @@ static __always_inline void
123123
arch_change_bit(long nr, volatile unsigned long *addr)
124124
{
125125
if (__builtin_constant_p(nr)) {
126-
asm volatile(LOCK_PREFIX "xorb %1,%0"
126+
asm volatile(LOCK_PREFIX "xorb %b1,%0"
127127
: CONST_MASK_ADDR(nr, addr)
128-
: "iq" ((u8)CONST_MASK(nr)));
128+
: "iq" (CONST_MASK(nr)));
129129
} else {
130130
asm volatile(LOCK_PREFIX __ASM_SIZE(btc) " %1,%0"
131131
: : RLONG_ADDR(addr), "Ir" (nr) : "memory");

drivers/dax/kmem.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ int dev_dax_kmem_probe(struct device *dev)
2222
resource_size_t kmem_size;
2323
resource_size_t kmem_end;
2424
struct resource *new_res;
25+
const char *new_res_name;
2526
int numa_node;
2627
int rc;
2728

@@ -48,11 +49,16 @@ int dev_dax_kmem_probe(struct device *dev)
4849
kmem_size &= ~(memory_block_size_bytes() - 1);
4950
kmem_end = kmem_start + kmem_size;
5051

51-
/* Region is permanently reserved. Hot-remove not yet implemented. */
52-
new_res = request_mem_region(kmem_start, kmem_size, dev_name(dev));
52+
new_res_name = kstrdup(dev_name(dev), GFP_KERNEL);
53+
if (!new_res_name)
54+
return -ENOMEM;
55+
56+
/* Region is permanently reserved if hotremove fails. */
57+
new_res = request_mem_region(kmem_start, kmem_size, new_res_name);
5358
if (!new_res) {
5459
dev_warn(dev, "could not reserve region [%pa-%pa]\n",
5560
&kmem_start, &kmem_end);
61+
kfree(new_res_name);
5662
return -EBUSY;
5763
}
5864

@@ -63,12 +69,12 @@ int dev_dax_kmem_probe(struct device *dev)
6369
* unknown to us that will break add_memory() below.
6470
*/
6571
new_res->flags = IORESOURCE_SYSTEM_RAM;
66-
new_res->name = dev_name(dev);
6772

6873
rc = add_memory(numa_node, new_res->start, resource_size(new_res));
6974
if (rc) {
7075
release_resource(new_res);
7176
kfree(new_res);
77+
kfree(new_res_name);
7278
return rc;
7379
}
7480
dev_dax->dax_kmem_res = new_res;
@@ -83,6 +89,7 @@ static int dev_dax_kmem_remove(struct device *dev)
8389
struct resource *res = dev_dax->dax_kmem_res;
8490
resource_size_t kmem_start = res->start;
8591
resource_size_t kmem_size = resource_size(res);
92+
const char *res_name = res->name;
8693
int rc;
8794

8895
/*
@@ -102,6 +109,7 @@ static int dev_dax_kmem_remove(struct device *dev)
102109
/* Release and free dax resources */
103110
release_resource(res);
104111
kfree(res);
112+
kfree(res_name);
105113
dev_dax->dax_kmem_res = NULL;
106114

107115
return 0;

drivers/rapidio/devices/rio_mport_cdev.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,11 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode,
877877
rmcd_error("pinned %ld out of %ld pages",
878878
pinned, nr_pages);
879879
ret = -EFAULT;
880+
/*
881+
* Set nr_pages up to mean "how many pages to unpin, in
882+
* the error handler:
883+
*/
884+
nr_pages = pinned;
880885
goto err_pg;
881886
}
882887

mm/kasan/Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ CFLAGS_REMOVE_tags_report.o = $(CC_FLAGS_FTRACE)
1515

1616
# Function splitter causes unnecessary splits in __asan_load1/__asan_store1
1717
# see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63533
18-
CFLAGS_common.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
19-
CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
20-
CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
21-
CFLAGS_init.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
22-
CFLAGS_quarantine.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
23-
CFLAGS_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
24-
CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
25-
CFLAGS_tags_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
18+
CFLAGS_common.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
19+
CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
20+
CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
21+
CFLAGS_init.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
22+
CFLAGS_quarantine.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
23+
CFLAGS_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
24+
CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
25+
CFLAGS_tags_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
2626

2727
obj-$(CONFIG_KASAN) := common.o init.o report.o
2828
obj-$(CONFIG_KASAN_GENERIC) += generic.o generic_report.o quarantine.o

mm/kasan/generic.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616

1717
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18-
#define DISABLE_BRANCH_PROFILING
1918

2019
#include <linux/export.h>
2120
#include <linux/interrupt.h>

mm/kasan/tags.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
*/
1313

1414
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
15-
#define DISABLE_BRANCH_PROFILING
1615

1716
#include <linux/export.h>
1817
#include <linux/interrupt.h>

mm/z3fold.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,16 +318,16 @@ static inline void free_handle(unsigned long handle)
318318
slots = handle_to_slots(handle);
319319
write_lock(&slots->lock);
320320
*(unsigned long *)handle = 0;
321-
write_unlock(&slots->lock);
322-
if (zhdr->slots == slots)
321+
if (zhdr->slots == slots) {
322+
write_unlock(&slots->lock);
323323
return; /* simple case, nothing else to do */
324+
}
324325

325326
/* we are freeing a foreign handle if we are here */
326327
zhdr->foreign_handles--;
327328
is_free = true;
328-
read_lock(&slots->lock);
329329
if (!test_bit(HANDLES_ORPHANED, &slots->pool)) {
330-
read_unlock(&slots->lock);
330+
write_unlock(&slots->lock);
331331
return;
332332
}
333333
for (i = 0; i <= BUDDY_MASK; i++) {
@@ -336,7 +336,7 @@ static inline void free_handle(unsigned long handle)
336336
break;
337337
}
338338
}
339-
read_unlock(&slots->lock);
339+
write_unlock(&slots->lock);
340340

341341
if (is_free) {
342342
struct z3fold_pool *pool = slots_to_pool(slots);
@@ -422,6 +422,7 @@ static struct z3fold_header *init_z3fold_page(struct page *page, bool headless,
422422
zhdr->start_middle = 0;
423423
zhdr->cpu = -1;
424424
zhdr->foreign_handles = 0;
425+
zhdr->mapped_count = 0;
425426
zhdr->slots = slots;
426427
zhdr->pool = pool;
427428
INIT_LIST_HEAD(&zhdr->buddy);

0 commit comments

Comments
 (0)