14 Jan, 2020

4 commits

  • Extra Boot Config (XBC) allows admin to pass a tree-structured
    boot configuration file when boot up the kernel. This extends
    the kernel command line in an efficient way.

    Boot config will contain some key-value commands, e.g.

    key.word = value1
    another.key.word = value2

    It can fold same keys with braces, also you can write array
    data. For example,

    key {
    word1 {
    setting1 = data
    setting2
    }
    word2.array = "val1", "val2"
    }

    User can access these key-value pair and tree structure via
    SKC APIs.

    Link: http://lkml.kernel.org/r/157867221257.17873.1775090991929862549.stgit@devnote2

    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Steven Rostedt (VMware)

    Masami Hiramatsu
     
  • As there's two struct ring_buffers in the kernel, it causes some confusion.
    The other one being the perf ring buffer. It was agreed upon that as neither
    of the ring buffers are generic enough to be used globally, they should be
    renamed as:

    perf's ring_buffer -> perf_buffer
    ftrace's ring_buffer -> trace_buffer

    This implements the changes to the ring buffer that ftrace uses.

    Link: https://lore.kernel.org/r/20191213140531.116b3200@gandalf.local.home

    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     
  • As we are working to remove the generic "ring_buffer" name that is used by
    both tracing and perf, the ring_buffer name for tracing will be renamed to
    trace_buffer, and perf's ring buffer will be renamed to perf_buffer.

    As there already exists a trace_buffer that is used by the trace_arrays, it
    needs to be first renamed to array_buffer.

    Link: https://lore.kernel.org/r/20191213153553.GE20583@krava

    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     
  • eBPF requires needing to know the size of the perf ring buffer structure.
    But it unfortunately has the same name as the generic ring buffer used by
    tracing and oprofile. To make it less ambiguous, rename the perf ring buffer
    structure to "perf_buffer".

    As other parts of the ring buffer code has "perf_" as the prefix, it only
    makes sense to give the ring buffer the "perf_" prefix as well.

    Link: https://lore.kernel.org/r/20191213153553.GE20583@krava
    Acked-by: Peter Zijlstra
    Suggested-by: Alexei Starovoitov
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     

13 Jan, 2020

2 commits

  • Pull RISC-V fixes from Paul Walmsley:
    "Two fixes for RISC-V:

    - Clear FP registers during boot when FP support is present, rather
    than when they aren't present

    - Move the header files associated with the SiFive L2 cache
    controller to drivers/soc (where the code was recently moved)"

    * tag 'riscv/for-v5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
    riscv: Fixup obvious bug for fp-regs reset
    riscv: move sifive_l2_cache.h to include/soc

    Linus Torvalds
     
  • The commit 9209fb51896f ("riscv: move sifive_l2_cache.c to drivers/soc")
    moves the sifive L2 cache driver to driver/soc. It did not move the
    header file along with the driver. Therefore this patch moves the header
    file to driver/soc

    Signed-off-by: Yash Shah
    Reviewed-by: Anup Patel
    [paul.walmsley@sifive.com: updated to fix the include guard]
    Fixes: 9209fb51896f ("riscv: move sifive_l2_cache.c to drivers/soc")
    Signed-off-by: Paul Walmsley

    Yash Shah
     

11 Jan, 2020

2 commits

  • Pull block fixes from Jens Axboe:
    "A few fixes that should go into this round.

    This pull request contains two NVMe fixes via Keith, removal of a dead
    function, and a fix for the bio op for read truncates (Ming)"

    * tag 'block-5.5-2020-01-10' of git://git.kernel.dk/linux-block:
    nvmet: fix per feat data len for get_feature
    nvme: Translate more status codes to blk_status_t
    fs: move guard_bio_eod() after bio_set_op_attrs
    block: remove unused mp_bvec_last_segment

    Linus Torvalds
     
  • Pull MTD fixes from Miquel Raynal:
    "MTD:
    - sm_ftl: Fix NULL pointer warning.

    Raw NAND:
    - Cadence: fix compile testing.
    - STM32: Avoid locking.

    Onenand:
    - Fix several sparse/build warnings.

    SPI-NOR:
    - Add a flag to fix interaction with Micron parts"

    * tag 'mtd/fixes-for-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux:
    mtd: spi-nor: Fix the writing of the Status Register on micron flashes
    mtd: sm_ftl: fix NULL pointer warning
    mtd: onenand: omap2: Pass correct flags for prep_dma_memcpy
    mtd: onenand: samsung: Fix iomem access with regular memcpy
    mtd: onenand: omap2: Fix errors in style
    mtd: cadence: Fix cast to pointer from integer of different size warning
    mtd: rawnand: stm32_fmc2: avoid to lock the CPU bus

    Linus Torvalds
     

10 Jan, 2020

