Rev. 日時 作者
4bdf61c h8300-next for-4.19 2018-08-22 19:14:23 Yoshinori Sato

h8300: fix IRQ no

Old timer handler use 24 (Compare match A).
But current timer handler use 26 (Overflow).

Signed-off-by: Yoshinori Sato <>

7b291be 2018-08-22 19:14:22 Randy Dunlap

arch/h8300: add a defconfig target

Make the "defconfig" target valid for arch/h8300. Currently
"make ARCH=h8300 defconfig" produces:

*** Can't find default configuration "arch/h8300/defconfig"!
../scripts/kconfig/Makefile:87: recipe for target 'defconfig' failed

By adding a value for KBUILD_DEFCONFIG, "make ARCH=h8300 defconfig"
successfully produces a kernel .config file:

*** Default configuration is based on 'edosk2674_defconfig'

This is useful for Kconfig editing/testing.

Signed-off-by: Randy Dunlap <>
Cc: Yoshinori Sato <>
Cc: (moderated for non-subscribers)
Signed-off-by: Yoshinori Sato <>

ce156fe 2018-08-22 19:14:22 Randy Dunlap

arch/h8300: eliminate kgbd.c warning

Drop the "const" qualifier from arch_kgdb_ops to eliminate the gcc
warning (gcc version is 8.1.0).

