From patchwork Wed Jan 11 16:12:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maya Erez X-Patchwork-Id: 9510555 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2D1E56075C for ; Wed, 11 Jan 2017 16:14:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CB4E28577 for ; Wed, 11 Jan 2017 16:14:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F9F7285E5; Wed, 11 Jan 2017 16:14:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 682CB28577 for ; Wed, 11 Jan 2017 16:14:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764710AbdAKQOB (ORCPT ); Wed, 11 Jan 2017 11:14:01 -0500 Received: from wolverine02.qualcomm.com ([199.106.114.251]:15294 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755581AbdAKQN4 (ORCPT ); Wed, 11 Jan 2017 11:13:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1484151236; x=1515687236; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Kbkdk+7UKHkHsknXsI145Ek6IA5VOQ89YlahsPyIHjY=; b=xdt/J40UxqttY+6kApVyurxwbAxQCjIzQPqy0fwRwKEn9wNsBejvJfmi pyrIqKfUd/KrLIrDotBws2uh703MR1krmgnIFn1tHWi7t/vHfDpz9AbwD KZXXc46v+gYxDmV2ktNyG0PC+voeTwfqhi+VaUBixT5RT3xcL3FzsTP7G U=; X-IronPort-AV: E=Sophos;i="5.33,346,1477983600"; d="scan'208";a="350066649" Received: from unknown (HELO Ironmsg04-R.qualcomm.com) ([10.53.140.108]) by wolverine02.qualcomm.com with ESMTP; 11 Jan 2017 08:13:07 -0800 X-IronPort-AV: E=McAfee;i="5700,7163,8405"; a="1343044456" X-Amp-Result: SKIPPED(no attachment in message) Received: from lx-merez1.mea.qualcomm.com ([10.18.173.103]) by Ironmsg04-R.qualcomm.com with ESMTP; 11 Jan 2017 08:13:05 -0800 From: Maya Erez To: Kalle Valo Cc: Lior David , linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com, Maya Erez Subject: [PATCH 06/12] wil6210: missing reinit_completion in wmi_call Date: Wed, 11 Jan 2017 18:12:42 +0200 Message-Id: <1484151168-894-7-git-send-email-qca_merez@qca.qualcomm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1484151168-894-1-git-send-email-qca_merez@qca.qualcomm.com> References: <1484151168-894-1-git-send-email-qca_merez@qca.qualcomm.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Lior David The code in wmi_call uses the wil->wmi_call completion structure to wait for a reply. In some scenarios, complete was called twice on the completion structure. This happened mainly with a disconnect event which can arrive both unsolicited and as a reply to a disconnect request. In this case the completion structure was left marked as "done" and the next wmi_call returned immediately with a corrupted reply buffer. This caused unexpected results including crashes. Fix this by adding the missing call to reinit_completion. Signed-off-by: Lior David Signed-off-by: Maya Erez --- drivers/net/wireless/ath/wil6210/wmi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c index 585a0ec..7f13b09 100644 --- a/drivers/net/wireless/ath/wil6210/wmi.c +++ b/drivers/net/wireless/ath/wil6210/wmi.c @@ -957,6 +957,7 @@ int wmi_call(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len, wil->reply_id = reply_id; wil->reply_buf = reply; wil->reply_size = reply_size; + reinit_completion(&wil->wmi_call); spin_unlock(&wil->wmi_ev_lock); rc = __wmi_send(wil, cmdid, buf, len);