Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp693161pxb; Tue, 5 Apr 2022 19:02:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWCBerOyPYuSMDyV2vPV7EUAWiE02gdiW2LFgGJ+YARUcfmFP97PD4CLYjFLZ+SxQe093k X-Received: by 2002:a17:902:d4c1:b0:153:d493:3f1 with SMTP id o1-20020a170902d4c100b00153d49303f1mr6378547plg.102.1649210572626; Tue, 05 Apr 2022 19:02:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649210572; cv=none; d=google.com; s=arc-20160816; b=OxkMahE1Pyhzjh3GR2A4t6hbGKyE/ayzNGIoQdAcqm4zj7KR6hHKd6c1nLmoml28YI ggC3jpvYN/U91Y8rjyy4SeJsMjgCeQkzZLTqWzEcINU27MSUUOh68k4VEFF/ZvGrEbD+ IusU9VBmkeK7vgX74sCJjq9d7HtwE2q87+CaM42ah+G3lVUYb0XjXJ+6Mu5hivWyDgNK FRgZzUaQ/QbDa234HuqN4F6xtrmQloyJYDRlVdkDaQ5g6Hrfv+rFsQ+1S6Zdpp7DK54J WpcNSRXydtlC2oE2K/MPYwcu+zP46qNGudteJewy3+84xwh9EP4wOIScC31tlHCL9NFO +5Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sBV5JvvwbE9qz1d++yVBTQoEMsarwSdUYY7e7MvMs6E=; b=kMYsrqvOdWDLj1D3ylDu7WMv0DVIkzAay4y2R6ygODk0R0iLgIPaSBLs80gZF4c3Tu mVC5bKZw70KHRysdtOoBJUSEqdOr/5CIhXRPguX8xiEhN5qA28xZjN8LEkTApcUkAl86 Y/b3OyB+9uxhMQdK8JUlhzl+/DAjDTfWSpun28thVwOepxDkwJ5cI4LRoD5QuzNVLhm+ xqcCm9egQ4YLAGacl8Z2d9ppiRvPwSYBqz4dpZffpdKS+UCi2ItclTHjt4FqamlCMGJv UXmGyoGYkGUt5bGImFDINzn1haDGz9Ja+kqCwIC/7VnoH/DozpPGgEsrGbHnvEALnwBU 9Xwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zlvgrOfC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y13-20020a17090ad70d00b001ca7bb4dc7bsi3510701pju.79.2022.04.05.19.02.36; Tue, 05 Apr 2022 19:02:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zlvgrOfC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232607AbiDEJlT (ORCPT + 99 others); Tue, 5 Apr 2022 05:41:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239087AbiDEITr (ORCPT ); Tue, 5 Apr 2022 04:19:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0F5F765A8; Tue, 5 Apr 2022 01:10:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6A88960AFB; Tue, 5 Apr 2022 08:10:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D7A9C385A1; Tue, 5 Apr 2022 08:10:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649146210; bh=o7xH8q1QcBDjg+NQiSO+r0qpDbFOAcGSWY82F81nOho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zlvgrOfCbkP/kSHaVGKfO3aMiqx9nSccgMdOB+6uMs203cdvTHZxU9YRnyVGuXS+O vUm7WtUkkoqUizBRHSNAMcuGhVmgDRSLY8/WjonlXQfzkdj9MHXliYD6sfaZll4R++ azlMYmso5AlGXxwXx2WYAmAk7m+iHQeCOkf7ejBs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+b9bd12fbed3485a3e51f@syzkaller.appspotmail.com, Pavel Skripkin , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.17 0683/1126] Bluetooth: hci_uart: add missing NULL check in h5_enqueue Date: Tue, 5 Apr 2022 09:23:50 +0200 Message-Id: <20220405070427.665899043@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Skripkin [ Upstream commit 32cb08e958696908a9aad5e49a78d74f7e32fffb ] 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: syzbot+b9bd12fbed3485a3e51f@syzkaller.appspotmail.com Fixes: d9dd833cf6d2 ("Bluetooth: hci_h5: Add runtime suspend") Signed-off-by: Pavel Skripkin Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- drivers/bluetooth/hci_h5.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --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; } -- 2.34.1