arch/h8300/kernel/kgdb.c:132:24: error: conflicting type qualifiers for 'arch_kgdb_ops'
const struct kgdb_arch arch_kgdb_ops = {
In file included from ../arch/h8300/kernel/kgdb.c:12:
../include/linux/kgdb.h:284:26: note: previous declaration of 'arch_kgdb_ops' was here
extern struct kgdb_arch arch_kgdb_ops;

Signed-off-by: Randy Dunlap <>
Cc: Yoshinori Sato <>
Signed-off-by: Yoshinori Sato <>

cfa2d68 2018-08-22 19:14:21 Randy Dunlap

arch/h8300: eliminate ptrace.h warnings

Add a "struct task_struct;" stub to arch/h8300's ptrace.h header to
eliminate gcc warnings (gcc version is 8.1.0).

../arch/h8300/include/asm/ptrace.h:32:34: warning: 'struct task_struct' declared inside parameter list will not be visible outside of this definition or declaration
extern long h8300_get_reg(struct task_struct *task, int regno);
../arch/h8300/include/asm/ptrace.h:33:33: warning: 'struct task_struct' declared inside parameter list will not be visible outside of this definition or declaration
extern int h8300_put_reg(struct task_struct *task, int regno,

Signed-off-by: Randy Dunlap <>
Cc: Yoshinori Sato <>
Signed-off-by: Yoshinori Sato <>

1b803a3 2018-08-22 19:14:21 Luc Van Oostenryck

h8300:let the checker know that size_t is ulong

All 64bit archs use unsigned long for size_t and most 32bit
archs use 'unsigned int'. By default, this is what is assumed
by sparse.

However, on h8300 (a 32bit arch) size_t is unsigned long which
can led sparse to emit wrong warnings.

Fix this by passing to sparse the flag -msize-long, telling it
that size_t is unsigned long.

Signed-off-by: Luc Van Oostenryck <>
Signed-off-by: Yoshinori Sato <>

9819d4e 2018-08-22 19:14:20 Will Deacon

h8300: Don't include linux/kernel.h in asm/atomic.h

linux/kernel.h isn't needed by asm/atomic.h and will result in circular
dependencies when the asm-generic atomic bitops are built around the
tomic_long_t interface.

Remove the broad include and replace it with linux/compiler.h for
READ_ONCE etc and asm/irqflags.h for arch_local_irq_save etc.

Cc: Yoshinori Sato <>
Signed-off-by: Will Deacon <>
Signed-off-by: Yoshinori Sato <>

ec3d5f1 2018-08-22 19:14:20 Rob Herring

h8300: remove unnecessary of_platform_populate call

The DT core will call of_platform_populate, so it is not necessary for
arch specific code to call it unless there are custom match entries,
auxdata or parent device. Neither of those apply here, so remove the call.

Cc: Yoshinori Sato <>
Signed-off-by: Rob Herring <>
Signed-off-by: Yoshinori Sato <>

5743ee2 2018-08-22 19:14:19 Geert Uytterhoeven

h8300: Correct signature of test_bit()

mm/filemap.c: In function 'clear_bit_unlock_is_negative_byte':
mm/filemap.c:1181:30: warning: passing argument 2 of 'test_bit' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
return test_bit(PG_waiters, mem);
In file included from include/linux/bitops.h:38,
from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/wait.h:7,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from include/linux/dax.h:5,
from mm/filemap.c:14:
arch/h8300/include/asm/bitops.h:69:57: note: expected 'const long unsigned int *' but argument is of type 'volatile void *'
static inline int test_bit(int nr, const unsigned long *addr)

Make the bitmask pointed to by the "addr" parameter volatile to fix
this, like is done on other architectures.

Signed-off-by: Geert Uytterhoeven <>
Signed-off-by: Yoshinori Sato <>

558e669 2018-08-22 19:14:19 Yoshinori Sato

h8300: irqchip: fix warning

Var "addr" type incorrect.
It have interrupt controler register address.
Type of void __iomem is correct.

Signed-off-by: Yoshinori Sato <>

c489dfe 2018-08-22 19:14:18 Rob Herring

h8300: switch to NO_BOOTMEM

Commit 0fa1c579349f ("of/fdt: use memblock_virt_alloc for early alloc")
inadvertently switched the DT unflattening allocations from memblock to
bootmem which doesn't work because the unflattening happens before
bootmem is initialized. Swapping the order of bootmem init and
unflattening could also fix this, but removing bootmem is desired. So
enable NO_BOOTMEM on h8300 like other architectures have done.

Fixes: 0fa1c579349f ("of/fdt: use memblock_virt_alloc for early alloc")
Cc: Yoshinori Sato <>
Signed-off-by: Rob Herring <>
Signed-off-by: Yoshinori Sato <>

811d1b0 2018-08-22 19:14:18 Yoshinori Sato

h8300: gcc-8.1 fix

Since gcc 8.1 does not generate an assignment statement to er 0,
we had to explicitly write it.

Signed-off-by: Yoshinori Sato <>

686320e 2018-08-22 19:14:17 Yoshinori Sato

h8300: Add missing output register.

Signed-off-by: Yoshinori Sato <>

94710ca 2018-08-13 05:41:04 Linus Torvalds

Linux 4.18

921195d 2018-08-13 04:52:05 Linus Torvalds

SCSI fixes on 20180811

Eight fixes. The most important one is the mpt3sas fix which makes
the driver work again on big endian systems. The rest are mostly
minor error path or checker issues and the vmw_scsi one fixes a
performance problem.

Signed-off-by: James E.J. Bottomley <>


Merge tag 'scsi-fixes' of git://

Pull SCSI fixes from James Bottomley:
"Eight fixes.

The most important one is the mpt3sas fix which makes the driver work
again on big endian systems. The rest are mostly minor error path or
checker issues and the vmw_scsi one fixes a performance problem"

* tag 'scsi-fixes' of git://
scsi: vmw_pvscsi: Return DID_RESET for status SAM_STAT_COMMAND_TERMINATED
scsi: sr: Avoid that opening a CD-ROM hangs with runtime power management enabled
scsi: mpt3sas: Swap I/O memory read value back to cpu endianness
scsi: fcoe: clear FC_RP_STARTED flags when receiving a LOGO
scsi: fcoe: drop frames in ELS LOGO error path
scsi: fcoe: fix use-after-free in fcoe_ctlr_els_send
scsi: qedi: Fix a potential buffer overflow
scsi: qla2xxx: Fix memory leak for allocating abort IOCB

b5b1404 2018-08-13 04:19:42 Linus Torvalds

init: rename and re-order boot_cpu_state_init()

This is purely a preparatory patch for upcoming changes during the 4.19
merge window.

We have a function called "boot_cpu_state_init()" that isn't really
about the bootup cpu state: that is done much earlier by the similarly
named "boot_cpu_init()" (note lack of "state" in name).

This function initializes some hotplug CPU state, and needs to run after
the percpu data has been properly initialized. It even has a comment to
that effect.

Except it _doesn't_ actually run after the percpu data has been properly
initialized. On x86 it happens to do that, but on at least arm and
arm64, the percpu base pointers are initialized by the arch-specific
'smp_prepare_boot_cpu()' hook, which ran _after_ boot_cpu_state_init().

This had some unexpected results, and in particular we have a patch
pending for the merge window that did the obvious cleanup of using
'this_cpu_write()' in the cpu hotplug init code:

- per_cpu_ptr(&cpuhp_state, smp_processor_id())->state = CPUHP_ONLINE;
+ this_cpu_write(cpuhp_state.state, CPUHP_ONLINE);

which is obviously the right thing to do. Except because of the
ordering issue, it actually failed miserably and unexpectedly on arm64.

So this just fixes the ordering, and changes the name of the function to
be 'boot_cpu_hotplug_init()' to make it obvious that it's about cpu
hotplug state, because the core CPU state was supposed to have already
been done earlier.

Marked for stable, since the (not yet merged) patch that will show this
problem is marked for stable.

Reported-by: Vlastimil Babka <>
Reported-by: Mian Yousaf Kaukab <>
Suggested-by: Catalin Marinas <>
Acked-by: Thomas Gleixner <>
Cc: Will Deacon <>
Signed-off-by: Linus Torvalds <>

d6dd643 2018-08-13 03:21:17 Linus Torvalds

Merge branch 'fixes' of git://

Pull vfs fixes from Al Viro:
"A bunch of race fixes, mostly around lazy pathwalk.

All of it is -stable fodder, a large part going back to 2013"

* 'fixes' of git://
make sure that __dentry_kill() always invalidates d_seq, unhashed or not
fix __legitimize_mnt()/mntput() race
fix mntput/mntput race
root dentries need RCU-delayed freeing

ec0c967 2018-08-12 03:22:44 Linus Torvalds

Merge git://

Pull networking fixes from David Miller:
"Last bit of straggler fixes...

1) Fix btf library licensing to LGPL, from Martin KaFai lau.

2) Fix error handling in bpf sockmap code, from Daniel Borkmann.

