Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update #539

Closed
wants to merge 3 commits into from
Closed

update #539

wants to merge 3 commits into from

Conversation

chaosmamama
Copy link

update

@chaosmamama
Copy link
Author

update

fengguang pushed a commit to 0day-ci/linux that referenced this pull request Feb 16, 2020
[BUG]
When calling BTRF_IOC_GET_SUBVOL_INFO ioctl, we can easily hit the
following backtrace:
  BUG: kernel NULL pointer dereference, address: 0000000000000024
  #PF: supervisor read access in kernel mode
  #PF: error_code(0x0000) - not-present page
  PGD 0 P4D 0
  Oops: 0000 [#1] SMP PTI
  CPU: 0 PID: 27421 Comm: python3 Not tainted 5.6.0-rc1+ torvalds#539
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59-gc9ba527-rebuilt.opensuse.org 04/01/2014
  RIP: 0010:btrfs_root_node+0x7/0x30 [btrfs]
  Call Trace:
   btrfs_read_lock_root_node+0x1f/0x40 [btrfs]
   btrfs_search_slot+0x60f/0xa40 [btrfs]
   btrfs_ioctl+0x11f7/0x30b0 [btrfs]
   ksys_ioctl+0x82/0xc0
   __x64_sys_ioctl+0x11/0x20
   do_syscall_64+0x43/0x130
   entry_SYSCALL_64_after_hwframe+0x44/0xa9
  RIP: 0033:0x7fcb78d43387
  ---[ end trace 1c21a7c6c0523b8c ]---

[CAUSE]
We're abusing local @root, it's originally a subvolume root, but in
root backref search, it's re-assigned to tree_root.

Then we call "btrfs_put_root(root);" when exiting.
If that @root is reassgined to tree-root, we freed the most important
tree, and cause use-after-free.

[FIX]
Don't re-assgiend @root, use fs_info->tree_root directly.

Reported-by: Marcos Paulo de Souza <mpdesouza@suse.de>
Fixes: 8c319b6 ("btrfs: hold a ref on the root in btrfs_ioctl_get_subvol_info")
[To David: please fold the fix into that commit]
Signed-off-by: Qu Wenruo <wqu@suse.com>
fengguang pushed a commit to 0day-ci/linux that referenced this pull request Mar 15, 2021
This commit fixes the following checkpatch.pl errors:

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#535: FILE: ./hal/HalBtcOutSrc.h:535:
    +void EXhalbtcoutsrc_PowerOnSetting(struct BTC_COEXIST * pBtCoexist);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#536: FILE: ./hal/HalBtcOutSrc.h:536:
    +void EXhalbtcoutsrc_InitHwConfig(struct BTC_COEXIST * pBtCoexist, u8 bWifiOnly);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#537: FILE: ./hal/HalBtcOutSrc.h:537:
    +void EXhalbtcoutsrc_InitCoexDm(struct BTC_COEXIST * pBtCoexist);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#538: FILE: ./hal/HalBtcOutSrc.h:538:
    +void EXhalbtcoutsrc_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#539: FILE: ./hal/HalBtcOutSrc.h:539:
    +void EXhalbtcoutsrc_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#540: FILE: ./hal/HalBtcOutSrc.h:540:
    +void EXhalbtcoutsrc_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#541: FILE: ./hal/HalBtcOutSrc.h:541:
    +void EXhalbtcoutsrc_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 action);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#543: FILE: ./hal/HalBtcOutSrc.h:543:
    +	struct BTC_COEXIST * pBtCoexist, enum RT_MEDIA_STATUS mediaStatus

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#545: FILE: ./hal/HalBtcOutSrc.h:545:
    +void EXhalbtcoutsrc_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 pktType);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#547: FILE: ./hal/HalBtcOutSrc.h:547:
    +	struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#549: FILE: ./hal/HalBtcOutSrc.h:549:
    +void EXhalbtcoutsrc_HaltNotify(struct BTC_COEXIST * pBtCoexist);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#550: FILE: ./hal/HalBtcOutSrc.h:550:
    +void EXhalbtcoutsrc_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#551: FILE: ./hal/HalBtcOutSrc.h:551:
    +void EXhalbtcoutsrc_Periodical(struct BTC_COEXIST * pBtCoexist);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#555: FILE: ./hal/HalBtcOutSrc.h:555:
    +void EXhalbtcoutsrc_DisplayBtCoexInfo(struct BTC_COEXIST * pBtCoexist);

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
fengguang pushed a commit to 0day-ci/linux that referenced this pull request Mar 16, 2021
This commit fixes the following checkpatch.pl errors:

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#535: FILE: ./hal/HalBtcOutSrc.h:535:
    +void EXhalbtcoutsrc_PowerOnSetting(struct BTC_COEXIST * pBtCoexist);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#536: FILE: ./hal/HalBtcOutSrc.h:536:
    +void EXhalbtcoutsrc_InitHwConfig(struct BTC_COEXIST * pBtCoexist, u8 bWifiOnly);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#537: FILE: ./hal/HalBtcOutSrc.h:537:
    +void EXhalbtcoutsrc_InitCoexDm(struct BTC_COEXIST * pBtCoexist);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#538: FILE: ./hal/HalBtcOutSrc.h:538:
    +void EXhalbtcoutsrc_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#539: FILE: ./hal/HalBtcOutSrc.h:539:
    +void EXhalbtcoutsrc_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#540: FILE: ./hal/HalBtcOutSrc.h:540:
    +void EXhalbtcoutsrc_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#541: FILE: ./hal/HalBtcOutSrc.h:541:
    +void EXhalbtcoutsrc_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 action);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#543: FILE: ./hal/HalBtcOutSrc.h:543:
    +	struct BTC_COEXIST * pBtCoexist, enum RT_MEDIA_STATUS mediaStatus

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#545: FILE: ./hal/HalBtcOutSrc.h:545:
    +void EXhalbtcoutsrc_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 pktType);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#547: FILE: ./hal/HalBtcOutSrc.h:547:
    +	struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#549: FILE: ./hal/HalBtcOutSrc.h:549:
    +void EXhalbtcoutsrc_HaltNotify(struct BTC_COEXIST * pBtCoexist);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#550: FILE: ./hal/HalBtcOutSrc.h:550:
    +void EXhalbtcoutsrc_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#551: FILE: ./hal/HalBtcOutSrc.h:551:
    +void EXhalbtcoutsrc_Periodical(struct BTC_COEXIST * pBtCoexist);

    ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
    torvalds#555: FILE: ./hal/HalBtcOutSrc.h:555:
    +void EXhalbtcoutsrc_DisplayBtCoexInfo(struct BTC_COEXIST * pBtCoexist);

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210315170618.2566-7-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ojeda added a commit to ojeda/linux that referenced this pull request Nov 11, 2021
rust: Add support for irqsave/irqrestore variant of spin lock/unlock.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant