Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp25583yba; Mon, 1 Apr 2019 00:43:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzn5aLxnNJ2vrkLDLbNtjm/RHXsKzDf8p96o+id9cai1NMUHhQZcAEh49wAEoQOU8irEZhO X-Received: by 2002:a65:6559:: with SMTP id a25mr54294638pgw.99.1554104584602; Mon, 01 Apr 2019 00:43:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554104584; cv=none; d=google.com; s=arc-20160816; b=qK842blQggFIudcj+nCDHD03MEpCvVj4DCsZxaYP9ehM4Gqfeaf7K8ND1aLVSZie/+ iWkH0qAjQLAFFf4oxUFMqniY8fgMtFnl1/D/0J9gaBwyWo9G9tXSGTeOoTmF1G4eu1Jk FEY4/zYIwIaLcoRXsYo3HXrPYIlZR0QKUHh/BtgXuDgVmyI8cm4/Y1cljvlPwqHqc7jH kouSWY7ESYwL+p2OHyzBzG0htwFm7x7eu9KXXWboUMn/WdiibTqR1I+I9CS188KfpQFw TZcVIQ2eW/MZ9NJJPAlLiFNRYX4NrR3XaJi7BvXb+M61cI52l7Ny6fEd6b81hLoWNTqv FjjQ== 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=+NsF/ZnuR61Z8M9aR97M+5H5y91yaUunpix9Xa6I+/M=; b=qlSkcs1cOM8VOPZWsr/lkVU/n2iI4T3/4Rhjk3CGZ5p6Rfh5obPXJayIev3uIkiywo 9Xfsb7mtMmC3d4dCmpGjIOkpYh39c+IZ0ftp32UfiOthbD3da1PofA9qXNjC87Jlp+qR Qh24n1QbJlGCQo+hk25icFSDBvryjzqCwu22eMniPQYs1UC0IAQEzHfLx0lndaGT6N4e 6vPt6x8IJjUu6sikhV0ZgerSnro7Hxjp9GpewUYniHhW13zjTayXqT/r0cr/tV9ebcxp R9N9s/6WR8VAMVJkGGt8Q0bJRmat/GgQRLoKOpGIjdkdNKk9g3owrakBvDfq27skHHvX p27A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=TvMzJSw7; dkim=pass header.i=@codeaurora.org header.s=default header.b=Tr1EWSSG; 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 k4si6782686pgq.208.2019.04.01.00.42.48; Mon, 01 Apr 2019 00:43:04 -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=TvMzJSw7; dkim=pass header.i=@codeaurora.org header.s=default header.b=Tr1EWSSG; 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 S1731968AbfDAHmN (ORCPT + 99 others); Mon, 1 Apr 2019 03:42:13 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:60566 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731833AbfDAHmN (ORCPT ); Mon, 1 Apr 2019 03:42:13 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 6FCF660712; Mon, 1 Apr 2019 07:42:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1554104532; bh=hq7+NJgj2eFnI1NLy1dFFDZsFdTXdmlukyWMrifKSQM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=TvMzJSw7fAUK2WHS3sMwzeTG84Wl4nMudbFJxmkC5rk+LHT/FHhYZQW12mSeVwTPs cKpHAUK3Yw5uA1ZFtOe0eA0Y8n/sA7XhxMxK58eX9Na0z7o7+0kyAueoiAvy8c4/Mt 6+TyWb5odsk2cWMnBPdi6diIV2LjtKlVqB4YYVFI= 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 C79B560712; Mon, 1 Apr 2019 07:42:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1554104531; bh=hq7+NJgj2eFnI1NLy1dFFDZsFdTXdmlukyWMrifKSQM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Tr1EWSSGgDqJ3kNPze5jmrMz15OIAsxRwiAC9Ou8NLWVc3ig0kcKnsmW19qWbWBdD 13Up4lvQdPOQjUjirsCpd29USqtrZCst0NdFit/dhezgmy8My3gY0029aBTSLfLSHh uaeoxwXh+S7DUNt53DhlDB8pAD2kLx9sXQ4uCJ24= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 01 Apr 2019 13:12:11 +0530 From: Balakrishna Godavarthi To: Matthias Kaehlcke Cc: Marcel Holtmann , Johan Hedberg , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, Hemantg , Rocky Liao Subject: Re: [PATCH] Bluetooth: hci_qca: Fix crash with non-serdev devices In-Reply-To: References: Message-ID: X-Sender: bgodavar@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 On 2019-03-14 05:22, Matthias Kaehlcke wrote: > 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: Balakrishna Godavarthi -- Regards Balakrishna.