3 commits

  • Pull input fixes from Dmitry Torokhov:
    "Just a few small fixups here"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
    Input: imx_sc_key - only take the valid data from SCU firmware as key state
    Input: add safety guards to input_set_keycode()
    Input: input_event - fix struct padding on sparc64
    Input: uinput - always report EPOLLOUT

    Linus Torvalds
     
  • Correct mispelling, spacing, and coding style flaws caught by
    checkpatch.pl script in the Omap2 Onenand driver .

    Signed-off-by: Amir Mahdi Ghorbanian
    Signed-off-by: Miquel Raynal

    Amir Mahdi Ghorbanian
     
  • Pull networking fixes from David Miller:

    1) Missing netns pointer init in arp_tables, from Florian Westphal.

    2) Fix normal tcp SACK being treated as D-SACK, from Pengcheng Yang.

    3) Fix divide by zero in sch_cake, from Wen Yang.

    4) Len passed to skb_put_padto() is wrong in qrtr code, from Carl
    Huang.

    5) cmd->obj.chunk is leaked in sctp code error paths, from Xin Long.

    6) cgroup bpf programs can be released out of order, fix from Roman
    Gushchin.

    7) Make sure stmmac debugfs entry name is changed when device name
    changes, from Jiping Ma.

    8) Fix memory leak in vlan_dev_set_egress_priority(), from Eric
    Dumazet.

    9) SKB leak in lan78xx usb driver, also from Eric Dumazet.

    10) Ridiculous TCA_FQ_QUANTUM values configured can cause loops in fq
    packet scheduler, reject them. From Eric Dumazet.

    * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (69 commits)
    tipc: fix wrong connect() return code
    tipc: fix link overflow issue at socket shutdown
    netfilter: ipset: avoid null deref when IPSET_ATTR_LINENO is present
    netfilter: conntrack: dccp, sctp: handle null timeout argument
    atm: eni: fix uninitialized variable warning
    macvlan: do not assume mac_header is set in macvlan_broadcast()
    net: sch_prio: When ungrafting, replace with FIFO
    mlxsw: spectrum_qdisc: Ignore grafting of invisible FIFO
    MAINTAINERS: Remove myself as co-maintainer for qcom-ethqos
    gtp: fix bad unlock balance in gtp_encap_enable_socket
    pkt_sched: fq: do not accept silly TCA_FQ_QUANTUM
    tipc: remove meaningless assignment in Makefile
    tipc: do not add socket.o to tipc-y twice
    net: stmmac: dwmac-sun8i: Allow all RGMII modes
    net: stmmac: dwmac-sunxi: Allow all RGMII modes
    net: usb: lan78xx: fix possible skb leak
    net: stmmac: Fixed link does not need MDIO Bus
    vlan: vlan_changelink() should propagate errors
    vlan: fix memory leak in vlan_dev_set_egress_priority
    stmmac: debugfs entry name is not be changed when udev rename device name.
    ...

    Linus Torvalds
     

09 Jan, 2020

