1. 10 Nov, 2020 16 commits
    • Lee Jones's avatar
      Fonts: Replace discarded const qualifier · f7267a75
      Lee Jones authored
      commit 9522750c upstream.
      
      Commit 6735b463
      
       ("Fonts: Support FONT_EXTRA_WORDS macros for built-in
      fonts") introduced the following error when building rpc_defconfig (only
      this build appears to be affected):
      
       `acorndata_8x8' referenced in section `.text' of arch/arm/boot/compressed/ll_char_wr.o:
          defined in discarded section `.data' of arch/arm/boot/compressed/font.o
       `acorndata_8x8' referenced in section `.data.rel.ro' of arch/arm/boot/compressed/font.o:
          defined in discarded section `.data' of arch/arm/boot/compressed/font.o
       make[3]: *** [/scratch/linux/arch/arm/boot/compressed/Makefile:191: arch/arm/boot/compressed/vmlinux] Error 1
       make[2]: *** [/scratch/linux/arch/arm/boot/Makefile:61: arch/arm/boot/compressed/vmlinux] Error 2
       make[1]: *** [/scratch/linux/arch/arm/Makefile:317: zImage] Error 2
      
      The .data section is discarded at link time.  Reinstating acorndata_8x8 as
      const ensures it is still available after linking.  Do the same for the
      other 12 built-in fonts as well, for consistency purposes.
      
      Cc: <stable@vger.kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Fixes: 6735b463
      
       ("Fonts: Support FONT_EXTRA_WORDS macros for built-in fonts")
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Co-developed-by: default avatarPeilin Ye <yepeilin.cs@gmail.com>
      Signed-off-by: default avatarPeilin Ye <yepeilin.cs@gmail.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201102183242.2031659-1-yepeilin.cs@gmail.com
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f7267a75
    • Martyna Szapar's avatar
      i40e: Memory leak in i40e_config_iwarp_qvlist · 9674ade9
      Martyna Szapar authored
      commit 0b636446
      
       upstream.
      
      Added freeing the old allocation of vf->qvlist_info in function
      i40e_config_iwarp_qvlist before overwriting it with
      the new allocation.
      Signed-off-by: default avatarMartyna Szapar <martyna.szapar@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarBen Hutchings <ben.hutchings@codethink.co.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9674ade9
    • Martyna Szapar's avatar
      i40e: Fix of memory leak and integer truncation in i40e_virtchnl.c · 571c603a
      Martyna Szapar authored
      commit 24474f27
      
       upstream.
      
      Fixed possible memory leak in i40e_vc_add_cloud_filter function:
      cfilter is being allocated and in some error conditions
      the function returns without freeing the memory.
      
      Fix of integer truncation from u16 (type of queue_id value) to u8
      when calling i40e_vc_isvalid_queue_id function.
      Signed-off-by: default avatarMartyna Szapar <martyna.szapar@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      [bwh: Backported to 4.14: i40e_vc_add_cloud_filter() does not exist
       but the integer truncation is still possible]
      Signed-off-by: default avatarBen Hutchings <ben.hutchings@codethink.co.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      571c603a
    • Grzegorz Siwik's avatar
      i40e: Wrong truncation from u16 to u8 · 9900bf4d
      Grzegorz Siwik authored
      commit c004804d
      
       upstream.
      
      In this patch fixed wrong truncation method from u16 to u8 during
      validation.
      
      It was changed by changing u8 to u32 parameter in method declaration
      and arguments were changed to u32.
      Signed-off-by: default avatarGrzegorz Siwik <grzegorz.siwik@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarBen Hutchings <ben.hutchings@codethink.co.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9900bf4d
    • Sergey Nemov's avatar
      i40e: add num_vectors checker in iwarp handler · 978c31f0
      Sergey Nemov authored
      commit 7015ca3d
      
       upstream.
      
      Field num_vectors from struct virtchnl_iwarp_qvlist_info should not be
      larger than num_msix_vectors_vf in the hw struct.  The iwarp uses the
      same set of vectors as the LAN VF driver.
      Signed-off-by: default avatarSergey Nemov <sergey.nemov@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarBen Hutchings <ben.hutchings@codethink.co.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      978c31f0
    • Christophe JAILLET's avatar
      i40e: Fix a potential NULL pointer dereference · 09f34ad8
      Christophe JAILLET authored
      commit 54902349
      
       upstream.
      
      If 'kzalloc()' fails, a NULL pointer will be dereferenced.
      Return an error code (-ENOMEM) instead.
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarBen Hutchings <ben.hutchings@codethink.co.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      09f34ad8
    • Luis Chamberlain's avatar
      blktrace: fix debugfs use after free · 8268f887
      Luis Chamberlain authored
      commit bad8e64f upstream.
      
      On commit 6ac93117 ("blktrace: use existing disk debugfs directory")
      merged on v4.12 Omar fixed the original blktrace code for request-based
      drivers (multiqueue). This however left in place a possible crash, if you
      happen to abuse blktrace while racing to remove / add a device.
      
      We used to use asynchronous removal of the request_queue, and with that
      the issue was easier to reproduce. Now that we have reverted to
      synchronous removal of the request_queue, the issue is still possible to
      reproduce, its however just a bit more difficult.
      
      We essentially run two instances of break-blktrace which add/remove
      a loop device, and setup a blktrace and just never tear the blktrace
      down. We do this twice in parallel. This is easily reproduced with the
      script run_0004.sh from break-blktrace [0].
      
      We can end up with two types of panics each reflecting where we
      race, one a failed blktrace setup:
      
      [  252.426751] debugfs: Directory 'loop0' with parent 'block' already present!
      [  252.432265] BUG: kernel NULL pointer dereference, address: 00000000000000a0
      [  252.436592] #PF: supervisor write access in kernel mode
      [  252.439822] #PF: error_code(0x0002) - not-present page
      [  252.442967] PGD 0 P4D 0
      [  252.444656] Oops: 0002 [#1] SMP NOPTI
      [  252.446972] CPU: 10 PID: 1153 Comm: break-blktrace Tainted: G            E     5.7.0-rc2-next-20200420+ #164
      [  252.452673] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1 04/01/2014
      [  252.456343] RIP: 0010:down_write+0x15/0x40
      [  252.458146] Code: eb ca e8 ae 22 8d ff cc cc cc cc cc cc cc cc cc cc cc cc
                     cc cc 0f 1f 44 00 00 55 48 89 fd e8 52 db ff ff 31 c0 ba 01 00
                     00 00 <f0> 48 0f b1 55 00 75 0f 48 8b 04 25 c0 8b 01 00 48 89
                     45 08 5d
      [  252.463638] RSP: 0018:ffffa626415abcc8 EFLAGS: 00010246
      [  252.464950] RAX: 0000000000000000 RBX: ffff958c25f0f5c0 RCX: ffffff8100000000
      [  252.466727] RDX: 0000000000000001 RSI: ffffff8100000000 RDI: 00000000000000a0
      [  252.468482] RBP: 00000000000000a0 R08: 0000000000000000 R09: 0000000000000001
      [  252.470014] R10: 0000000000000000 R11: ffff958d1f9227ff R12: 0000000000000000
      [  252.471473] R13: ffff958c25ea5380 R14: ffffffff8cce15f1 R15: 00000000000000a0
      [  252.473346] FS:  00007f2e69dee540(0000) GS:ffff958c2fc80000(0000) knlGS:0000000000000000
      [  252.475225] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  252.476267] CR2: 00000000000000a0 CR3: 0000000427d10004 CR4: 0000000000360ee0
      [  252.477526] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  252.478776] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [  252.479866] Call Trace:
      [  252.480322]  simple_recursive_removal+0x4e/0x2e0
      [  252.481078]  ? debugfs_remove+0x60/0x60
      [  252.481725]  ? relay_destroy_buf+0x77/0xb0
      [  252.482662]  debugfs_remove+0x40/0x60
      [  252.483518]  blk_remove_buf_file_callback+0x5/0x10
      [  252.484328]  relay_close_buf+0x2e/0x60
      [  252.484930]  relay_open+0x1ce/0x2c0
      [  252.485520]  do_blk_trace_setup+0x14f/0x2b0
      [  252.486187]  __blk_trace_setup+0x54/0xb0
      [  252.486803]  blk_trace_ioctl+0x90/0x140
      [  252.487423]  ? do_sys_openat2+0x1ab/0x2d0
      [  252.488053]  blkdev_ioctl+0x4d/0x260
      [  252.488636]  block_ioctl+0x39/0x40
      [  252.489139]  ksys_ioctl+0x87/0xc0
      [  252.489675]  __x64_sys_ioctl+0x16/0x20
      [  252.490380]  do_syscall_64+0x52/0x180
      [  252.491032]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      And the other on the device removal:
      
      [  128.528940] debugfs: Directory 'loop0' with parent 'block' already present!
      [  128.615325] BUG: kernel NULL pointer dereference, address: 00000000000000a0
      [  128.619537] #PF: supervisor write access in kernel mode
      [  128.622700] #PF: error_code(0x0002) - not-present page
      [  128.625842] PGD 0 P4D 0
      [  128.627585] Oops: 0002 [#1] SMP NOPTI
      [  128.629871] CPU: 12 PID: 544 Comm: break-blktrace Tainted: G            E     5.7.0-rc2-next-20200420+ #164
      [  128.635595] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1 04/01/2014
      [  128.640471] RIP: 0010:down_write+0x15/0x40
      [  128.643041] Code: eb ca e8 ae 22 8d ff cc cc cc cc cc cc cc cc cc cc cc cc
                     cc cc 0f 1f 44 00 00 55 48 89 fd e8 52 db ff ff 31 c0 ba 01 00
                     00 00 <f0> 48 0f b1 55 00 75 0f 65 48 8b 04 25 c0 8b 01 00 48 89
                     45 08 5d
      [  128.650180] RSP: 0018:ffffa9c3c05ebd78 EFLAGS: 00010246
      [  128.651820] RAX: 0000000000000000 RBX: ffff8ae9a6370240 RCX: ffffff8100000000
      [  128.653942] RDX: 0000000000000001 RSI: ffffff8100000000 RDI: 00000000000000a0
      [  128.655720] RBP: 00000000000000a0 R08: 0000000000000002 R09: ffff8ae9afd2d3d0
      [  128.657400] R10: 0000000000000056 R11: 0000000000000000 R12: 0000000000000000
      [  128.659099] R13: 0000000000000000 R14: 0000000000000003 R15: 00000000000000a0
      [  128.660500] FS:  00007febfd995540(0000) GS:ffff8ae9afd00000(0000) knlGS:0000000000000000
      [  128.662204] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  128.663426] CR2: 00000000000000a0 CR3: 0000000420042003 CR4: 0000000000360ee0
      [  128.664776] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  128.666022] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [  128.667282] Call Trace:
      [  128.667801]  simple_recursive_removal+0x4e/0x2e0
      [  128.668663]  ? debugfs_remove+0x60/0x60
      [  128.669368]  debugfs_remove+0x40/0x60
      [  128.669985]  blk_trace_free+0xd/0x50
      [  128.670593]  __blk_trace_remove+0x27/0x40
      [  128.671274]  blk_trace_shutdown+0x30/0x40
      [  128.671935]  blk_release_queue+0x95/0xf0
      [  128.672589]  kobject_put+0xa5/0x1b0
      [  128.673188]  disk_release+0xa2/0xc0
      [  128.673786]  device_release+0x28/0x80
      [  128.674376]  kobject_put+0xa5/0x1b0
      [  128.674915]  loop_remove+0x39/0x50 [loop]
      [  128.675511]  loop_control_ioctl+0x113/0x130 [loop]
      [  128.676199]  ksys_ioctl+0x87/0xc0
      [  128.676708]  __x64_sys_ioctl+0x16/0x20
      [  128.677274]  do_syscall_64+0x52/0x180
      [  128.677823]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      The common theme here is:
      
      debugfs: Directory 'loop0' with parent 'block' already present
      
      This crash happens because of how blktrace uses the debugfs directory
      where it places its files. Upon init we always create the same directory
      which would be needed by blktrace but we only do this for make_request
      drivers (multiqueue) block drivers. When you race a removal of these
      devices with a blktrace setup you end up in a situation where the
      make_request recursive debugfs removal will sweep away the blktrace
      files and then later blktrace will also try to remove individual
      dentries which are already NULL. The inverse is also possible and hence
      the two types of use after frees.
      
      We don't create the block debugfs directory on init for these types of
      block devices:
      
        * request-based block driver block devices
        * every possible partition
        * scsi-generic
      
      And so, this race should in theory only be possible with make_request
      drivers.
      
      We can fix the UAF by simply re-using the debugfs directory for
      make_request drivers (multiqueue) and only creating the ephemeral
      directory for the other type of block devices. The new clarifications
      on relying on the q->blk_trace_mutex *and* also checking for q->blk_trace
      *prior* to processing a blktrace ensures the debugfs directories are
      only created if no possible directory name clashes are possible.
      
      This goes tested with:
      
        o nvme partitions
        o ISCSI with tgt, and blktracing against scsi-generic with:
          o block
          o tape
          o cdrom
          o media changer
        o blktests
      
      This patch is part of the work which disputes the severity of
      CVE-2019-19770 which shows this issue is not a core debugfs issue, but
      a misuse of debugfs within blktace.
      
      Fixes: 6ac93117
      
       ("blktrace: use existing disk debugfs directory")
      Reported-by: syzbot+603294af2d01acfdd6da@syzkaller.appspotmail.com
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Cc: Bart Van Assche <bvanassche@acm.org>
      Cc: Omar Sandoval <osandov@fb.com>
      Cc: Hannes Reinecke <hare@suse.com>
      Cc: Nicolai Stange <nstange@suse.de>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
      Cc: yu kuai <yukuai3@huawei.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      [bwh: Backported to 4.14: open-code queue_is_mq()]
      Signed-off-by: default avatarBen Hutchings <ben.hutchings@codethink.co.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8268f887
    • Liu Bo's avatar
      Blktrace: bail out early if block debugfs is not configured · 595290cc
      Liu Bo authored
      commit e1a41324
      
       upstream.
      
      Since @blk_debugfs_root couldn't be configured dynamically, we can
      save a few memory allocation if it's not there.
      Signed-off-by: default avatarLiu Bo <bo.liu@linux.alibaba.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      [bwh: Cherry-picked for 4.14 to ease backporting a later fix]
      Signed-off-by: default avatarBen Hutchings <ben.hutchings@codethink.co.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      595290cc
    • YueHaibing's avatar
      sfp: Fix error handing in sfp_probe() · 45922359
      YueHaibing authored
      [ Upstream commit 96216181 ]
      
      gpiod_to_irq() never return 0, but returns negative in
      case of error, check it and set gpio_irq to 0.
      
      Fixes: 73970055
      
       ("sfp: add SFP module support")
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20201031031053.25264-1-yuehaibing@huawei.com
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      45922359
    • Petr Malat's avatar
      sctp: Fix COMM_LOST/CANT_STR_ASSOC err reporting on big-endian platforms · b1c072c2
      Petr Malat authored
      [ Upstream commit b6df8c81 ]
      
      Commit 978aa047 ("sctp: fix some type cast warnings introduced since
      very beginning")' broke err reading from sctp_arg, because it reads the
      value as 32-bit integer, although the value is stored as 16-bit integer.
      Later this value is passed to the userspace in 16-bit variable, thus the
      user always gets 0 on big-endian platforms. Fix it by reading the __u16
      field of sctp_arg union, as reading err field would produce a sparse
      warning.
      
      Fixes: 978aa047
      
       ("sctp: fix some type cast warnings introduced since very beginning")
      Signed-off-by: default avatarPetr Malat <oss@malat.biz>
      Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Link: https://lore.kernel.org/r/20201030132633.7045-1-oss@malat.biz
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b1c072c2
    • Daniele Palmas's avatar
      net: usb: qmi_wwan: add Telit LE910Cx 0x1230 composition · 1971ba63
      Daniele Palmas authored
      [ Upstream commit 5fd8477e
      
       ]
      
      Add support for Telit LE910Cx 0x1230 composition:
      
      0x1230: tty, adb, rmnet, audio, tty, tty, tty, tty
      Signed-off-by: default avatarDaniele Palmas <dnlplm@gmail.com>
      Acked-by: default avatarBjørn Mork <bjorn@mork.no>
      Link: https://lore.kernel.org/r/20201102110108.17244-1-dnlplm@gmail.com
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1971ba63
    • Claudiu Manoil's avatar
      gianfar: Account for Tx PTP timestamp in the skb headroom · b6f82a26
      Claudiu Manoil authored
      [ Upstream commit d6a076d6
      
       ]
      
      When PTP timestamping is enabled on Tx, the controller
      inserts the Tx timestamp at the beginning of the frame
      buffer, between SFD and the L2 frame header. This means
      that the skb provided by the stack is required to have
      enough headroom otherwise a new skb needs to be created
      by the driver to accommodate the timestamp inserted by h/w.
      Up until now the driver was relying on the second option,
      using skb_realloc_headroom() to create a new skb to accommodate
      PTP frames. Turns out that this method is not reliable, as
      reallocation of skbs for PTP frames along with the required
      overhead (skb_set_owner_w, consume_skb) is causing random
      crashes in subsequent skb_*() calls, when multiple concurrent
      TCP streams are run at the same time on the same device
      (as seen in James' report).
      Note that these crashes don't occur with a single TCP stream,
      nor with multiple concurrent UDP streams, but only when multiple
      TCP streams are run concurrently with the PTP packet flow
      (doing skb reallocation).
      This patch enforces the first method, by requesting enough
      headroom from the stack to accommodate PTP frames, and so avoiding
      skb_realloc_headroom() & co, and the crashes no longer occur.
      There's no reason not to set needed_headroom to a large enough
      value to accommodate PTP frames, so in this regard this patch
      is a fix.
      Reported-by: default avatarJames Jurack <james.jurack@ametek.com>
      Fixes: bee9e58c
      
       ("gianfar:don't add FCB length to hard_header_len")
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@nxp.com>
      Link: https://lore.kernel.org/r/20201020173605.1173-1-claudiu.manoil@nxp.com
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b6f82a26
    • Claudiu Manoil's avatar
      gianfar: Replace skb_realloc_headroom with skb_cow_head for PTP · a1e4849a
      Claudiu Manoil authored
      [ Upstream commit d145c903 ]
      
      When PTP timestamping is enabled on Tx, the controller
      inserts the Tx timestamp at the beginning of the frame
      buffer, between SFD and the L2 frame header.  This means
      that the skb provided by the stack is required to have
      enough headroom otherwise a new skb needs to be created
      by the driver to accommodate the timestamp inserted by h/w.
      Up until now the driver was relying on skb_realloc_headroom()
      to create new skbs to accommodate PTP frames.  Turns out that
      this method is not reliable in this context at least, as
      skb_realloc_headroom() for PTP frames can cause random crashes,
      mostly in subsequent skb_*() calls, when multiple concurrent
      TCP streams are run at the same time with the PTP flow
      on the same device (as seen in James' report).  I also noticed
      that when the system is loaded by sending multiple TCP streams,
      the driver receives cloned skbs in large numbers.
      skb_cow_head() instead proves to be stable in this scenario,
      and not only handles cloned skbs too but it's also more efficient
      and widely used in other drivers.
      The commit introducing skb_realloc_headroom in the driver
      goes back to 2009, commit 93c1285c
      ("gianfar: reallocate skb when headroom is not enough for fcb").
      For practical purposes I'm referencing a newer commit (from 2012)
      that brings the code to its current structure (and fixes the PTP
      case).
      
      Fixes: 9c4886e5
      
       ("gianfar: Fix invalid TX frames returned on error queue when time stamping")
      Reported-by: default avatarJames Jurack <james.jurack@ametek.com>
      Suggested-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@nxp.com>
      Link: https://lore.kernel.org/r/20201029081057.8506-1-claudiu.manoil@nxp.com
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a1e4849a
    • Hoang Huu Le's avatar
      tipc: fix use-after-free in tipc_bcast_get_mode · 3ac95d95
      Hoang Huu Le authored
      commit fdeba99b
      
       upstream.
      
      Syzbot has reported those issues as:
      
      ==================================================================
      BUG: KASAN: use-after-free in tipc_bcast_get_mode+0x3ab/0x400 net/tipc/bcast.c:759
      Read of size 1 at addr ffff88805e6b3571 by task kworker/0:6/3850
      
      CPU: 0 PID: 3850 Comm: kworker/0:6 Not tainted 5.8.0-rc7-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Workqueue: events tipc_net_finalize_work
      
      Thread 1's call trace:
      [...]
        kfree+0x103/0x2c0 mm/slab.c:3757 <- bcbase releasing
        tipc_bcast_stop+0x1b0/0x2f0 net/tipc/bcast.c:721
        tipc_exit_net+0x24/0x270 net/tipc/core.c:112
      [...]
      
      Thread 2's call trace:
      [...]
        tipc_bcast_get_mode+0x3ab/0x400 net/tipc/bcast.c:759 <- bcbase
      has already been freed by Thread 1
      
        tipc_node_broadcast+0x9e/0xcc0 net/tipc/node.c:1744
        tipc_nametbl_publish+0x60b/0x970 net/tipc/name_table.c:752
        tipc_net_finalize net/tipc/net.c:141 [inline]
        tipc_net_finalize+0x1fa/0x310 net/tipc/net.c:131
        tipc_net_finalize_work+0x55/0x80 net/tipc/net.c:150
      [...]
      
      ==================================================================
      BUG: KASAN: use-after-free in tipc_named_reinit+0xef/0x290 net/tipc/name_distr.c:344
      Read of size 8 at addr ffff888052ab2000 by task kworker/0:13/30628
      CPU: 0 PID: 30628 Comm: kworker/0:13 Not tainted 5.8.0-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Workqueue: events tipc_net_finalize_work
      Call Trace:
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0x1f0/0x31e lib/dump_stack.c:118
       print_address_description+0x66/0x5a0 mm/kasan/report.c:383
       __kasan_report mm/kasan/report.c:513 [inline]
       kasan_report+0x132/0x1d0 mm/kasan/report.c:530
       tipc_named_reinit+0xef/0x290 net/tipc/name_distr.c:344
       tipc_net_finalize+0x85/0xe0 net/tipc/net.c:138
       tipc_net_finalize_work+0x50/0x70 net/tipc/net.c:150
       process_one_work+0x789/0xfc0 kernel/workqueue.c:2269
       worker_thread+0xaa4/0x1460 kernel/workqueue.c:2415
       kthread+0x37e/0x3a0 drivers/block/aoe/aoecmd.c:1234
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:293
      [...]
      Freed by task 14058:
       save_stack mm/kasan/common.c:48 [inline]
       set_track mm/kasan/common.c:56 [inline]
       kasan_set_free_info mm/kasan/common.c:316 [inline]
       __kasan_slab_free+0x114/0x170 mm/kasan/common.c:455
       __cache_free mm/slab.c:3426 [inline]
       kfree+0x10a/0x220 mm/slab.c:3757
       tipc_exit_net+0x29/0x50 net/tipc/core.c:113
       ops_exit_list net/core/net_namespace.c:186 [inline]
       cleanup_net+0x708/0xba0 net/core/net_namespace.c:603
       process_one_work+0x789/0xfc0 kernel/workqueue.c:2269
       worker_thread+0xaa4/0x1460 kernel/workqueue.c:2415
       kthread+0x37e/0x3a0 drivers/block/aoe/aoecmd.c:1234
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:293
      
      Fix it by calling flush_scheduled_work() to make sure the
      tipc_net_finalize_work() stopped before releasing bcbase object.
      
      Reported-by: syzbot+6ea1f7a8df64596ef4d7@syzkaller.appspotmail.com
      Reported-by: syzbot+e9cc557752ab126c1b99@syzkaller.appspotmail.com
      Acked-by: default avatarJon Maloy <jmaloy@redhat.com>
      Signed-off-by: default avatarHoang Huu Le <hoang.h.le@dektech.com.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3ac95d95
    • Juergen Gross's avatar
      xen/events: don't use chip_data for legacy IRQs · 776bce2d
      Juergen Gross authored
      commit 0891fb39 upstream.
      
      Since commit c330fb1d ("XEN uses irqdesc::irq_data_common::handler_data to store a per interrupt XEN data pointer which contains XEN specific information.")
      Xen is using the chip_data pointer for storing IRQ specific data. When
      running as a HVM domain this can result in problems for legacy IRQs, as
      those might use chip_data for their own purposes.
      
      Use a local array for this purpose in case of legacy IRQs, avoiding the
      double use.
      
      Cc: stable@vger.kernel.org
      Fixes: c330fb1d
      
       ("XEN uses irqdesc::irq_data_common::handler_data to store a per interrupt XEN data pointer which contains XEN specific information.")
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Tested-by: default avatarStefan Bader <stefan.bader@canonical.com>
      Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Link: https://lore.kernel.org/r/20200930091614.13660-1-jgross@suse.com
      
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      [bwh: Backported to 4.9: adjust context]
      Signed-off-by: default avatarBen Hutchings <benh@debian.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      776bce2d
    • Chris Wilson's avatar
      drm/i915: Break up error capture compression loops with cond_resched() · 9be75839
      Chris Wilson authored
      commit 7d555314
      
       upstream.
      
      As the error capture will compress user buffers as directed to by the
      user, it can take an arbitrary amount of time and space. Break up the
      compression loops with a call to cond_resched(), that will allow other
      processes to schedule (avoiding the soft lockups) and also serve as a
      warning should we try to make this loop atomic in the future.
      
      Testcase: igt/gem_exec_capture/many-*
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200916090059.3189-2-chris@chris-wilson.co.uk
      (cherry picked from commit 293f43c8
      
      )
      Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9be75839
  2. 05 Nov, 2020 24 commits