3) XDP cpumap teardown handling wrt. execution contexts, from Jesper
Dangaard Brouer.

4) Fix loss of runtime PM on failed vlan add/del, from Ivan

5) xen-netfront caches skb_shinfo(skb) across a __pskb_pull_tail()
call, which potentially changes the skb's data buffer, and thus
skb_shinfo(). Fix from Juergen Gross"

* git://
xen/netfront: don't cache skb_shinfo()
net: ethernet: ti: cpsw: fix runtime_pm while add/kill vlan
net: ethernet: ti: cpsw: clear all entries when delete vid
xdp: fix bug in devmap teardown code path
samples/bpf: xdp_redirect_cpu adjustment to reproduce teardown race easier
xdp: fix bug in cpumap teardown code path
bpf, sockmap: fix cork timeout for select due to epipe
bpf, sockmap: fix leak in bpf_tcp_sendmsg wait for mem path
bpf, sockmap: fix bpf_tcp_sendmsg sock error handling
bpf: btf: Change tools/lib/bpf/btf to LGPL

d472b3a 2018-08-12 01:41:58 Juergen Gross

xen/netfront: don't cache skb_shinfo()

skb_shinfo() can change when calling __pskb_pull_tail(): Don't cache
its return value.

Signed-off-by: Juergen Gross <>
Reviewed-by: Wei Liu <>
Signed-off-by: David S. Miller <>

556fdd8 2018-08-12 01:38:53 David S. Miller

Merge branch 'cpsw-runtime-pm-fix'

Grygorii Strashko says:

net: ethernet: ti: cpsw: fix runtime pm while add/del reserved vid

Here 2 not critical fixes for:
- vlan ale table leak while error if deleting vlan (simplifies next fix)
- runtime pm while try to set reserved vlan

Reviewed-by: Grygorii Strashko <>
Signed-off-by: David S. Miller <>

803c4f6 2018-08-12 01:38:53 Ivan Khoronzhuk

net: ethernet: ti: cpsw: fix runtime_pm while add/kill vlan

It's exclusive with normal behaviour but if try to set vlan to one of
the reserved values is made, the cpsw runtime pm is broken.

Fixes: a6c5d14f5136 ("drivers: net: cpsw: ndev: fix accessing to suspended device")
Signed-off-by: Ivan Khoronzhuk <>
Signed-off-by: David S. Miller <>

be35b98 2018-08-12 01:38:53 Ivan Khoronzhuk

net: ethernet: ti: cpsw: clear all entries when delete vid

In cases if some of the entries were not found in forwarding table
while killing vlan, the rest not needed entries still left in the
table. No need to stop, as entry was deleted anyway. So fix this by
returning error only after all was cleaned. To implement this, return
-ENOENT in cpsw_ale_del_mcast() as it's supposed to be.

Signed-off-by: Ivan Khoronzhuk <>
Signed-off-by: David S. Miller <>