2 commits

  • Pablo Neira Ayuso says:

    ====================
    Netfilter fixes for net

    The following patchset contains Netfilter fixes for net:

    1) Missing netns context in arp_tables, from Florian Westphal.

    2) Underflow in flowtable reference counter, from wenxu.

    3) Fix incorrect ethernet destination address in flowtable offload,
    from wenxu.

    4) Check for status of neighbour entry, from wenxu.

    5) Fix NAT port mangling, from wenxu.

    6) Unbind callbacks from destroy path to cleanup hardware properly
    on flowtable removal.

    7) Fix missing casting statistics timestamp, add nf_flowtable_time_stamp
    and use it.

    8) NULL pointer exception when timeout argument is null in conntrack
    dccp and sctp protocol helpers, from Florian Westphal.

    9) Possible nul-dereference in ipset with IPSET_ATTR_LINENO, also from
    Florian.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Use of eth_hdr() in tx path is error prone.

    Many drivers call skb_reset_mac_header() before using it,
    but others do not.

    Commit 6d1ccff62780 ("net: reset mac header in dev_start_xmit()")
    attempted to fix this generically, but commit d346a3fae3ff
    ("packet: introduce PACKET_QDISC_BYPASS socket option") brought
    back the macvlan bug.

    Lets add a new helper, so that tx paths no longer have
    to call skb_reset_mac_header() only to get a pointer
    to skb->data.

    Hopefully we will be able to revert 6d1ccff62780
    ("net: reset mac header in dev_start_xmit()") and save few cycles
    in transmit fast path.

    BUG: KASAN: use-after-free in __get_unaligned_cpu32 include/linux/unaligned/packed_struct.h:19 [inline]
    BUG: KASAN: use-after-free in mc_hash drivers/net/macvlan.c:251 [inline]
    BUG: KASAN: use-after-free in macvlan_broadcast+0x547/0x620 drivers/net/macvlan.c:277
    Read of size 4 at addr ffff8880a4932401 by task syz-executor947/9579

    CPU: 0 PID: 9579 Comm: syz-executor947 Not tainted 5.5.0-rc4-syzkaller #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    Call Trace:
    __dump_stack lib/dump_stack.c:77 [inline]
    dump_stack+0x197/0x210 lib/dump_stack.c:118
    print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
    __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506
    kasan_report+0x12/0x20 mm/kasan/common.c:639
    __asan_report_load_n_noabort+0xf/0x20 mm/kasan/generic_report.c:145
    __get_unaligned_cpu32 include/linux/unaligned/packed_struct.h:19 [inline]
    mc_hash drivers/net/macvlan.c:251 [inline]
    macvlan_broadcast+0x547/0x620 drivers/net/macvlan.c:277
    macvlan_queue_xmit drivers/net/macvlan.c:520 [inline]
    macvlan_start_xmit+0x402/0x77f drivers/net/macvlan.c:559
    __netdev_start_xmit include/linux/netdevice.h:4447 [inline]
    netdev_start_xmit include/linux/netdevice.h:4461 [inline]
    dev_direct_xmit+0x419/0x630 net/core/dev.c:4079
    packet_direct_xmit+0x1a9/0x250 net/packet/af_packet.c:240
    packet_snd net/packet/af_packet.c:2966 [inline]
    packet_sendmsg+0x260d/0x6220 net/packet/af_packet.c:2991
    sock_sendmsg_nosec net/socket.c:639 [inline]
    sock_sendmsg+0xd7/0x130 net/socket.c:659
    __sys_sendto+0x262/0x380 net/socket.c:1985
    __do_sys_sendto net/socket.c:1997 [inline]
    __se_sys_sendto net/socket.c:1993 [inline]
    __x64_sys_sendto+0xe1/0x1a0 net/socket.c:1993
    do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
    entry_SYSCALL_64_after_hwframe+0x49/0xbe
    RIP: 0033:0x442639
    Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 3d 01 f0 ff ff 0f 83 5b 10 fc ff c3 66 2e 0f 1f 84 00 00 00 00
    RSP: 002b:00007ffc13549e08 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
    RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000442639
    RDX: 000000000000000e RSI: 0000000020000080 RDI: 0000000000000003
    RBP: 0000000000000004 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
    R13: 0000000000403bb0 R14: 0000000000000000 R15: 0000000000000000

    Allocated by task 9389:
    save_stack+0x23/0x90 mm/kasan/common.c:72
    set_track mm/kasan/common.c:80 [inline]
    __kasan_kmalloc mm/kasan/common.c:513 [inline]
    __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:486
    kasan_kmalloc+0x9/0x10 mm/kasan/common.c:527
    __do_kmalloc mm/slab.c:3656 [inline]
    __kmalloc+0x163/0x770 mm/slab.c:3665
    kmalloc include/linux/slab.h:561 [inline]
    tomoyo_realpath_from_path+0xc5/0x660 security/tomoyo/realpath.c:252
    tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
    tomoyo_path_perm+0x230/0x430 security/tomoyo/file.c:822
    tomoyo_inode_getattr+0x1d/0x30 security/tomoyo/tomoyo.c:129
    security_inode_getattr+0xf2/0x150 security/security.c:1222
    vfs_getattr+0x25/0x70 fs/stat.c:115
    vfs_statx_fd+0x71/0xc0 fs/stat.c:145
    vfs_fstat include/linux/fs.h:3265 [inline]
    __do_sys_newfstat+0x9b/0x120 fs/stat.c:378
    __se_sys_newfstat fs/stat.c:375 [inline]
    __x64_sys_newfstat+0x54/0x80 fs/stat.c:375
    do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
    entry_SYSCALL_64_after_hwframe+0x49/0xbe

    Freed by task 9389:
    save_stack+0x23/0x90 mm/kasan/common.c:72
    set_track mm/kasan/common.c:80 [inline]
    kasan_set_free_info mm/kasan/common.c:335 [inline]
    __kasan_slab_free+0x102/0x150 mm/kasan/common.c:474
    kasan_slab_free+0xe/0x10 mm/kasan/common.c:483
    __cache_free mm/slab.c:3426 [inline]
    kfree+0x10a/0x2c0 mm/slab.c:3757
    tomoyo_realpath_from_path+0x1a7/0x660 security/tomoyo/realpath.c:289
    tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
    tomoyo_path_perm+0x230/0x430 security/tomoyo/file.c:822
    tomoyo_inode_getattr+0x1d/0x30 security/tomoyo/tomoyo.c:129
    security_inode_getattr+0xf2/0x150 security/security.c:1222
    vfs_getattr+0x25/0x70 fs/stat.c:115
    vfs_statx_fd+0x71/0xc0 fs/stat.c:145
    vfs_fstat include/linux/fs.h:3265 [inline]
    __do_sys_newfstat+0x9b/0x120 fs/stat.c:378
    __se_sys_newfstat fs/stat.c:375 [inline]
    __x64_sys_newfstat+0x54/0x80 fs/stat.c:375
    do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
    entry_SYSCALL_64_after_hwframe+0x49/0xbe

    The buggy address belongs to the object at ffff8880a4932000
    which belongs to the cache kmalloc-4k of size 4096
    The buggy address is located 1025 bytes inside of
    4096-byte region [ffff8880a4932000, ffff8880a4933000)
    The buggy address belongs to the page:
    page:ffffea0002924c80 refcount:1 mapcount:0 mapping:ffff8880aa402000 index:0x0 compound_mapcount: 0
    raw: 00fffe0000010200 ffffea0002846208 ffffea00028f3888 ffff8880aa402000
    raw: 0000000000000000 ffff8880a4932000 0000000100000001 0000000000000000
    page dumped because: kasan: bad access detected

    Memory state around the buggy address:
    ffff8880a4932300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ffff8880a4932380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    >ffff8880a4932400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ^
    ffff8880a4932480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ffff8880a4932500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb

    Fixes: b863ceb7ddce ("[NET]: Add macvlan driver")
    Signed-off-by: Eric Dumazet
    Reported-by: syzbot
    Signed-off-by: David S. Miller

    Eric Dumazet
     

07 Jan, 2020

