From patchwork Wed Mar 11 13:37:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 5985141 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 19D149F318 for ; Wed, 11 Mar 2015 13:39:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 47FC2202AE for ; Wed, 11 Mar 2015 13:39:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7130120125 for ; Wed, 11 Mar 2015 13:39:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752817AbbCKNja (ORCPT ); Wed, 11 Mar 2015 09:39:30 -0400 Received: from mail-lb0-f182.google.com ([209.85.217.182]:41107 "EHLO mail-lb0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751943AbbCKNj2 (ORCPT ); Wed, 11 Mar 2015 09:39:28 -0400 Received: by lbvp9 with SMTP id p9so8873622lbv.8 for ; Wed, 11 Mar 2015 06:39:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id; bh=/eklo4TEZc5zawY/nyef4lx1DSZODMPtIbjPr5YMwbo=; b=3+Hkc2DJJEVTWKbnHhH+vaSZkRtyZxdIF1R7lg+apQtjEgK7kupPVGrbbhhY8+9wKe 6w6BqghXtMigUvz9xluSAWMneigFNJKWZataONtDzhaMPW/wct1CIMSG7/p/8iOAeVJ1 giz8MrNywXN9445RJxONhgkwiAvYiUxwKN+P0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/eklo4TEZc5zawY/nyef4lx1DSZODMPtIbjPr5YMwbo=; b=HCj7/70cmT9UkK8yrvNgA0jB7vhi0PvpsicwZ2c2gS/vcHpX5kBL+xQPVPj/0+/PTt uMSe6C6pDc4aeFC//iGCaA5rDxn/insKiZCV5P8CdzRYSvAvrPTZbq9opXGnZnUyxs7n 5ycvzyQQHuzw2HeFmyIx3VTd39qCBsYpJ03LTk91cSF3YLQvxLEOakcW4LvqzazAHbV5 HzUoVLQve6DrxNFCAeDyWERP29I0Frkr5P08HNASXtBCQ0AU4QidNKyNw3jf9CSofp9T XOZ1vvu4EGenqJHQKvbVEqGuOB4UeXJU+uqOpuyGhQeOFPBIXeQJpFxB5Kd61r5rSs1w ahJA== X-Gm-Message-State: ALoCoQmPLAFKdD9d0+Sgpks05ql16fKAHHC9/7KuE0cFFlNHP+YDe4zhTDsgdPUdmgdj3xCDXjEVY9yeDa1kHeVm+vf6bSUIMgjFH7SgrMnVHIMlCi93MzGHY7coJ2PIz+I4z48BI3Og X-Received: by 10.152.206.7 with SMTP id lk7mr35278838lac.55.1426081166864; Wed, 11 Mar 2015 06:39:26 -0700 (PDT) Received: from localhost.localdomain ([91.198.246.8]) by mx.google.com with ESMTPSA id iy9sm734769lbc.8.2015.03.11.06.39.25 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Mar 2015 06:39:26 -0700 (PDT) From: Michal Kazior To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Michal Kazior Subject: [PATCH] ath10k: protect driver from unsolicited htc ep0 events Date: Wed, 11 Mar 2015 14:37:11 +0100 Message-Id: <1426081031-15296-1-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 X-DomainID: tieto.com Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some firmware revisions (tested with qca6174 rm2.0-00088) deliver unsolicited unknown (kind of garbled) HTC ep0 event to host in some cases. This issue was mainly observed with both qca988x and qca6174 being installed on a single host system. During driver probing if qca6174 booting sequences were somehow deferred (e.g. by qca988x implicitly making some resources busy presumably) the unsolicited event would came around 1s after ATH10K_HTC_MSG_READY_ID was delivered to host for qca6174. The unsolicited event would confuse driver and cause HTT initialization (and subsequently driver probing) to fail. Make the ep0 event processing more robust. The event will still be caught but instead will only generate a warning now. Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/htc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c index 2fd9e18..d33d5c4 100644 --- a/drivers/net/wireless/ath/ath10k/htc.c +++ b/drivers/net/wireless/ath/ath10k/htc.c @@ -414,7 +414,8 @@ static int ath10k_htc_rx_completion_handler(struct ath10k *ar, struct ath10k_htc_msg *msg = (struct ath10k_htc_msg *)skb->data; switch (__le16_to_cpu(msg->hdr.message_id)) { - default: + case ATH10K_HTC_MSG_READY_ID: + case ATH10K_HTC_MSG_CONNECT_SERVICE_RESP_ID: /* handle HTC control message */ if (completion_done(&htc->ctl_resp)) { /* @@ -438,6 +439,10 @@ static int ath10k_htc_rx_completion_handler(struct ath10k *ar, break; case ATH10K_HTC_MSG_SEND_SUSPEND_COMPLETE: htc->htc_ops.target_send_suspend_complete(ar); + break; + default: + ath10k_warn(ar, "ignoring unsolicited htc ep0 event\n"); + break; } goto out; }