Commit 32cb08e9 authored by Pavel Skripkin's avatar Pavel Skripkin Committed by Marcel Holtmann
Browse files

Bluetooth: hci_uart: add missing NULL check in h5_enqueue



Syzbot hit general protection fault in __pm_runtime_resume(). The problem
was in missing NULL check.

hu->serdev can be NULL and we should not blindly pass &serdev->dev
somewhere, since it will cause GPF.

Reported-by: default avatar <syzbot+b9bd12fbed3485a3e51f@syzkaller.appspotmail.com>
Fixes: d9dd833c ("Bluetooth: hci_h5: Add runtime suspend")
Signed-off-by: default avatarPavel Skripkin <paskripkin@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent f63d24ba
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -629,9 +629,11 @@ static int h5_enqueue(struct hci_uart *hu, struct sk_buff *skb)
		break;
	}

	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;
}