1. 25 1月, 2018 6 次提交
    • A
      net: separate SIOCGIFCONF handling from dev_ioctl() · 36fd633e
      Al Viro 提交于
      Only two of dev_ioctl() callers may pass SIOCGIFCONF to it.
      Separating that codepath from the rest of dev_ioctl() allows both
      to simplify dev_ioctl() itself (all other cases work with struct ifreq *)
      *and* seriously simplify the compat side of that beast: all it takes
      is passing to inet_gifconf() an extra argument - the size of individual
      records (sizeof(struct ifreq) or sizeof(struct compat_ifreq)).  With
      dev_ifconf() called directly from sock_do_ioctl()/compat_dev_ifconf()
      that's easy to arrange.
      
      As the result, compat side of SIOCGIFCONF doesn't need any
      allocations, copy_in_user() back and forth, etc.
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      36fd633e
    • W
      net: erspan: fix use-after-free · b423d13c
      William Tu 提交于
      When building the erspan header for either v1 or v2, the eth_hdr()
      does not point to the right inner packet's eth_hdr,
      causing kasan report use-after-free and slab-out-of-bouds read.
      
      The patch fixes the following syzkaller issues:
      [1] BUG: KASAN: slab-out-of-bounds in erspan_xmit+0x22d4/0x2430 net/ipv4/ip_gre.c:735
      [2] BUG: KASAN: slab-out-of-bounds in erspan_build_header+0x3bf/0x3d0 net/ipv4/ip_gre.c:698
      [3] BUG: KASAN: use-after-free in erspan_xmit+0x22d4/0x2430 net/ipv4/ip_gre.c:735
      [4] BUG: KASAN: use-after-free in erspan_build_header+0x3bf/0x3d0 net/ipv4/ip_gre.c:698
      
      [2] CPU: 0 PID: 3654 Comm: syzkaller377964 Not tainted 4.15.0-rc9+ #185
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       __dump_stack lib/dump_stack.c:17 [inline]
       dump_stack+0x194/0x257 lib/dump_stack.c:53
       print_address_description+0x73/0x250 mm/kasan/report.c:252
       kasan_report_error mm/kasan/report.c:351 [inline]
       kasan_report+0x25b/0x340 mm/kasan/report.c:409
       __asan_report_load_n_noabort+0xf/0x20 mm/kasan/report.c:440
       erspan_build_header+0x3bf/0x3d0 net/ipv4/ip_gre.c:698
       erspan_xmit+0x3b8/0x13b0 net/ipv4/ip_gre.c:740
       __netdev_start_xmit include/linux/netdevice.h:4042 [inline]
       netdev_start_xmit include/linux/netdevice.h:4051 [inline]
       packet_direct_xmit+0x315/0x6b0 net/packet/af_packet.c:266
       packet_snd net/packet/af_packet.c:2943 [inline]
       packet_sendmsg+0x3aed/0x60b0 net/packet/af_packet.c:2968
       sock_sendmsg_nosec net/socket.c:638 [inline]
       sock_sendmsg+0xca/0x110 net/socket.c:648
       SYSC_sendto+0x361/0x5c0 net/socket.c:1729
       SyS_sendto+0x40/0x50 net/socket.c:1697
       do_syscall_32_irqs_on arch/x86/entry/common.c:327 [inline]
       do_fast_syscall_32+0x3ee/0xf9d arch/x86/entry/common.c:389
       entry_SYSENTER_compat+0x54/0x63 arch/x86/entry/entry_64_compat.S:129
      RIP: 0023:0xf7fcfc79
      RSP: 002b:00000000ffc6976c EFLAGS: 00000286 ORIG_RAX: 0000000000000171
      RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 0000000020011000
      RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020008000
      RBP: 000000000000001c R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
      R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
      
      Fixes: f551c91d ("net: erspan: introduce erspan v2 for ip_gre")
      Fixes: 84e54fe0 ("gre: introduce native tunnel support for ERSPAN")
      Reported-by: syzbot+9723f2d288e49b492cf0@syzkaller.appspotmail.com
      Reported-by: syzbot+f0ddeb2b032a8e1d9098@syzkaller.appspotmail.com
      Reported-by: syzbot+f14b3703cd8d7670203f@syzkaller.appspotmail.com
      Reported-by: syzbot+eefa384efad8d7997f20@syzkaller.appspotmail.com
      Signed-off-by: NWilliam Tu <u9012063@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b423d13c
    • J
      net: sched: remove tc_cls_common_offload_init_deprecated() · c846adb6
      Jakub Kicinski 提交于
      All users are now converted to tc_cls_common_offload_init().
      Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: NSimon Horman <simon.horman@netronome.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c846adb6
    • J
      cls_bpf: remove gen_flags from bpf_offload · f558fdea
      Jakub Kicinski 提交于
      cls_bpf now guarantees that only device-bound programs are
      allowed with skip_sw.  The drivers no longer pay attention to
      flags on filter load, therefore the bpf_offload member can be
      removed.  If flags are needed again they should probably be
      added to struct tc_cls_common_offload instead.
      Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: NSimon Horman <simon.horman@netronome.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f558fdea
    • J
      net: sched: prepare for reimplementation of tc_cls_common_offload_init() · 34832e1c
      Jakub Kicinski 提交于
      Rename the tc_cls_common_offload_init() helper function to
      tc_cls_common_offload_init_deprecated() and add a new implementation
      which also takes flags argument.  We will only set extack if flags
      indicate that offload is forced (skip_sw) otherwise driver errors
      should be ignored, as they don't influence the overall filter
      installation.
      
      Note that we need the tc_skip_hw() helper for new version, therefore
      it is added later in the file.
      Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: NSimon Horman <simon.horman@netronome.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      34832e1c
    • J
      net: sched: propagate extack to cls->destroy callbacks · 715df5ec
      Jakub Kicinski 提交于
      Propagate extack to cls->destroy callbacks when called from
      non-error paths.  On error paths pass NULL to avoid overwriting
      the failure message.
      Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: NSimon Horman <simon.horman@netronome.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      715df5ec
  2. 24 1月, 2018 2 次提交
  3. 23 1月, 2018 4 次提交
  4. 22 1月, 2018 5 次提交
    • M
      device property: Allow iterating over available child fwnodes · 3395de96
      Marcin Wojtas 提交于
      Implement a new helper function fwnode_get_next_available_child_node(),
      which enables obtaining next enabled child fwnode, which
      works on a similar basis to OF's of_get_next_available_child().
      
      This commit also introduces a macro, thanks to which it is
      possible to iterate over the available fwnodes, using the
      new function described above.
      Signed-off-by: NMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3395de96
    • M
      device property: Introduce fwnode_irq_get() · 7c6c57f2
      Marcin Wojtas 提交于
      Until now there were two very similar functions allowing
      to get Linux IRQ number from ACPI handle (acpi_irq_get())
      and OF node (of_irq_get()). The first one appeared to be used
      only as a subroutine of platform_irq_get(), which (in the generic
      code) limited IRQ obtaining from _CRS method only to nodes
      associated to kernel's struct platform_device.
      
      This patch introduces a new helper routine - fwnode_irq_get(),
      which allows to get the IRQ number directly from the fwnode
      to be used as common for OF/ACPI worlds. It is usable not
      only for the parents fwnodes, but also for the child nodes
      comprising their own _CRS methods with interrupts description.
      
      In order to be able o satisfy compilation with !CONFIG_ACPI
      and also simplify the new code, introduce a helper macro
      (ACPI_HANDLE_FWNODE), with which it is possible to reach
      an ACPI handle directly from its fwnode.
      Signed-off-by: NMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7c6c57f2
    • M
      device property: Introduce fwnode_get_phy_mode() · b28f263b
      Marcin Wojtas 提交于
      Until now there were two almost identical functions for
      obtaining network PHY mode - of_get_phy_mode() and,
      more generic, device_get_phy_mode(). However it is not uncommon,
      that the network interface is represented as a child
      of the actual controller, hence it is not associated
      directly to any struct device, required by the latter
      routine.
      
      This commit allows for getting the PHY mode for
      children nodes in the ACPI world by introducing a new function -
      fwnode_get_phy_mode(). This commit also changes
      device_get_phy_mode() routine to be its wrapper, in order
      to prevent unnecessary duplication.
      Signed-off-by: NMarcin Wojtas <mw@semihalf.com>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b28f263b
    • M
      device property: Introduce fwnode_get_mac_address() · babe2dbb
      Marcin Wojtas 提交于
      Until now there were two almost identical functions for
      obtaining MAC address - of_get_mac_address() and, more generic,
      device_get_mac_address(). However it is not uncommon,
      that the network interface is represented as a child
      of the actual controller, hence it is not associated
      directly to any struct device, required by the latter
      routine.
      
      This commit allows for getting the MAC address for
      children nodes in the ACPI world by introducing a new function -
      fwnode_get_mac_address(). This commit also changes
      device_get_mac_address() routine to be its wrapper, in order
      to prevent unnecessary duplication.
      Signed-off-by: NMarcin Wojtas <mw@semihalf.com>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      babe2dbb
    • K
      mm, page_vma_mapped: Drop faulty pointer arithmetics in check_pte() · 0d665e7b
      Kirill A. Shutemov 提交于
      Tetsuo reported random crashes under memory pressure on 32-bit x86
      system and tracked down to change that introduced
      page_vma_mapped_walk().
      
      The root cause of the issue is the faulty pointer math in check_pte().
      As ->pte may point to an arbitrary page we have to check that they are
      belong to the section before doing math. Otherwise it may lead to weird
      results.
      
      It wasn't noticed until now as mem_map[] is virtually contiguous on
      flatmem or vmemmap sparsemem. Pointer arithmetic just works against all
      'struct page' pointers. But with classic sparsemem, it doesn't because
      each section memap is allocated separately and so consecutive pfns
      crossing two sections might have struct pages at completely unrelated
      addresses.
      
      Let's restructure code a bit and replace pointer arithmetic with
      operations on pfns.
      Signed-off-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Reported-and-tested-by: NTetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
      Acked-by: NMichal Hocko <mhocko@suse.com>
      Fixes: ace71a19 ("mm: introduce page_vma_mapped_walk()")
      Cc: stable@vger.kernel.org
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0d665e7b
  5. 21 1月, 2018 1 次提交
  6. 20 1月, 2018 12 次提交
  7. 19 1月, 2018 4 次提交
  8. 18 1月, 2018 6 次提交