4f7a7be 2018-08-11 12:19:59 Minchan Kim

zram: remove BD_CAP_SYNCHRONOUS_IO with writeback feature

If zram supports writeback feature, it's no longer a
BD_CAP_SYNCHRONOUS_IO device beause zram does asynchronous IO operations
for incompressible pages.

Do not pretend to be synchronous IO device. It makes the system very
sluggish due to waiting for IO completion from upper layers.

Furthermore, it causes a user-after-free problem because swap thinks the
opearion is done when the IO functions returns so it can free the page
(e.g., lock_page_or_retry and goto out_release in do_swap_page) but in
fact, IO is asynchronous so the driver could access a just freed page

This patch fixes the problem.

BUG: Bad page state in process qemu-system-x86 pfn:3dfab21
page:ffffdfb137eac840 count:0 mapcount:0 mapping:0000000000000000 index:0x1
flags: 0x17fffc000000008(uptodate)
raw: 017fffc000000008 dead000000000100 dead000000000200 0000000000000000
raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: PAGE_FLAGS_CHECK_AT_PREP flag set
bad because of flags: 0x8(uptodate)
CPU: 4 PID: 1039 Comm: qemu-system-x86 Tainted: G B 4.18.0-rc5+ #1
Hardware name: Supermicro Super Server/X10SRL-F, BIOS 2.0b 05/02/2017
Call Trace:
__gfn_to_pfn_memslot+0xff/0x3c0 [kvm]
try_async_pf+0x87/0x230 [kvm]
tdp_page_fault+0x132/0x290 [kvm]
kvm_mmu_page_fault+0x74/0x570 [kvm]
kvm_arch_vcpu_ioctl_run+0x9b3/0x1990 [kvm]
kvm_vcpu_ioctl+0x388/0x5d0 [kvm]

[ fix changelog, add comment]
[ coding-style fixes]
Signed-off-by: Minchan Kim <>
Reported-by: Tino Lehnig <>
Tested-by: Tino Lehnig <>
Cc: Sergey Senozhatsky <>
Cc: Jens Axboe <>
Cc: <> [4.15+]
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>

24eee1e 2018-08-11 12:19:58

mm/memory.c: check return value of ioremap_prot

ioremap_prot() can return NULL which could lead to an oops.

Signed-off-by: chen jie <>
Reviewed-by: Andrew Morton <>
Cc: Li Zefan <>
Cc: chenjie <>
Cc: Yang Shi <>
Cc: Alexey Dobriyan <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>

3ca17b1 2018-08-11 12:19:58 Andrey Ryabinin

lib/ubsan: remove null-pointer checks

With gcc-8 fsanitize=null become very noisy. GCC started to complain
about things like &a->b, where 'a' is NULL pointer. There is no NULL
dereference, we just calculate address to struct member. It's
technically undefined behavior so UBSAN is correct to report it. But as
long as there is no real NULL-dereference, I think, we should be fine.

-fno-delete-null-pointer-checks compiler flag should protect us from any
consequences. So let's just no use -fsanitize=null as it's not useful
for us. If there is a real NULL-deref we will see crash. Even if
userspace mapped something at NULL (root can do this), with things like
SMAP should catch the issue.

Signed-off-by: Andrey Ryabinin <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>

5832fcf 2018-08-11 12:19:58 Kieran Bingham

MAINTAINERS: GDB: update e-mail address

This entry was created with my personal e-mail address. Update this entry
to my open-source account.

Signed-off-by: Kieran Bingham <>
Cc: Jan Kiszka <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>

f313b43 2018-08-11 02:04:56 Linus Torvalds

Merge branch 'i2c/for-current' of git://

Pull i2c fix from Wolfram Sang:
"A single driver bugfix for I2C.

The bug was found by systematically stress testing the driver, so I am
confident to merge it that late in the cycle although it is probably
unusually large"

* 'i2c/for-current' of git://
i2c: xlp9xx: Fix case where SSIF read transaction completes early

e91e218 2018-08-10 15:18:29 David S. Miller

Merge git://

Daniel Borkmann says:

pull-request: bpf 2018-08-10

The following pull-request contains BPF updates for your *net* tree.

The main changes are:

1) Fix cpumap and devmap on teardown as they're under RCU context
and won't have same assumption as running under NAPI protection,
from Jesper.

2) Fix various sockmap bugs in bpf_tcp_sendmsg() code, e.g. we had
a bug where socket error was not propagated correctly, from Daniel.

