1. 08 4月, 2021 21 次提交
  2. 09 3月, 2021 19 次提交
    • M
      media: pwc: Use correct device for DMA · 0b17a1b2
      Matwey V. Kornilov 提交于
      stable inclusion
      from stable-5.10.18
      commit c6152fd3ac2b92e0ab798a2f9d852ced06e87a4a
      bugzilla: 50148
      
      --------------------------------
      
      commit 69c9e825 upstream.
      
      This fixes the following newly introduced warning:
      
      [   15.518253] ------------[ cut here ]------------
      [   15.518941] WARNING: CPU: 0 PID: 246 at kernel/dma/mapping.c:149 dma_map_page_attrs+0x1a8/0x1d0
      [   15.520634] Modules linked in: pwc videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev mc efivarfs
      [   15.522335] CPU: 0 PID: 246 Comm: v4l2-test Not tainted 5.11.0-rc1+ #1
      [   15.523281] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
      [   15.524438] RIP: 0010:dma_map_page_attrs+0x1a8/0x1d0
      [   15.525135] Code: 10 5b 5d 41 5c 41 5d c3 4d 89 d0 eb d7 4d 89 c8 89 e9 48 89 da e8 68 29 00 00 eb d1 48 89 f2 48 2b 50 18 48 89 d0 eb 83 0f 0b <0f> 0b 48 c7 c0 ff ff ff ff eb b8 48 89 d9 48 8b 40 40 e8 61 69 d2
      [   15.527938] RSP: 0018:ffffa2694047bca8 EFLAGS: 00010246
      [   15.528716] RAX: 0000000000000000 RBX: 0000000000002580 RCX: 0000000000000000
      [   15.529782] RDX: 0000000000000000 RSI: ffffcdce000ecc00 RDI: ffffa0b4bdb888a0
      [   15.530849] RBP: 0000000000000002 R08: 0000000000000002 R09: 0000000000000000
      [   15.531881] R10: 0000000000000004 R11: 000000000002d8c0 R12: 0000000000000000
      [   15.532911] R13: ffffa0b4bdb88800 R14: ffffa0b483820000 R15: ffffa0b4bdb888a0
      [   15.533942] FS:  00007fc5fbb5e4c0(0000) GS:ffffa0b4fc000000(0000) knlGS:0000000000000000
      [   15.535141] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   15.535988] CR2: 00007fc5fb6ea138 CR3: 0000000003812000 CR4: 00000000001506f0
      [   15.537025] Call Trace:
      [   15.537425]  start_streaming+0x2e9/0x4b0 [pwc]
      [   15.538143]  vb2_start_streaming+0x5e/0x110 [videobuf2_common]
      [   15.538989]  vb2_core_streamon+0x107/0x140 [videobuf2_common]
      [   15.539831]  __video_do_ioctl+0x18f/0x4a0 [videodev]
      [   15.540670]  video_usercopy+0x13a/0x5b0 [videodev]
      [   15.541349]  ? video_put_user+0x230/0x230 [videodev]
      [   15.542096]  ? selinux_file_ioctl+0x143/0x200
      [   15.542752]  v4l2_ioctl+0x40/0x50 [videodev]
      [   15.543360]  __x64_sys_ioctl+0x89/0xc0
      [   15.543930]  do_syscall_64+0x33/0x40
      [   15.544448]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [   15.545236] RIP: 0033:0x7fc5fb671587
      [   15.545780] Code: b3 66 90 48 8b 05 11 49 2c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d e1 48 2c 00 f7 d8 64 89 01 48
      [   15.548486] RSP: 002b:00007fff0f71f038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
      [   15.549578] RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fc5fb671587
      [   15.550664] RDX: 00007fff0f71f060 RSI: 0000000040045612 RDI: 0000000000000003
      [   15.551706] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
      [   15.552738] R10: 0000000000000000 R11: 0000000000000246 R12: 00007fff0f71f060
      [   15.553817] R13: 00007fff0f71f1d0 R14: 0000000000de1270 R15: 0000000000000000
      [   15.554914] ---[ end trace 7be03122966c2486 ]---
      
      Fixes: 1161db67 ("media: usb: pwc: Don't use coherent DMA buffers for ISO transfer")
      Signed-off-by: NMatwey V. Kornilov <matwey@sai.msu.ru>
      Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      0b17a1b2
    • F
      btrfs: fix crash after non-aligned direct IO write with O_DSYNC · 974fba4e
      Filipe Manana 提交于
      stable inclusion
      from stable-5.10.18
      commit a6703c71153438d3ebdf58a75d53dd5e57b33095
      bugzilla: 50148
      
      --------------------------------
      
      Whenever we attempt to do a non-aligned direct IO write with O_DSYNC, we
      end up triggering an assertion and crashing. Example reproducer:
      
        $ cat test.sh
        #!/bin/bash
      
        DEV=/dev/sdj
        MNT=/mnt/sdj
      
        mkfs.btrfs -f $DEV > /dev/null
        mount $DEV $MNT
      
        # Do a direct IO write with O_DSYNC into a non-aligned range...
        xfs_io -f -d -s -c "pwrite -S 0xab -b 64K 1111 64K" $MNT/foobar
      
        umount $MNT
      
      When running the reproducer an assertion fails and produces the following
      trace:
      
        [ 2418.403134] assertion failed: !current->journal_info || flush != BTRFS_RESERVE_FLUSH_DATA, in fs/btrfs/space-info.c:1467
        [ 2418.403745] ------------[ cut here ]------------
        [ 2418.404306] kernel BUG at fs/btrfs/ctree.h:3286!
        [ 2418.404862] invalid opcode: 0000 [#2] PREEMPT SMP DEBUG_PAGEALLOC PTI
        [ 2418.405451] CPU: 1 PID: 64705 Comm: xfs_io Tainted: G      D           5.10.15-btrfs-next-87 #1
        [ 2418.406026] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
        [ 2418.407228] RIP: 0010:assertfail.constprop.0+0x18/0x26 [btrfs]
        [ 2418.407835] Code: e6 48 c7 (...)
        [ 2418.409078] RSP: 0018:ffffb06080d13c98 EFLAGS: 00010246
        [ 2418.409696] RAX: 000000000000006c RBX: ffff994c1debbf08 RCX: 0000000000000000
        [ 2418.410302] RDX: 0000000000000000 RSI: 0000000000000027 RDI: 00000000ffffffff
        [ 2418.410904] RBP: ffff994c21770000 R08: 0000000000000000 R09: 0000000000000000
        [ 2418.411504] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000010000
        [ 2418.412111] R13: ffff994c22198400 R14: ffff994c21770000 R15: 0000000000000000
        [ 2418.412713] FS:  00007f54fd7aff00(0000) GS:ffff994d35200000(0000) knlGS:0000000000000000
        [ 2418.413326] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        [ 2418.413933] CR2: 000056549596d000 CR3: 000000010b928003 CR4: 0000000000370ee0
        [ 2418.414528] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        [ 2418.415109] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        [ 2418.415669] Call Trace:
        [ 2418.416254]  btrfs_reserve_data_bytes.cold+0x22/0x22 [btrfs]
        [ 2418.416812]  btrfs_check_data_free_space+0x4c/0xa0 [btrfs]
        [ 2418.417380]  btrfs_buffered_write+0x1b0/0x7f0 [btrfs]
        [ 2418.418315]  btrfs_file_write_iter+0x2a9/0x770 [btrfs]
        [ 2418.418920]  new_sync_write+0x11f/0x1c0
        [ 2418.419430]  vfs_write+0x2bb/0x3b0
        [ 2418.419972]  __x64_sys_pwrite64+0x90/0xc0
        [ 2418.420486]  do_syscall_64+0x33/0x80
        [ 2418.420979]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
        [ 2418.421486] RIP: 0033:0x7f54fda0b986
        [ 2418.421981] Code: 48 c7 c0 (...)
        [ 2418.423019] RSP: 002b:00007ffc40569c38 EFLAGS: 00000246 ORIG_RAX: 0000000000000012
        [ 2418.423547] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f54fda0b986
        [ 2418.424075] RDX: 0000000000010000 RSI: 000056549595e000 RDI: 0000000000000003
        [ 2418.424596] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000400
        [ 2418.425119] R10: 0000000000000400 R11: 0000000000000246 R12: 00000000ffffffff
        [ 2418.425644] R13: 0000000000000400 R14: 0000000000010000 R15: 0000000000000000
        [ 2418.426148] Modules linked in: btrfs blake2b_generic (...)
        [ 2418.429540] ---[ end trace ef2aeb44dc0afa34 ]---
      
      1) At btrfs_file_write_iter() we set current->journal_info to
         BTRFS_DIO_SYNC_STUB;
      
      2) We then call __btrfs_direct_write(), which calls btrfs_direct_IO();
      
      3) We can't do the direct IO write because it starts at a non-aligned
         offset (1111). So at btrfs_direct_IO() we return -EINVAL (coming from
         check_direct_IO() which does the alignment check), but we leave
         current->journal_info set to BTRFS_DIO_SYNC_STUB - we only clear it
         at btrfs_dio_iomap_begin(), because we assume we always get there;
      
      4) Then at __btrfs_direct_write() we see that the attempt to do the
         direct IO write was not successful, 0 bytes written, so we fallback
         to a buffered write by calling btrfs_buffered_write();
      
      5) There we call btrfs_check_data_free_space() which in turn calls
         btrfs_alloc_data_chunk_ondemand() and that calls
         btrfs_reserve_data_bytes() with flush == BTRFS_RESERVE_FLUSH_DATA;
      
      6) Then at btrfs_reserve_data_bytes() we have current->journal_info set to
         BTRFS_DIO_SYNC_STUB, therefore not NULL, and flush has the value
         BTRFS_RESERVE_FLUSH_DATA, triggering the second assertion:
      
        int btrfs_reserve_data_bytes(struct btrfs_fs_info *fs_info, u64 bytes,
                                     enum btrfs_reserve_flush_enum flush)
        {
            struct btrfs_space_info *data_sinfo = fs_info->data_sinfo;
            int ret;
      
            ASSERT(flush == BTRFS_RESERVE_FLUSH_DATA ||
                   flush == BTRFS_RESERVE_FLUSH_FREE_SPACE_INODE);
            ASSERT(!current->journal_info || flush != BTRFS_RESERVE_FLUSH_DATA);
        (...)
      
      So fix that by setting the journal to NULL whenever check_direct_IO()
      returns a failure.
      
      This bug only affects 5.10 kernels, and the regression was introduced in
      5.10-rc1 by commit 0eb79294 ("btrfs: dio iomap DSYNC workaround").
      The bug does not exist in 5.11 kernels due to commit ecfdc08b
      ("btrfs: remove dio iomap DSYNC workaround"), which depends on a large
      patchset that went into the merge window for 5.11. So this is a fix only
      for 5.10.x stable kernels, as there are people hitting this bug.
      
      Fixes: 0eb79294 ("btrfs: dio iomap DSYNC workaround")
      CC: stable@vger.kernel.org # 5.10 (and only 5.10)
      Acked-by: NDavid Sterba <dsterba@suse.com>
      Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1181605Signed-off-by: NFilipe Manana <fdmanana@suse.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      974fba4e
    • D
      btrfs: fix backport of 2175bf57dc952 in 5.10.13 · 7fd1e6f6
      David Sterba 提交于
      stable inclusion
      from stable-5.10.18
      commit aa0fd921d2079dd5fd87466f087a44eae8844217
      bugzilla: 50148
      
      --------------------------------
      
      There's a mistake in backport of upstream commit 2175bf57dc95 ("btrfs:
      fix possible free space tree corruption with online conversion") as
      5.10.13 commit 2175bf57dc95.
      
      The enum value BTRFS_FS_FREE_SPACE_TREE_UNTRUSTED has been added to the
      wrong enum set, colliding with value of BTRFS_FS_QUOTA_ENABLE. This
      could cause problems during the tree conversion, where the quotas
      wouldn't be set up properly but the related code executed anyway due to
      the bit set.
      
      Link: https://lore.kernel.org/linux-btrfs/20210219111741.95DD.409509F4@e16-tech.comReported-by: NWang Yugui <wangyugui@e16-tech.com>
      CC: stable@vger.kernel.org # 5.10.13+
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      7fd1e6f6
    • T
      Bluetooth: btusb: Always fallback to alt 1 for WBS · 6b0b5ec5
      Trent Piepho 提交于
      stable inclusion
      from stable-5.10.18
      commit df443aad518d788ac1df3af02ec97b733aabc364
      bugzilla: 50148
      
      --------------------------------
      
      commit 517b6933 upstream.
      
      When alt mode 6 is not available, fallback to the kernel <= 5.7 behavior
      of always using alt mode 1.
      
      Prior to kernel 5.8, btusb would always use alt mode 1 for WBS (Wide
      Band Speech aka mSBC aka transparent SCO).  In commit baac6276
      ("Bluetooth: btusb: handle mSBC audio over USB Endpoints") this
      was changed to use alt mode 6, which is the recommended mode in the
      Bluetooth spec (Specifications of the Bluetooth System, v5.0, Vol 4.B
      §2.2.1).  However, many if not most BT USB adapters do not support alt
      mode 6.  In fact, I have been unable to find any which do.
      
      In kernel 5.8, this was changed to use alt mode 6, and if not available,
      use alt mode 0.  But mode 0 has a zero byte max packet length and can
      not possibly work.  It is just there as a zero-bandwidth dummy mode to
      work around a USB flaw that would prevent device enumeration if
      insufficient bandwidth were available for the lowest isoc mode
      supported.
      
      In effect, WBS was broken for all USB-BT adapters that do not support
      alt 6, which appears to nearly all of them.
      
      Then in commit 461f95f0 ("Bluetooth: btusb: USB alternate setting 1 for
      WBS") the 5.7 behavior was restored, but only for Realtek adapters.
      
      I've tested a Broadcom BRCM20702A and CSR 8510 adapter, both work with
      the 5.7 behavior and do not with the 5.8.
      
      So get rid of the Realtek specific flag and use the 5.7 behavior for all
      adapters as a fallback when alt 6 is not available.  This was the
      kernel's behavior prior to 5.8 and I can find no adapters for which it
      is not correct.  And even if there is an adapter for which this does not
      work, the current behavior would be to fall back to alt 0, which can not
      possibly work either, and so is no better.
      Signed-off-by: NTrent Piepho <tpiepho@gmail.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      Cc: Salvatore Bonaccorso <carnil@debian.org>
      Cc: Sjoerd Simons <sjoerd@luon.net>
      Cc: Sebastian Reichel <sre@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      6b0b5ec5
    • L
      tty: protect tty_write from odd low-level tty disciplines · 97a192cc
      Linus Torvalds 提交于
      stable inclusion
      from stable-5.10.18
      commit ffec7ee21809c9c284042875b8d76b0d70a42585
      bugzilla: 50148
      
      --------------------------------
      
      commit 3342ff26 upstream.
      
      Al root-caused a new warning from syzbot to the ttyprintk tty driver
      returning a write count larger than the data the tty layer actually gave
      it.  Which confused the tty write code mightily, and with the new
      iov_iter based code, caused a WARNING in iov_iter_revert().
      
      syzbot correctly bisected the source of the new warning to commit
      9bb48c82 ("tty: implement write_iter"), but the oddity goes back
      much further, it just didn't get caught by anything before.
      
      Reported-by: syzbot+3d2c27c2b7dc2a94814d@syzkaller.appspotmail.com
      Fixes: 9bb48c82 ("tty: implement write_iter")
      Debugged-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      97a192cc
    • J
      xen-blkback: fix error handling in xen_blkbk_map() · d3f92988
      Jan Beulich 提交于
      stable inclusion
      from stable-5.10.18
      commit 00805af45a21729e2901a37914992786a0d32c46
      bugzilla: 50148
      
      --------------------------------
      
      commit 871997bc upstream.
      
      The function uses a goto-based loop, which may lead to an earlier error
      getting discarded by a later iteration. Exit this ad-hoc loop when an
      error was encountered.
      
      The out-of-memory error path additionally fails to fill a structure
      field looked at by xen_blkbk_unmap_prepare() before inspecting the
      handle which does get properly set (to BLKBACK_INVALID_HANDLE).
      
      Since the earlier exiting from the ad-hoc loop requires the same field
      filling (invalidation) as that on the out-of-memory path, fold both
      paths. While doing so, drop the pr_alert(), as extra log messages aren't
      going to help the situation (the kernel will log oom conditions already
      anyway).
      
      This is XSA-365.
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      Reviewed-by: NJuergen Gross <jgross@suse.com>
      Reviewed-by: NJulien Grall <julien@xen.org>
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      d3f92988
    • J
      xen-scsiback: don't "handle" error by BUG() · 987621a6
      Jan Beulich 提交于
      stable inclusion
      from stable-5.10.18
      commit 9bea436fc3fc9a820b8b34e83708971c1813b892
      bugzilla: 50148
      
      --------------------------------
      
      commit 7c77474b upstream.
      
      In particular -ENOMEM may come back here, from set_foreign_p2m_mapping().
      Don't make problems worse, the more that handling elsewhere (together
      with map's status fields now indicating whether a mapping wasn't even
      attempted, and hence has to be considered failed) doesn't require this
      odd way of dealing with errors.
      
      This is part of XSA-362.
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      987621a6
    • J
      xen-netback: don't "handle" error by BUG() · d3175339
      Jan Beulich 提交于
      stable inclusion
      from stable-5.10.18
      commit 2814b3aa38a679c63aa535355b02a5bd0f681a83
      bugzilla: 50148
      
      --------------------------------
      
      commit 3194a174 upstream.
      
      In particular -ENOMEM may come back here, from set_foreign_p2m_mapping().
      Don't make problems worse, the more that handling elsewhere (together
      with map's status fields now indicating whether a mapping wasn't even
      attempted, and hence has to be considered failed) doesn't require this
      odd way of dealing with errors.
      
      This is part of XSA-362.
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      d3175339
    • J
      xen-blkback: don't "handle" error by BUG() · 47ff0eff
      Jan Beulich 提交于
      stable inclusion
      from stable-5.10.18
      commit 8f8ebd6b1cb5cff96a11cd336027e745d48c2cab
      bugzilla: 50148
      
      --------------------------------
      
      commit 5a264285 upstream.
      
      In particular -ENOMEM may come back here, from set_foreign_p2m_mapping().
      Don't make problems worse, the more that handling elsewhere (together
      with map's status fields now indicating whether a mapping wasn't even
      attempted, and hence has to be considered failed) doesn't require this
      odd way of dealing with errors.
      
      This is part of XSA-362.
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      47ff0eff
    • S
      xen/arm: don't ignore return errors from set_phys_to_machine · 25c8a9e9
      Stefano Stabellini 提交于
      stable inclusion
      from stable-5.10.18
      commit 0462dbbe2cab43528f943575b510625cf422921a
      bugzilla: 50148
      
      --------------------------------
      
      commit 36bf1dfb upstream.
      
      set_phys_to_machine can fail due to lack of memory, see the kzalloc call
      in arch/arm/xen/p2m.c:__set_phys_to_machine_multi.
      
      Don't ignore the potential return error in set_foreign_p2m_mapping,
      returning it to the caller instead.
      
      This is part of XSA-361.
      Signed-off-by: NStefano Stabellini <stefano.stabellini@xilinx.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: NJulien Grall <jgrall@amazon.com>
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      25c8a9e9
    • J
      Xen/gntdev: correct error checking in gntdev_map_grant_pages() · 74504a63
      Jan Beulich 提交于
      stable inclusion
      from stable-5.10.18
      commit be89a0300a58c273b6f48bb8db01c807e203098b
      bugzilla: 50148
      
      --------------------------------
      
      commit ebee0eab upstream.
      
      Failure of the kernel part of the mapping operation should also be
      indicated as an error to the caller, or else it may assume the
      respective kernel VA is okay to access.
      
      Furthermore gnttab_map_refs() failing still requires recording
      successfully mapped handles, so they can be unmapped subsequently. This
      in turn requires there to be a way to tell full hypercall failure from
      partial success - preset map_op status fields such that they won't
      "happen" to look as if the operation succeeded.
      
      Also again use GNTST_okay instead of implying its value (zero).
      
      This is part of XSA-361.
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      74504a63
    • J
      Xen/gntdev: correct dev_bus_addr handling in gntdev_map_grant_pages() · 3a43f113
      Jan Beulich 提交于
      stable inclusion
      from stable-5.10.18
      commit 1a5c2274349f5b6f3b6bbdf43247e71a50ae6e2f
      bugzilla: 50148
      
      --------------------------------
      
      commit dbe52836 upstream.
      
      We may not skip setting the field in the unmap structure when
      GNTMAP_device_map is in use - such an unmap would fail to release the
      respective resources (a page ref in the hypervisor). Otoh the field
      doesn't need setting at all when GNTMAP_device_map is not in use.
      
      To record the value for unmapping, we also better don't use our local
      p2m: In particular after a subsequent change it may not have got updated
      for all the batch elements. Instead it can simply be taken from the
      respective map's results.
      
      We can additionally avoid playing this game altogether for the kernel
      part of the mappings in (x86) PV mode.
      
      This is part of XSA-361.
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: NStefano Stabellini <sstabellini@kernel.org>
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      3a43f113
    • J
      Xen/x86: also check kernel mapping in set_foreign_p2m_mapping() · 32f0e57f
      Jan Beulich 提交于
      stable inclusion
      from stable-5.10.18
      commit 0c08037b56a77219a6ec67c2cb19abf38722a525
      bugzilla: 50148
      
      --------------------------------
      
      commit b512e1b0 upstream.
      
      We should not set up further state if either mapping failed; paying
      attention to just the user mapping's status isn't enough.
      
      Also use GNTST_okay instead of implying its value (zero).
      
      This is part of XSA-361.
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      32f0e57f
    • J
      Xen/x86: don't bail early from clear_foreign_p2m_mapping() · 19d6aece
      Jan Beulich 提交于
      stable inclusion
      from stable-5.10.18
      commit 740f4d9d0c34ea99279acf2fc99ae33c0142265a
      bugzilla: 50148
      
      --------------------------------
      
      commit a35f2ef3 upstream.
      
      Its sibling (set_foreign_p2m_mapping()) as well as the sibling of its
      only caller (gnttab_map_refs()) don't clean up after themselves in case
      of error. Higher level callers are expected to do so. However, in order
      for that to really clean up any partially set up state, the operation
      should not terminate upon encountering an entry in unexpected state. It
      is particularly relevant to notice here that set_foreign_p2m_mapping()
      would skip setting up a p2m entry if its grant mapping failed, but it
      would continue to set up further p2m entries as long as their mappings
      succeeded.
      
      Arguably down the road set_foreign_p2m_mapping() may want its page state
      related WARN_ON() also converted to an error return.
      
      This is part of XSA-361.
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      19d6aece
    • Y
      net: fix proc_fs init handling in af_packet and tls · 7c06e2b6
      Yonatan Linik 提交于
      stable inclusion
      from stable-5.10.18
      commit 06ab1e63ec5c72255fae316c59ea9c0475eadac8
      bugzilla: 50148
      
      --------------------------------
      
      [ Upstream commit a268e0f2 ]
      
      proc_fs was used, in af_packet, without a surrounding #ifdef,
      although there is no hard dependency on proc_fs.
      That caused the initialization of the af_packet module to fail
      when CONFIG_PROC_FS=n.
      
      Specifically, proc_create_net() was used in af_packet.c,
      and when it fails, packet_net_init() returns -ENOMEM.
      It will always fail when the kernel is compiled without proc_fs,
      because, proc_create_net() for example always returns NULL.
      
      The calling order that starts in af_packet.c is as follows:
      packet_init()
      register_pernet_subsys()
      register_pernet_operations()
      __register_pernet_operations()
      ops_init()
      ops->init() (packet_net_ops.init=packet_net_init())
      proc_create_net()
      
      It worked in the past because register_pernet_subsys()'s return value
      wasn't checked before this Commit 36096f2f ("packet: Fix error path in
      packet_init.").
      It always returned an error, but was not checked before, so everything
      was working even when CONFIG_PROC_FS=n.
      
      The fix here is simply to add the necessary #ifdef.
      
      This also fixes a similar error in tls_proc.c, that was found by Jakub
      Kicinski.
      
      Fixes: d26b698d ("net/tls: add skeleton of MIB statistics")
      Fixes: 36096f2f ("packet: Fix error path in packet_init")
      Signed-off-by: NYonatan Linik <yonatanlinik@gmail.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      7c06e2b6
    • W
      net: bridge: Fix a warning when del bridge sysfs · f6fc3503
      Wang Hai 提交于
      stable inclusion
      from stable-5.10.18
      commit ba2582cd7f20cec3d4c32bcc7a5a6f9645d3a654
      bugzilla: 50148
      
      --------------------------------
      
      [ Upstream commit 989a1db0 ]
      
      I got a warining report:
      
      br_sysfs_addbr: can't create group bridge4/bridge
      ------------[ cut here ]------------
      sysfs group 'bridge' not found for kobject 'bridge4'
      WARNING: CPU: 2 PID: 9004 at fs/sysfs/group.c:279 sysfs_remove_group fs/sysfs/group.c:279 [inline]
      WARNING: CPU: 2 PID: 9004 at fs/sysfs/group.c:279 sysfs_remove_group+0x153/0x1b0 fs/sysfs/group.c:270
      Modules linked in: iptable_nat
      ...
      Call Trace:
        br_dev_delete+0x112/0x190 net/bridge/br_if.c:384
        br_dev_newlink net/bridge/br_netlink.c:1381 [inline]
        br_dev_newlink+0xdb/0x100 net/bridge/br_netlink.c:1362
        __rtnl_newlink+0xe11/0x13f0 net/core/rtnetlink.c:3441
        rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3500
        rtnetlink_rcv_msg+0x385/0x980 net/core/rtnetlink.c:5562
        netlink_rcv_skb+0x134/0x3d0 net/netlink/af_netlink.c:2494
        netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]
        netlink_unicast+0x4a0/0x6a0 net/netlink/af_netlink.c:1330
        netlink_sendmsg+0x793/0xc80 net/netlink/af_netlink.c:1919
        sock_sendmsg_nosec net/socket.c:651 [inline]
        sock_sendmsg+0x139/0x170 net/socket.c:671
        ____sys_sendmsg+0x658/0x7d0 net/socket.c:2353
        ___sys_sendmsg+0xf8/0x170 net/socket.c:2407
        __sys_sendmsg+0xd3/0x190 net/socket.c:2440
        do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46
        entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      In br_device_event(), if the bridge sysfs fails to be added,
      br_device_event() should return error. This can prevent warining
      when removing bridge sysfs that do not exist.
      
      Fixes: bb900b27 ("bridge: allow creating bridge devices with netlink")
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Signed-off-by: NWang Hai <wanghai38@huawei.com>
      Tested-by: NNikolay Aleksandrov <nikolay@nvidia.com>
      Acked-by: NNikolay Aleksandrov <nikolay@nvidia.com>
      Link: https://lore.kernel.org/r/20201211122921.40386-1-wanghai38@huawei.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      f6fc3503
    • E
      net: openvswitch: fix TTL decrement exception action execution · a7089d0e
      Eelco Chaudron 提交于
      stable inclusion
      from stable-5.10.18
      commit 2bce178c254c5df3df353962b891d2cc63c4afed
      bugzilla: 50148
      
      --------------------------------
      
      [ Upstream commit 09d62172 ]
      
      Currently, the exception actions are not processed correctly as the wrong
      dataset is passed. This change fixes this, including the misleading
      comment.
      
      In addition, a check was added to make sure we work on an IPv4 packet,
      and not just assume if it's not IPv6 it's IPv4.
      
      This was all tested using OVS with patch,
      https://patchwork.ozlabs.org/project/openvswitch/list/?series=21639,
      applied and sending packets with a TTL of 1 (and 0), both with IPv4
      and IPv6.
      
      Fixes: 69929d4c ("net: openvswitch: fix TTL decrement action netlink message format")
      Signed-off-by: NEelco Chaudron <echaudro@redhat.com>
      Link: https://lore.kernel.org/r/160733569860.3007.12938188180387116741.stgit@wsfd-netdev64.ntdv.lab.eng.bos.redhat.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      a7089d0e
    • P
      net: sched: incorrect Kconfig dependencies on Netfilter modules · 330a3fec
      Pablo Neira Ayuso 提交于
      stable inclusion
      from stable-5.10.18
      commit 78b12034d4c394a9d7c9fa47c6b738fb0571b218
      bugzilla: 50148
      
      --------------------------------
      
      [ Upstream commit 102e2c07 ]
      
      - NET_ACT_CONNMARK and NET_ACT_CTINFO only require conntrack support.
      - NET_ACT_IPT only requires NETFILTER_XTABLES symbols, not
        IP_NF_IPTABLES. After this patch, NET_ACT_IPT becomes consistent
        with NET_EMATCH_IPT. NET_ACT_IPT dependency on IP_NF_IPTABLES predates
        Linux-2.6.12-rc2 (initial git repository build).
      
      Fixes: 22a5dc0e ("net: sched: Introduce connmark action")
      Fixes: 24ec483c ("net: sched: Introduce act_ctinfo action")
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      Link: https://lore.kernel.org/r/20201208204707.11268-1-pablo@netfilter.orgSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      330a3fec
    • L
      mt76: mt7615: fix rdd mcu cmd endianness · d48ee22b
      Lorenzo Bianconi 提交于
      stable inclusion
      from stable-5.10.18
      commit f9d6533d18fd80412dc0450cf751ad144e698a23
      bugzilla: 50148
      
      --------------------------------
      
      [ Upstream commit 0211c282 ]
      
      Similar to mt7915 driver, fix mt7615 radar mcu command endianness
      
      Fixes: 2ce73efe ("mt76: mt7615: initialize radar specs from host driver")
      Fixes: 70911d96 ("mt76: mt7615: add radar pattern test knob to debugfs")
      Signed-off-by: NLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: NFelix Fietkau <nbd@nbd.name>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      d48ee22b