4 commits

  • Pull tracing fixes from Steven Rostedt:
    "Various tracing fixes:

    - kbuild found missing define of MCOUNT_INSN_SIZE for various build
    configs

    - Initialize variable to zero as gcc thinks it is used undefined (it
    really isn't but the code is subtle enough that this doesn't hurt)

    - Convert from do_div() to div64_ull() to prevent potential divide by
    zero

    - Unregister a trace point on error path in sched_wakeup tracer

    - Use signed offset for archs that can have stext not be first

    - A simple indentation fix (whitespace error)"

    * tag 'trace-v5.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
    tracing: Fix indentation issue
    kernel/trace: Fix do not unregister tracepoints when register sched_migrate_task fail
    tracing: Change offset type to s32 in preempt/irq tracepoints
    ftrace: Avoid potential division by zero in function profiler
    tracing: Have stack tracer compile when MCOUNT_INSN_SIZE is not defined
    tracing: Define MCOUNT_INSN_SIZE when not defined without direct calls
    tracing: Initialize val to zero in parse_entry of inject code

    Linus Torvalds
     
  • Fix up inconsistent usage of upper and lowercase letters in "Samsung"
    name.

    "SAMSUNG" is not an abbreviation but a regular trademarked name.
    Therefore it should be written with lowercase letters starting with
    capital letter.

    Although advertisement materials usually use uppercase "SAMSUNG", the
    lowercase version is used in all legal aspects (e.g. on Wikipedia and in
    privacy/legal statements on
    https://www.samsung.com/semiconductor/privacy-global/).

    Signed-off-by: Krzysztof Kozlowski
    Signed-off-by: David S. Miller

    Krzysztof Kozlowski
     
  • Pull spi fixes from Mark Brown:
    "A small collection of fixes here, one to make the newly added PTP
    timestamping code more accurate, a few driver fixes and a fix for the
    core DT binding to document the fact that we support eight wire buses"

    * tag 'spi-fix-v5.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
    spi: Document Octal mode as valid SPI bus width
    spi: spi-dw: Add lock protect dw_spi rx/tx to prevent concurrent calls
    spi: spi-fsl-dspi: Fix 16-bit word order in 32-bit XSPI mode
    spi: Don't look at TX buffer for PTP system timestamping
    spi: uniphier: Fix FIFO threshold

    Linus Torvalds
     
  • Pull RTC fixes from Alexandre Belloni:
    "A few fixes for this cycle. The CMOS AltCentury support broke a few
    platforms with a recent BIOS so I reverted it. The mt6397 fix is not
    that critical but good to have. And finally, the sun6i fix repairs
    WiFi and BT on a few platforms.

    Summary:

    - cmos: revert AltCentury support on AMD/Hygon

    - mt6397: fix alarm register overwrite

    - sun6i: ensure clock is working on R40"

    * tag 'rtc-5.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux:
    rtc: cmos: Revert "rtc: Fix the AltCentury value on AMD/Hygon platform"
    rtc: mt6397: fix alarm register overwrite
    rtc: sun6i: Add support for RTC clocks on R40

    Linus Torvalds
     

06 Jan, 2020

1 commit

  • This patch adds nf_flowtable_time_stamp and updates the existing code to
    use it.

    This patch is also implicitly fixing up hardware statistic fetching via
    nf_flow_offload_stats() where casting to u32 is missing. Use
    nf_flow_timeout_delta() to fix this.

    Fixes: c29f74e0df7a ("netfilter: nf_flow_table: hardware offload support")
    Signed-off-by: Pablo Neira Ayuso
    Acked-by: wenxu

    Pablo Neira Ayuso
     

05 Jan, 2020

4 commits

  • After commit 85a8ce62c2ea ("block: add bio_truncate to fix guard_bio_eod")
    this function is unused, remove it.

    Reviewed-by: Ming Lei
    Signed-off-by: Jens Axboe

    Jens Axboe
     
  • Make the layout of kcov_remote_arg the same for 32-bit and 64-bit code.
    This makes it more convenient to write userspace apps that can be
    compiled into 32-bit or 64-bit binaries and still work with the same
    64-bit kernel.

    Also use proper __u32 types in uapi headers instead of unsigned ints.

    Link: http://lkml.kernel.org/r/9e91020876029cfefc9211ff747685eba9536426.1575638983.git.andreyknvl@google.com
    Fixes: eec028c9386ed1a ("kcov: remote coverage support")
    Signed-off-by: Andrey Konovalov
    Acked-by: Marco Elver
    Cc: Greg Kroah-Hartman
    Cc: Alan Stern
    Cc: Felipe Balbi
    Cc: Chunfeng Yun
    Cc: "Jacky . Cao @ sony . com"
    Cc: Dmitry Vyukov
    Cc: Alexander Potapenko
    Cc: Marco Elver
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Konovalov
     
  • We currently try to shrink a single zone when removing memory. We use
    the zone of the first page of the memory we are removing. If that
    memmap was never initialized (e.g., memory was never onlined), we will
    read garbage and can trigger kernel BUGs (due to a stale pointer):

    BUG: unable to handle page fault for address: 000000000000353d
    #PF: supervisor write access in kernel mode
    #PF: error_code(0x0002) - not-present page
    PGD 0 P4D 0
    Oops: 0002 [#1] SMP PTI
    CPU: 1 PID: 7 Comm: kworker/u8:0 Not tainted 5.3.0-rc5-next-20190820+ #317
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.4
    Workqueue: kacpi_hotplug acpi_hotplug_work_fn
    RIP: 0010:clear_zone_contiguous+0x5/0x10
    Code: 48 89 c6 48 89 c3 e8 2a fe ff ff 48 85 c0 75 cf 5b 5d c3 c6 85 fd 05 00 00 01 5b 5d c3 0f 1f 840
    RSP: 0018:ffffad2400043c98 EFLAGS: 00010246
    RAX: 0000000000000000 RBX: 0000000200000000 RCX: 0000000000000000
    RDX: 0000000000200000 RSI: 0000000000140000 RDI: 0000000000002f40
    RBP: 0000000140000000 R08: 0000000000000000 R09: 0000000000000001
    R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000140000
    R13: 0000000000140000 R14: 0000000000002f40 R15: ffff9e3e7aff3680
    FS: 0000000000000000(0000) GS:ffff9e3e7bb00000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 000000000000353d CR3: 0000000058610000 CR4: 00000000000006e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
    __remove_pages+0x4b/0x640
    arch_remove_memory+0x63/0x8d
    try_remove_memory+0xdb/0x130
    __remove_memory+0xa/0x11
    acpi_memory_device_remove+0x70/0x100
    acpi_bus_trim+0x55/0x90
    acpi_device_hotplug+0x227/0x3a0
    acpi_hotplug_work_fn+0x1a/0x30
    process_one_work+0x221/0x550
    worker_thread+0x50/0x3b0
    kthread+0x105/0x140
    ret_from_fork+0x3a/0x50
    Modules linked in:
    CR2: 000000000000353d

    Instead, shrink the zones when offlining memory or when onlining failed.
    Introduce and use remove_pfn_range_from_zone(() for that. We now
    properly shrink the zones, even if we have DIMMs whereby

    - Some memory blocks fall into no zone (never onlined)

    - Some memory blocks fall into multiple zones (offlined+re-onlined)

    - Multiple memory blocks that fall into different zones

    Drop the zone parameter (with a potential dubious value) from
    __remove_pages() and __remove_section().

    Link: http://lkml.kernel.org/r/20191006085646.5768-6-david@redhat.com
    Fixes: f1dd2cd13c4b ("mm, memory_hotplug: do not associate hotadded memory to zones until online") [visible after d0dc12e86b319]
    Signed-off-by: David Hildenbrand
    Reviewed-by: Oscar Salvador
    Cc: Michal Hocko
    Cc: "Matthew Wilcox (Oracle)"
    Cc: "Aneesh Kumar K.V"
    Cc: Pavel Tatashin
    Cc: Greg Kroah-Hartman
    Cc: Dan Williams
    Cc: Logan Gunthorpe
    Cc: [5.0+]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Hildenbrand
     
  • Pull dmaengine fixes from Vinod Koul:
    "A bunch of fixes for:

    - uninitialized dma_slave_caps access

    - virt-dma use after free in vchan_complete()

    - driver fixes for ioat, k3dma and jz4780"

    * tag 'dmaengine-fix-5.5-rc5' of git://git.infradead.org/users/vkoul/slave-dma:
    ioat: ioat_alloc_ring() failure handling.
    dmaengine: virt-dma: Fix access after free in vchan_complete()
    dmaengine: k3dma: Avoid null pointer traversal
    dmaengine: dma-jz4780: Also break descriptor chains on JZ4725B
    dmaengine: Fix access to uninitialized dma_slave_caps

    Linus Torvalds
     

04 Jan, 2020

2 commits

  • Pull block fixes from Jens Axboe:
    "Three fixes in here:

    - Fix for a missing split on default memory boundary mask (4G) (Ming)

    - Fix for multi-page read bio truncate (Ming)

    - Fix for null_blk zone close request handling (Damien)"

    * tag 'block-5.5-20200103' of git://git.kernel.dk/linux-block:
    null_blk: Fix REQ_OP_ZONE_CLOSE handling
    block: fix splitting segments on boundary masks
    block: add bio_truncate to fix guard_bio_eod

    Linus Torvalds
     
  • Discussion in the below link reported that symbols in modules can appear
    to be before _stext on ARM architecture, causing wrapping with the
    offsets of this tracepoint. Change the offset type to s32 to fix this.

    Link: http://lore.kernel.org/r/20191127154428.191095-1-antonio.borneo@st.com
    Link: http://lkml.kernel.org/r/20200102194625.226436-1-joel@joelfernandes.org

    Cc: Bjorn Helgaas
    Cc: David Sterba
    Cc: Ingo Molnar
    Cc: Mike Rapoport
    Cc: "Rafael J. Wysocki"
    Cc: Sakari Ailus
    Cc: Antonio Borneo
    Cc: stable@vger.kernel.org
    Fixes: d59158162e032 ("tracing: Add support for preempt and irq enable/disable events")
    Signed-off-by: Joel Fernandes (Google)
    Signed-off-by: Steven Rostedt (VMware)

    Joel Fernandes (Google)
     

03 Jan, 2020

2 commits

  • Pull final sizeof_field conversion from Kees Cook:
    "Remove now unused FIELD_SIZEOF() macro (Kees Cook)"

    * tag 'sizeof_field-v5.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
    kernel.h: Remove unused FIELD_SIZEOF()

    Linus Torvalds
     
  • This reverts commit 8243186f0cc7 ("fs: remove ksys_dup()") and the
    subsequent fix for it in commit 2d3145f8d280 ("early init: fix error
    handling when opening /dev/console").

    Trying to use filp_open() and f_dupfd() instead of pseudo-syscalls
    caused more trouble than what is worth it: it requires accessing vfs
    internals and it turns out there were other bugs in it too.

    In particular, the file reference counting was wrong - because unlike
    the original "open+2*dup" sequence it used "filp_open+3*f_dupfd" and
    thus had an extra leaked file reference.

    That in turn then caused odd problems with Androidx86 long after boot
    becaue of how the extra reference to the console kept the session active
    even after all file descriptors had been closed.

    Reported-by: youling 257
    Cc: Arvind Sankar
    Cc: Al Viro
    Signed-off-by: Dominik Brodowski
    Signed-off-by: Linus Torvalds

    Dominik Brodowski
     

02 Jan, 2020

1 commit

  • KMSAN sysbot detected a read access to an untinitialized value in the
    headroom of an outgoing CAN related sk_buff. When using CAN sockets this
    area is filled appropriately - but when using a packet socket this
    initialization is missing.

    The problematic read access occurs in the CAN receive path which can
    only be triggered when the sk_buff is sent through a (virtual) CAN
    interface. So we check in the sending path whether we need to perform
    the missing initializations.

    Fixes: d3b58c47d330d ("can: replace timestamp as unique skb attribute")
    Reported-by: syzbot+b02ff0707a97e4e79ebb@syzkaller.appspotmail.com
    Signed-off-by: Oliver Hartkopp
    Tested-by: Oliver Hartkopp
    Cc: linux-stable # >= v4.1
    Signed-off-by: Marc Kleine-Budde

    Oliver Hartkopp
     

01 Jan, 2020

1 commit

  • Pull networking fixes from David Miller:

    1) Fix big endian overflow in nf_flow_table, from Arnd Bergmann.

    2) Fix port selection on big endian in nft_tproxy, from Phil Sutter.

    3) Fix precision tracking for unbound scalars in bpf verifier, from
    Daniel Borkmann.

    4) Fix integer overflow in socket rcvbuf check in UDP, from Antonio
    Messina.

    5) Do not perform a neigh confirmation during a pmtu update over a
    tunnel, from Hangbin Liu.

    6) Fix DMA mapping leak in dpaa_eth driver, from Madalin Bucur.

    7) Various PTP fixes for sja1105 dsa driver, from Vladimir Oltean.

    8) Add missing to dummy definition of of_mdiobus_child_is_phy(), from
    Geert Uytterhoeven

    * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (54 commits)
    hsr: fix slab-out-of-bounds Read in hsr_debugfs_rename()
    net/sched: add delete_empty() to filters and use it in cls_flower
    tcp: Fix highest_sack and highest_sack_seq
    ptp: fix the race between the release of ptp_clock and cdev
    net: dsa: sja1105: Reconcile the meaning of TPID and TPID2 for E/T and P/Q/R/S
    Documentation: net: dsa: sja1105: Remove text about taprio base-time limitation
    net: dsa: sja1105: Remove restriction of zero base-time for taprio offload
    net: dsa: sja1105: Really make the PTP command read-write
    net: dsa: sja1105: Take PTP egress timestamp by port, not mgmt slot
    cxgb4/cxgb4vf: fix flow control display for auto negotiation
    mlxsw: spectrum: Use dedicated policer for VRRP packets
    mlxsw: spectrum_router: Skip loopback RIFs during MAC validation
    net: stmmac: dwmac-meson8b: Fix the RGMII TX delay on Meson8b/8m2 SoCs
    net/sched: act_mirred: Pull mac prior redir to non mac_header_xmit device
    net_sched: sch_fq: properly set sk->sk_pacing_status
    bnx2x: Fix accounting of vlan resources among the PFs
    bnx2x: Use appropriate define for vlan credit
    of: mdio: Add missing inline to of_mdiobus_child_is_phy() dummy
    net: phy: aquantia: add suspend / resume ops for AQR105
    dpaa_eth: fix DMA mapping leak
    ...

    Linus Torvalds
     

