Re: [syzbot] general protection fault in __pm_runtime_resume (2)

From: Pavel Skripkin
Date: Sun Mar 13 2022 - 13:29:58 EST


On 3/13/22 20:27, syzbot wrote:
On 3/13/22 08:35, syzbot wrote:
Hello,

syzbot found the following issue on:

HEAD commit: 92f90cc9fe0e Merge tag 'fuse-fixes-5.17-rc8' of git://git...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=118cd3be700000
kernel config: https://syzkaller.appspot.com/x/.config?x=442f8ac61e60a75e
dashboard link: https://syzkaller.appspot.com/bug?extid=b9bd12fbed3485a3e51f
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15b64e79700000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1652811a700000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+b9bd12fbed3485a3e51f@xxxxxxxxxxxxxxxxxxxxxxxxx


hu->serdev should be checked before passing to pm functions

#syz test:

want 2 args (repo, branch), got 3


Woops

#syz test:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master



With regards,
Pavel Skripkindiff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index 34286ffe0568..7ac6908a4dfb 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -629,9 +629,11 @@ static int h5_enqueue(struct hci_uart *hu, struct sk_buff *skb)
break;
}

- pm_runtime_get_sync(&hu->serdev->dev);
- pm_runtime_mark_last_busy(&hu->serdev->dev);
- pm_runtime_put_autosuspend(&hu->serdev->dev);
+ if (hu->serdev) {
+ pm_runtime_get_sync(&hu->serdev->dev);
+ pm_runtime_mark_last_busy(&hu->serdev->dev);
+ pm_runtime_put_autosuspend(&hu->serdev->dev);
+ }

return 0;
}