Skip to content

Revert some upstream commits to get USB gadget working#75

Merged
gratian merged 2 commits intoni:nilrt/master/5.15from
chaitu236:dev/cvadrevu/5.15_revert_gpio_lut
Aug 31, 2022
Merged

Revert some upstream commits to get USB gadget working#75
gratian merged 2 commits intoni:nilrt/master/5.15from
chaitu236:dev/cvadrevu/5.15_revert_gpio_lut

Conversation

@chaitu236
Copy link

@chaitu236 chaitu236 commented Aug 26, 2022

Reverting two upstream commits because the assumption that
any baytrail hardware without ACPI entries for USB PHY "reset" and
"cs" will have GPIO controller INT33FC in their ACPI tables - which
is not the case for some of our targets.

Testing

With these reverts, usb0 interface appears in cRIO-9030, cRIO-9053, cRIO-9037, cRIO-9043, cRIO-9049.

This reverts commit 7b412b0.

Signed-off-by: Chaitanya Vadrevu <chaitanya.vadrevu@ni.com>
…PI GPIO resources"

This reverts commit 5741022.

This revert and the one before are being applied because the assumption
that any baytrail hardware without ACPI entries for USB PHY "reset" and
"cs" will have GPIO controller INT33FC in their ACPI tables - which
is not the case for some of our targets.

Signed-off-by: Chaitanya Vadrevu <chaitanya.vadrevu@ni.com>
@chaitu236 chaitu236 requested review from a team, bstreiff and gratian August 26, 2022 00:11
@chaitu236
Copy link
Author

@gratian / @bstreiff can this be merged if there are no reservations.

@gratian gratian merged commit 4451ed9 into ni:nilrt/master/5.15 Aug 31, 2022
@chaitu236 chaitu236 deleted the dev/cvadrevu/5.15_revert_gpio_lut branch August 31, 2022 20:57
mike-petersen-ni pushed a commit to mike-petersen-ni/linux that referenced this pull request Jan 9, 2023
[ Upstream commit 998b30c ]

Syzkaller reports a NULL deref bug as follows:

 BUG: KASAN: null-ptr-deref in io_tctx_exit_cb+0x53/0xd3
 Read of size 4 at addr 0000000000000138 by task file1/1955

 CPU: 1 PID: 1955 Comm: file1 Not tainted 6.1.0-rc7-00103-gef4d3ea40565 ni#75
 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014
 Call Trace:
  <TASK>
  dump_stack_lvl+0xcd/0x134
  ? io_tctx_exit_cb+0x53/0xd3
  kasan_report+0xbb/0x1f0
  ? io_tctx_exit_cb+0x53/0xd3
  kasan_check_range+0x140/0x190
  io_tctx_exit_cb+0x53/0xd3
  task_work_run+0x164/0x250
  ? task_work_cancel+0x30/0x30
  get_signal+0x1c3/0x2440
  ? lock_downgrade+0x6e0/0x6e0
  ? lock_downgrade+0x6e0/0x6e0
  ? exit_signals+0x8b0/0x8b0
  ? do_raw_read_unlock+0x3b/0x70
  ? do_raw_spin_unlock+0x50/0x230
  arch_do_signal_or_restart+0x82/0x2470
  ? kmem_cache_free+0x260/0x4b0
  ? putname+0xfe/0x140
  ? get_sigframe_size+0x10/0x10
  ? do_execveat_common.isra.0+0x226/0x710
  ? lockdep_hardirqs_on+0x79/0x100
  ? putname+0xfe/0x140
  ? do_execveat_common.isra.0+0x238/0x710
  exit_to_user_mode_prepare+0x15f/0x250
  syscall_exit_to_user_mode+0x19/0x50
  do_syscall_64+0x42/0xb0
  entry_SYSCALL_64_after_hwframe+0x63/0xcd
 RIP: 0023:0x0
 Code: Unable to access opcode bytes at 0xffffffffffffffd6.
 RSP: 002b:00000000fffb7790 EFLAGS: 00000200 ORIG_RAX: 000000000000000b
 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
  </TASK>
 Kernel panic - not syncing: panic_on_warn set ...

This happens because the adding of task_work from io_ring_exit_work()
isn't synchronized with canceling all work items from eg exec. The
execution of the two are ordered in that they are both run by the task
itself, but if io_tctx_exit_cb() is queued while we're canceling all
work items off exec AND gets executed when the task exits to userspace
rather than in the main loop in io_uring_cancel_generic(), then we can
find current->io_uring == NULL and hit the above crash.

It's safe to add this NULL check here, because the execution of the two
paths are done by the task itself.

Cc: stable@vger.kernel.org
Fixes: d56d938 ("io_uring: do ctx initiated file note removal")
Reported-by: syzkaller <syzkaller@googlegroups.com>
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Link: https://lore.kernel.org/r/20221206093833.3812138-1-harshit.m.mogalapalli@oracle.com
[axboe: add code comment and also put an explanation in the commit msg]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
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.

2 participants