31 Dec, 2019

3 commits

  • Revert "net/sched: cls_u32: fix refcount leak in the error path of
    u32_change()", and fix the u32 refcount leak in a more generic way that
    preserves the semantic of rule dumping.
    On tc filters that don't support lockless insertion/removal, there is no
    need to guard against concurrent insertion when a removal is in progress.
    Therefore, for most of them we can avoid a full walk() when deleting, and
    just decrease the refcount, like it was done on older Linux kernels.
    This fixes situations where walk() was wrongly detecting a non-empty
    filter, like it happened with cls_u32 in the error path of change(), thus
    leading to failures in the following tdc selftests:

    6aa7: (filter, u32) Add/Replace u32 with source match and invalid indev
    6658: (filter, u32) Add/Replace u32 with custom hash table and invalid handle
    74c2: (filter, u32) Add/Replace u32 filter with invalid hash table id

    On cls_flower, and on (future) lockless filters, this check is necessary:
    move all the check_empty() logic in a callback so that each filter
    can have its own implementation. For cls_flower, it's sufficient to check
    if no IDRs have been allocated.

    This reverts commit 275c44aa194b7159d1191817b20e076f55f0e620.

    Changes since v1:
    - document the need for delete_empty() when TCF_PROTO_OPS_DOIT_UNLOCKED
    is used, thanks to Vlad Buslov
    - implement delete_empty() without doing fl_walk(), thanks to Vlad Buslov
    - squash revert and new fix in a single patch, to be nice with bisect
    tests that run tdc on u32 filter, thanks to Dave Miller

    Fixes: 275c44aa194b ("net/sched: cls_u32: fix refcount leak in the error path of u32_change()")
    Fixes: 6676d5e416ee ("net: sched: set dedicated tcf_walker flag when tp is empty")
    Suggested-by: Jamal Hadi Salim
    Suggested-by: Vlad Buslov
    Signed-off-by: Davide Caratti
    Reviewed-by: Vlad Buslov
    Tested-by: Jamal Hadi Salim
    Acked-by: Jamal Hadi Salim
    Signed-off-by: David S. Miller

    Davide Caratti
     
  • In a case when a ptp chardev (like /dev/ptp0) is open but an underlying
    device is removed, closing this file leads to a race. This reproduces
    easily in a kvm virtual machine:

    ts# cat openptp0.c
    int main() { ... fp = fopen("/dev/ptp0", "r"); ... sleep(10); }
    ts# uname -r
    5.5.0-rc3-46cf053e
    ts# cat /proc/cmdline
    ... slub_debug=FZP
    ts# modprobe ptp_kvm
    ts# ./openptp0 &
    [1] 670
    opened /dev/ptp0, sleeping 10s...
    ts# rmmod ptp_kvm
    ts# ls /dev/ptp*
    ls: cannot access '/dev/ptp*': No such file or directory
    ts# ...woken up
    [ 48.010809] general protection fault: 0000 [#1] SMP
    [ 48.012502] CPU: 6 PID: 658 Comm: openptp0 Not tainted 5.5.0-rc3-46cf053e #25
    [ 48.014624] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), ...
    [ 48.016270] RIP: 0010:module_put.part.0+0x7/0x80
    [ 48.017939] RSP: 0018:ffffb3850073be00 EFLAGS: 00010202
    [ 48.018339] RAX: 000000006b6b6b6b RBX: 6b6b6b6b6b6b6b6b RCX: ffff89a476c00ad0
    [ 48.018936] RDX: fffff65a08d3ea08 RSI: 0000000000000247 RDI: 6b6b6b6b6b6b6b6b
    [ 48.019470] ... ^^^ a slub poison
    [ 48.023854] Call Trace:
    [ 48.024050] __fput+0x21f/0x240
    [ 48.024288] task_work_run+0x79/0x90
    [ 48.024555] do_exit+0x2af/0xab0
    [ 48.024799] ? vfs_write+0x16a/0x190
    [ 48.025082] do_group_exit+0x35/0x90
    [ 48.025387] __x64_sys_exit_group+0xf/0x10
    [ 48.025737] do_syscall_64+0x3d/0x130
    [ 48.026056] entry_SYSCALL_64_after_hwframe+0x44/0xa9
    [ 48.026479] RIP: 0033:0x7f53b12082f6
    [ 48.026792] ...
    [ 48.030945] Modules linked in: ptp i6300esb watchdog [last unloaded: ptp_kvm]
    [ 48.045001] Fixing recursive fault but reboot is needed!

    This happens in:

    static void __fput(struct file *file)
    { ...
    if (file->f_op->release)
    file->f_op->release(inode, file); <<< cdev is kfree'd here
    if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL &&
    !(mode & FMODE_PATH))) {
    cdev_put(inode->i_cdev); <<< cdev fields are accessed here

    Namely:

    __fput()
    posix_clock_release()
    kref_put(&clk->kref, delete_clock) <<< the last reference
    delete_clock()
    delete_ptp_clock()
    kfree(ptp) <<< cdev is embedded in ptp
    cdev_put
    module_put(p->owner) <<< *p is kfree'd, bang!

    Here cdev is embedded in posix_clock which is embedded in ptp_clock.
    The race happens because ptp_clock's lifetime is controlled by two
    refcounts: kref and cdev.kobj in posix_clock. This is wrong.

    Make ptp_clock's sysfs device a parent of cdev with cdev_device_add()
    created especially for such cases. This way the parent device with its
    ptp_clock is not released until all references to the cdev are released.
    This adds a requirement that an initialized but not exposed struct
    device should be provided to posix_clock_register() by a caller instead
    of a simple dev_t.

    This approach was adopted from the commit 72139dfa2464 ("watchdog: Fix
    the race between the release of watchdog_core_data and cdev"). See
    details of the implementation in the commit 233ed09d7fda ("chardev: add
    helper function to register char devs with a struct device").

    Link: https://lore.kernel.org/linux-fsdevel/20191125125342.6189-1-vdronov@redhat.com/T/#u
    Analyzed-by: Stephen Johnston
    Analyzed-by: Vern Lovejoy
    Signed-off-by: Vladis Dronov
    Acked-by: Richard Cochran
    Signed-off-by: David S. Miller

    Vladis Dronov
     
  • Now that all callers of FIELD_SIZEOF() have been converted to
    sizeof_field(), remove the unused prior macro.

    Signed-off-by: Kees Cook

    Kees Cook
     

29 Dec, 2019

1 commit

  • Some filesystem, such as vfat, may send bio which crosses device boundary,
    and the worse thing is that the IO request starting within device boundaries
    can contain more than one segment past EOD.

    Commit dce30ca9e3b6 ("fs: fix guard_bio_eod to check for real EOD errors")
    tries to fix this issue by returning -EIO for this situation. However,
    this way lets fs user code lose chance to handle -EIO, then sync_inodes_sb()
    may hang for ever.

    Also the current truncating on last segment is dangerous by updating the
    last bvec, given bvec table becomes not immutable any more, and fs bio
    users may not retrieve the truncated pages via bio_for_each_segment_all() in
    its .end_io callback.

    Fixes this issue by supporting multi-segment truncating. And the
    approach is simpler:

    - just update bio size since block layer can make correct bvec with
    the updated bio size. Then bvec table becomes really immutable.

    - zero all truncated segments for read bio

    Cc: Carlos Maiolino
    Cc: linux-fsdevel@vger.kernel.org
    Fixed-by: dce30ca9e3b6 ("fs: fix guard_bio_eod to check for real EOD errors")
    Reported-by: syzbot+2b9e54155c8c25d8d165@syzkaller.appspotmail.com
    Signed-off-by: Ming Lei
    Signed-off-by: Jens Axboe

    Ming Lei
     

28 Dec, 2019

1 commit

  • The API for PTP system timestamping (associating a SPI transaction with
    the system time at which it was transferred) is flawed: it assumes that
    the xfer->tx_buf pointer will always be present.

    This is, of course, not always the case.

    So introduce a "progress" variable that denotes how many word have been
    transferred.

    Fix the Freescale DSPI driver, the only user of the API so far, in the
    same patch.

    Fixes: b42faeee718c ("spi: Add a PTP system timestamp to the transfer structure")
    Fixes: d6b71dfaeeba ("spi: spi-fsl-dspi: Implement the PTP system timestamping for TCFQ mode")
    Signed-off-by: Vladimir Oltean
    Link: https://lore.kernel.org/r/20191227012417.1057-1-olteanv@gmail.com
    Signed-off-by: Mark Brown

    Vladimir Oltean
     

27 Dec, 2019

1 commit

  • If CONFIG_OF_MDIO=n:

    drivers/net/phy/mdio_bus.c:23:
    include/linux/of_mdio.h:58:13: warning: ‘of_mdiobus_child_is_phy’ defined but not used [-Wunused-function]
    static bool of_mdiobus_child_is_phy(struct device_node *child)
    ^~~~~~~~~~~~~~~~~~~~~~~

    Fix this by adding the missing "inline" keyword.

    Fixes: 0aa4d016c043d16a ("of: mdio: export of_mdiobus_child_is_phy")
    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Andrew Lunn
    Acked-by: Borislav Petkov
    Signed-off-by: David S. Miller

    Geert Uytterhoeven
     

26 Dec, 2019

2 commits

  • This reverts commit 6bb86fefa086faba7b60bb452300b76a47cde1a5
    ("libahci_platform: Staticize ahci_platform_able_phys()") we are
    going to need ahci_platform_{enable,disable}_phys() in a subsequent
    commit for ahci_brcm.c in order to properly control the PHY
    initialization order.

    Also make sure the function prototypes are declared in
    include/linux/ahci_platform.h as a result.

    Cc: stable@vger.kernel.org
    Reviewed-by: Hans de Goede
    Signed-off-by: Florian Fainelli
    Signed-off-by: Jens Axboe

    Florian Fainelli
     
  • ata_qc_complete_multiple() is called with a mask of the still active
    tags.

    mv_sata doesn't have this information directly and instead calculates
    the still active tags from the started tags (ap->qc_active) and the
    finished tags as (ap->qc_active ^ done_mask)

    Since 28361c40368 the hw_tag and tag are no longer the same and the
    equation is no longer valid. In ata_exec_internal_sg() ap->qc_active is
    initialized as 1ULL << ATA_TAG_INTERNAL, but in hardware tag 0 is
    started and this will be in done_mask on completion. ap->qc_active ^
    done_mask becomes 0x100000000 ^ 0x1 = 0x100000001 and thus tag 0 used as
    the internal tag will never be reported as completed.

    This is fixed by introducing ata_qc_get_active() which returns the
    active hardware tags and calling it where appropriate.

    This is tested on mv_sata, but sata_fsl and sata_nv suffer from the same
    problem. There is another case in sata_nv that most likely needs fixing
    as well, but this looks a little different, so I wasn't confident enough
    to change that.

    Fixes: 28361c403683 ("libata: add extra internal command")
    Cc: stable@vger.kernel.org
    Tested-by: Pali Rohár
    Signed-off-by: Sascha Hauer

    Add missing export of ata_qc_get_active(), as per Pali.

    Signed-off-by: Jens Axboe

    Sascha Hauer
     

25 Dec, 2019

3 commits

  • When do IPv6 tunnel PMTU update and calls __ip6_rt_update_pmtu() in the end,
    we should not call dst_confirm_neigh() as there is no two-way communication.

    So disable the neigh confirm for vxlan and geneve pmtu update.

    v5: No change.
    v4: No change.
    v3: Do not remove dst_confirm_neigh, but add a new bool parameter in
    dst_ops.update_pmtu to control whether we should do neighbor confirm.
    Also split the big patch to small ones for each area.
    v2: Remove dst_confirm_neigh in __ip6_rt_update_pmtu.

    Fixes: a93bf0ff4490 ("vxlan: update skb dst pmtu on tx path")
    Fixes: 52a589d51f10 ("geneve: update skb dst pmtu on tx path")
    Reviewed-by: Guillaume Nault
    Tested-by: Guillaume Nault
    Acked-by: David Ahern
    Signed-off-by: Hangbin Liu
    Signed-off-by: David S. Miller

    Hangbin Liu
     
  • Add a new function skb_dst_update_pmtu_no_confirm() for callers who need
    update pmtu but should not do neighbor confirm.

    v5: No change.
    v4: No change.
    v3: Do not remove dst_confirm_neigh, but add a new bool parameter in
    dst_ops.update_pmtu to control whether we should do neighbor confirm.
    Also split the big patch to small ones for each area.
    v2: Remove dst_confirm_neigh in __ip6_rt_update_pmtu.

    Reviewed-by: Guillaume Nault
    Acked-by: David Ahern
    Signed-off-by: Hangbin Liu
    Signed-off-by: David S. Miller

    Hangbin Liu
     
  • The MTU update code is supposed to be invoked in response to real
    networking events that update the PMTU. In IPv6 PMTU update function
    __ip6_rt_update_pmtu() we called dst_confirm_neigh() to update neighbor
    confirmed time.

    But for tunnel code, it will call pmtu before xmit, like:
    - tnl_update_pmtu()
    - skb_dst_update_pmtu()
    - ip6_rt_update_pmtu()
    - __ip6_rt_update_pmtu()
    - dst_confirm_neigh()

    If the tunnel remote dst mac address changed and we still do the neigh
    confirm, we will not be able to update neigh cache and ping6 remote
    will failed.

    So for this ip_tunnel_xmit() case, _EVEN_ if the MTU is changed, we
    should not be invoking dst_confirm_neigh() as we have no evidence
    of successful two-way communication at this point.

    On the other hand it is also important to keep the neigh reachability fresh
    for TCP flows, so we cannot remove this dst_confirm_neigh() call.

    To fix the issue, we have to add a new bool parameter for dst_ops.update_pmtu
    to choose whether we should do neigh update or not. I will add the parameter
    in this patch and set all the callers to true to comply with the previous
    way, and fix the tunnel code one by one on later patches.

    v5: No change.
    v4: No change.
    v3: Do not remove dst_confirm_neigh, but add a new bool parameter in
    dst_ops.update_pmtu to control whether we should do neighbor confirm.
    Also split the big patch to small ones for each area.
    v2: Remove dst_confirm_neigh in __ip6_rt_update_pmtu.

    Suggested-by: David Miller
    Reviewed-by: Guillaume Nault
    Acked-by: David Ahern
    Signed-off-by: Hangbin Liu
    Signed-off-by: David S. Miller

    Hangbin Liu
     

23 Dec, 2019

1 commit

  • Pull ext4 bug fixes from Ted Ts'o:
    "Ext4 bug fixes, including a regression fix"

    * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
    ext4: clarify impact of 'commit' mount option
    ext4: fix unused-but-set-variable warning in ext4_add_entry()
    jbd2: fix kernel-doc notation warning
    ext4: use RCU API in debug_print_tree
    ext4: validate the debug_want_extra_isize mount option at parse time
    ext4: reserve revoke credits in __ext4_new_inode
    ext4: unlock on error in ext4_expand_extra_isize()
    ext4: optimize __ext4_check_dir_entry()
    ext4: check for directory entries too close to block end
    ext4: fix ext4_empty_dir() for directories with holes

    Linus Torvalds