3) Fix incompatible libbpf header license for BTF code and match it
before it gets officially released with the rest of libbpf which
is LGPL-2.1, from Martin.

Signed-off-by: David S. Miller <>

4c0d7cd 2018-08-10 07:07:15 Al Viro

make sure that __dentry_kill() always invalidates d_seq, unhashed or not

RCU pathwalk relies upon the assumption that anything that changes
->d_inode of a dentry will invalidate its ->d_seq. That's almost
true - the one exception is that the final dput() of already unhashed
dentry does *not* touch ->d_seq at all. Unhashing does, though,
so for anything we'd found by RCU dcache lookup we are fine.
Unfortunately, we can *start* with an unhashed dentry or jump into

We could try and be careful in the (few) places where that could
happen. Or we could just make the final dput() invalidate the damn
thing, unhashed or not. The latter is much simpler and easier to
backport, so let's do it that way.

Reported-by: "Dae R. Jeong" <>
Signed-off-by: Al Viro <>

119e1ef 2018-08-10 06:51:32 Al Viro

fix __legitimize_mnt()/mntput() race

__legitimize_mnt() has two problems - one is that in case of success
the check of mount_lock is not ordered wrt preceding increment of
refcount, making it possible to have successful __legitimize_mnt()
on one CPU just before the otherwise final mntpu() on another,
with __legitimize_mnt() not seeing mntput() taking the lock and
mntput() not seeing the increment done by __legitimize_mnt().
Solved by a pair of barriers.

Another is that failure of __legitimize_mnt() on the second
read_seqretry() leaves us with reference that'll need to be
dropped by caller; however, if that races with final mntput()
we can end up with caller dropping rcu_read_lock() and doing
mntput() to release that reference - with the first mntput()
having freed the damn thing just as rcu_read_lock() had been
dropped. Solution: in "do mntput() yourself" failure case
grab mount_lock, check if MNT_DOOMED has been set by racing
final mntput() that has missed our increment and if it has -
undo the increment and treat that as "failure, caller doesn't
need to drop anything" case.

It's not easy to hit - the final mntput() has to come right
after the first read_seqretry() in __legitimize_mnt() *and*
manage to miss the increment done by __legitimize_mnt() before
the second read_seqretry() in there. The things that are almost
impossible to hit on bare hardware are not impossible on SMP
KVM, though...

Reported-by: Oleg Nesterov <>
Fixes: 48a066e72d97 ("RCU'd vsfmounts")
Signed-off-by: Al Viro <>

9ea0a46 2018-08-10 06:21:17 Al Viro

fix mntput/mntput race

mntput_no_expire() does the calculation of total refcount under mount_lock;
unfortunately, the decrement (as well as all increments) are done outside
of it, leading to false positives in the "are we dropping the last reference"
test. Consider the following situation:
* mnt is a lazy-umounted mount, kept alive by two opened files. One
of those files gets closed. Total refcount of mnt is 2. On CPU 42
mntput(mnt) (called from __fput()) drops one reference, decrementing component
* After it has looked at component #0, the process on CPU 0 does
mntget(), incrementing component #0, gets preempted and gets to run again -
on CPU 69. There it does mntput(), which drops the reference (component #69)
and proceeds to spin on mount_lock.
* On CPU 42 our first mntput() finishes counting. It observes the
decrement of component #69, but not the increment of component #0. As the
result, the total it gets is not 1 as it should've been - it's 0. At which
point we decide that vfsmount needs to be killed and proceed to free it and
shut the filesystem down. However, there's still another opened file
on that filesystem, with reference to (now freed) vfsmount, etc. and we are

It's not a wide race, but it can be reproduced with artificial slowdown of
the mnt_get_count() loop, and it should be easier to hit on SMP KVM setups.

Fix consists of moving the refcount decrement under mount_lock; the tricky
part is that we want (and can) keep the fast case (i.e. mount that still
has non-NULL ->mnt_ns) entirely out of mount_lock. All places that zero
mnt->mnt_ns are dropping some reference to mnt and they call synchronize_rcu()
before that mntput(). IOW, if mntput() observes (under rcu_read_lock())
a non-NULL ->mnt_ns, it is guaranteed that there is another reference yet to
be dropped.

Reported-by: Jann Horn <>
Tested-by: Jann Horn <>
Fixes: 48a066e72d97 ("RCU'd vsfmounts")
Signed-off-by: Al Viro <>