Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'mips_fixes_4.16_4' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/mips

Pull MIPS fixes from James Hogan:
"A miscellaneous pile of MIPS fixes for 4.16:

- move put_compat_sigset() to evade hardened usercopy warnings (4.16)

- select ARCH_HAVE_PC_{SERIO,PARPORT} for Loongson64 platforms (4.16)

- fix kzalloc() failure handling in ath25 (3.19) and Octeon (4.0)

- fix disabling of IPIs during BMIPS suspend (3.19)"

* tag 'mips_fixes_4.16_4' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/mips:
MIPS: BMIPS: Do not mask IPIs during suspend
MIPS: Loongson64: Select ARCH_MIGHT_HAVE_PC_SERIO
MIPS: Loongson64: Select ARCH_MIGHT_HAVE_PC_PARPORT
signals: Move put_compat_sigset to compat.h to silence hardened usercopy
MIPS: OCTEON: irq: Check for null return on kzalloc allocation
MIPS: ath25: Check for kzalloc allocation failure

+38 -25
+2
arch/mips/ath25/board.c
··· 135 135 } 136 136 137 137 board_data = kzalloc(BOARD_CONFIG_BUFSZ, GFP_KERNEL); 138 + if (!board_data) 139 + goto error; 138 140 ath25_board.config = (struct ath25_boarddata *)board_data; 139 141 memcpy_fromio(board_data, bcfg, 0x100); 140 142 if (broken_boarddata) {
+2
arch/mips/cavium-octeon/octeon-irq.c
··· 2277 2277 } 2278 2278 2279 2279 host_data = kzalloc(sizeof(*host_data), GFP_KERNEL); 2280 + if (!host_data) 2281 + return -ENOMEM; 2280 2282 raw_spin_lock_init(&host_data->lock); 2281 2283 2282 2284 addr = of_get_address(ciu_node, 0, NULL, NULL);
+4 -4
arch/mips/kernel/smp-bmips.c
··· 168 168 return; 169 169 } 170 170 171 - if (request_irq(IPI0_IRQ, bmips_ipi_interrupt, IRQF_PERCPU, 172 - "smp_ipi0", NULL)) 171 + if (request_irq(IPI0_IRQ, bmips_ipi_interrupt, 172 + IRQF_PERCPU | IRQF_NO_SUSPEND, "smp_ipi0", NULL)) 173 173 panic("Can't request IPI0 interrupt"); 174 - if (request_irq(IPI1_IRQ, bmips_ipi_interrupt, IRQF_PERCPU, 175 - "smp_ipi1", NULL)) 174 + if (request_irq(IPI1_IRQ, bmips_ipi_interrupt, 175 + IRQF_PERCPU | IRQF_NO_SUSPEND, "smp_ipi1", NULL)) 176 176 panic("Can't request IPI1 interrupt"); 177 177 } 178 178
+6
arch/mips/loongson64/Kconfig
··· 7 7 config LEMOTE_FULOONG2E 8 8 bool "Lemote Fuloong(2e) mini-PC" 9 9 select ARCH_SPARSEMEM_ENABLE 10 + select ARCH_MIGHT_HAVE_PC_PARPORT 11 + select ARCH_MIGHT_HAVE_PC_SERIO 10 12 select CEVT_R4K 11 13 select CSRC_R4K 12 14 select SYS_HAS_CPU_LOONGSON2E ··· 35 33 config LEMOTE_MACH2F 36 34 bool "Lemote Loongson 2F family machines" 37 35 select ARCH_SPARSEMEM_ENABLE 36 + select ARCH_MIGHT_HAVE_PC_PARPORT 37 + select ARCH_MIGHT_HAVE_PC_SERIO 38 38 select BOARD_SCACHE 39 39 select BOOT_ELF32 40 40 select CEVT_R4K if ! MIPS_EXTERNAL_TIMER ··· 66 62 config LOONGSON_MACH3X 67 63 bool "Generic Loongson 3 family machines" 68 64 select ARCH_SPARSEMEM_ENABLE 65 + select ARCH_MIGHT_HAVE_PC_PARPORT 66 + select ARCH_MIGHT_HAVE_PC_SERIO 69 67 select GENERIC_ISA_DMA_SUPPORT_BROKEN 70 68 select BOOT_ELF32 71 69 select BOARD_SCACHE
+24 -2
include/linux/compat.h
··· 17 17 #include <linux/if.h> 18 18 #include <linux/fs.h> 19 19 #include <linux/aio_abi.h> /* for aio_context_t */ 20 + #include <linux/uaccess.h> 20 21 #include <linux/unistd.h> 21 22 22 23 #include <asm/compat.h> ··· 551 550 asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); 552 551 553 552 extern int get_compat_sigset(sigset_t *set, const compat_sigset_t __user *compat); 554 - extern int put_compat_sigset(compat_sigset_t __user *compat, 555 - const sigset_t *set, unsigned int size); 553 + 554 + /* 555 + * Defined inline such that size can be compile time constant, which avoids 556 + * CONFIG_HARDENED_USERCOPY complaining about copies from task_struct 557 + */ 558 + static inline int 559 + put_compat_sigset(compat_sigset_t __user *compat, const sigset_t *set, 560 + unsigned int size) 561 + { 562 + /* size <= sizeof(compat_sigset_t) <= sizeof(sigset_t) */ 563 + #ifdef __BIG_ENDIAN 564 + compat_sigset_t v; 565 + switch (_NSIG_WORDS) { 566 + case 4: v.sig[7] = (set->sig[3] >> 32); v.sig[6] = set->sig[3]; 567 + case 3: v.sig[5] = (set->sig[2] >> 32); v.sig[4] = set->sig[2]; 568 + case 2: v.sig[3] = (set->sig[1] >> 32); v.sig[2] = set->sig[1]; 569 + case 1: v.sig[1] = (set->sig[0] >> 32); v.sig[0] = set->sig[0]; 570 + } 571 + return copy_to_user(compat, &v, size) ? -EFAULT : 0; 572 + #else 573 + return copy_to_user(compat, set, size) ? -EFAULT : 0; 574 + #endif 575 + } 556 576 557 577 asmlinkage long compat_sys_migrate_pages(compat_pid_t pid, 558 578 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes,
-19
kernel/compat.c
··· 488 488 } 489 489 EXPORT_SYMBOL_GPL(get_compat_sigset); 490 490 491 - int 492 - put_compat_sigset(compat_sigset_t __user *compat, const sigset_t *set, 493 - unsigned int size) 494 - { 495 - /* size <= sizeof(compat_sigset_t) <= sizeof(sigset_t) */ 496 - #ifdef __BIG_ENDIAN 497 - compat_sigset_t v; 498 - switch (_NSIG_WORDS) { 499 - case 4: v.sig[7] = (set->sig[3] >> 32); v.sig[6] = set->sig[3]; 500 - case 3: v.sig[5] = (set->sig[2] >> 32); v.sig[4] = set->sig[2]; 501 - case 2: v.sig[3] = (set->sig[1] >> 32); v.sig[2] = set->sig[1]; 502 - case 1: v.sig[1] = (set->sig[0] >> 32); v.sig[0] = set->sig[0]; 503 - } 504 - return copy_to_user(compat, &v, size) ? -EFAULT : 0; 505 - #else 506 - return copy_to_user(compat, set, size) ? -EFAULT : 0; 507 - #endif 508 - } 509 - 510 491 #ifdef CONFIG_NUMA 511 492 COMPAT_SYSCALL_DEFINE6(move_pages, pid_t, pid, compat_ulong_t, nr_pages, 512 493 compat_uptr_t __user *, pages32,