Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp327161img; Thu, 21 Mar 2019 21:56:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzSCtgnLdctv7VHlJalEdJCiFvbcjPjEons/0gxH5g12JR1kuqu5OSMry3TB6vW0FpTR0RT X-Received: by 2002:a62:a509:: with SMTP id v9mr7424833pfm.64.1553230573997; Thu, 21 Mar 2019 21:56:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553230573; cv=none; d=google.com; s=arc-20160816; b=nPxUTcIpRnB+vuCq+fg028dkfaOXg4PEb8/sRaSZI+aQfc8fFPNCTW4x6tEytSIznD 45AK7M8wQY1ngqAdU5DyQtHvDFx09AWWLNwKlOcyWAwyGKyX2fSX1E78ziY3QUbBKW7c spZnKCV/XLqwSmmpwQFeqC16nsdTjhbUHSYUk+vabNeM3FpxceH71joOCLJZxqS9NRQb 9Aq98m7ZpiuAOPmiz8IRppRDjg5238jnR/twcfMf8X6sc/4wprGMW9EKnVUL3lEtQT6z hu4DrtFyWWZ4SZgF7bhF3F7ZomAPipHbA8Vm2BZ2HK6gB2CN43E9+FXMS38X5fkI+r/u E+1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature; bh=47MzOjobamEpxo3goloFUkpo3mNVCgfWU0ZnhJxz2ho=; b=Gynyw4HEmR2BQYIivcxltwOTXp3xqGW+4cXd5goy+UJswafQ1BtSTIgvEEqLbHAgeU LKI/nUq2feqDjyFPqxcaE5raSBlrRupqLFg1/Sw0JPLpHSNekkTskYKCDQLZryTUiCVu GevZwHMXHs3XP5ed+pqCsgPhFb11yZeUIKR5a1eVIp4ZItWe4AaSj9RmjNGEXyoaIgDK aZCI+Q0eBbRSlIbt4Qjnr54N1hlb/F1kA3awBFuvUU1I/eSx8ClFimhyRN92kpvQpseo 0SJOHg+/2hSFWK5+U3Usj0aqKtWgznkUOaJWpgpjpED83KRyYVuzqamTHS+dno3xozBW itcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b="PV+p/k6e"; dkim=pass header.i=@codeaurora.org header.s=default header.b="PV+p/k6e"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11si6497850plb.38.2019.03.21.21.55.25; Thu, 21 Mar 2019 21:56:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b="PV+p/k6e"; dkim=pass header.i=@codeaurora.org header.s=default header.b="PV+p/k6e"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726129AbfCVExX (ORCPT + 99 others); Fri, 22 Mar 2019 00:53:23 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:33440 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725550AbfCVExX (ORCPT ); Fri, 22 Mar 2019 00:53:23 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E300E60C72; Fri, 22 Mar 2019 04:53:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553230402; bh=2V2S0zI3REoNgBHmqjjZbl0J7v7ofo1DgSoFb2MahSw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=PV+p/k6e0a0p2imfrltql/aXm3K5pKY2tQsXPKos3bK/ylpx0HrQYQwue28t3xD8D RUCkQ1OvnaL3wOW5KOky1jeVxtrXmszE9jnnao/5c9/mdvyiQ99LxecBkQ8fHMB1qn z5dcMyddY1PGolRq8ntBo8BoJZ97me3DH63+pvSw= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 179A960E41; Fri, 22 Mar 2019 04:53:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553230402; bh=2V2S0zI3REoNgBHmqjjZbl0J7v7ofo1DgSoFb2MahSw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=PV+p/k6e0a0p2imfrltql/aXm3K5pKY2tQsXPKos3bK/ylpx0HrQYQwue28t3xD8D RUCkQ1OvnaL3wOW5KOky1jeVxtrXmszE9jnnao/5c9/mdvyiQ99LxecBkQ8fHMB1qn z5dcMyddY1PGolRq8ntBo8BoJZ97me3DH63+pvSw= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Fri, 22 Mar 2019 12:53:22 +0800 From: rjliao@codeaurora.org To: Matthias Kaehlcke Cc: Marcel Holtmann , Johan Hedberg , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, Balakrishna Godavarthi , Hemantg Subject: Re: [PATCH] Bluetooth: hci_qca: Fix crash with non-serdev devices In-Reply-To: References: Message-ID: X-Sender: rjliao@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2019-03-14 07:52,Matthias Kaehlcke 写道: > qca_set_baudrate() calls serdev_device_wait_until_sent() assuming that > the HCI is always associated with a serdev device. This isn't true for > ROME controllers instantiated through ldisc, where the call causes a > crash due to a NULL pointer dereferentiation. Only call the function > when we have a serdev device. The timeout for ROME devices at the end > of qca_set_baudrate() is long enough to be reasonably sure that the > command was sent. > > Fixes: fa9ad876b8e0 ("Bluetooth: hci_qca: Add support for Qualcomm > Bluetooth chip wcn3990") > Reported-by: Balakrishna Godavarthi > Reported-by: Rocky Liao > Signed-off-by: Matthias Kaehlcke > --- > drivers/bluetooth/hci_qca.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c > index 4ea995d610d2..714a6a16f9d5 100644 > --- a/drivers/bluetooth/hci_qca.c > +++ b/drivers/bluetooth/hci_qca.c > @@ -1004,7 +1004,8 @@ static int qca_set_baudrate(struct hci_dev > *hdev, uint8_t baudrate) > while (!skb_queue_empty(&qca->txq)) > usleep_range(100, 200); > > - serdev_device_wait_until_sent(hu->serdev, > + if (hu->serdev) > + serdev_device_wait_until_sent(hu->serdev, > msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS)); > > /* Give the controller time to process the request */ Reviewed-by: Rocky Liao Tested-by: Rocky Liao