From patchwork Wed Nov 1 19:23:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maya Erez X-Patchwork-Id: 10036935 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 BD5C26032D for ; Wed, 1 Nov 2017 19:23:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3E1528505 for ; Wed, 1 Nov 2017 19:23:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8D692861C; Wed, 1 Nov 2017 19:23:43 +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 64EEF28505 for ; Wed, 1 Nov 2017 19:23:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933207AbdKATXl (ORCPT ); Wed, 1 Nov 2017 15:23:41 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:64767 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933147AbdKATXj (ORCPT ); Wed, 1 Nov 2017 15:23:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1509564219; x=1541100219; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=yL2bvORUfRx7Lk30spXPTBTP1eoc1Q29OY231R9rrSo=; b=fsSwOxlg0pW8e0ryKFvjb3Z8Pf5XTF6sLlOlF3LPz26sCG9johMhbkIx qYtNwQIxHV0Vr7MmT1VgK9oUPlnp2Qp/tSWMbUwPeB1JweQAnCBFSQ3sL lgHTi3zys59XPtDzMy9x0A5M3lygeb5E1BVz0QU44rU++P+191XKvRfwI Y=; Received: from ironmsg04-r-new.qualcomm.com (HELO Ironmsg04-R.qualcomm.com) ([10.53.140.108]) by alexa-out.qualcomm.com with ESMTP; 01 Nov 2017 12:23:39 -0700 X-IronPort-AV: E=McAfee;i="5900,7806,8702"; a="1524931147" X-MGA-submission: =?us-ascii?q?MDHbdxDUyExYYMgfyX8h26GYWXj/s/h8DYFIYN?= =?us-ascii?q?2HS6D4bX0dskganxntgTI7jLdZusV2Ynm4e1+XabGLACsHLA0Em6kecs?= =?us-ascii?q?UcmfZ3nW58vVbUOGZxcKWm1XVnTFrjBWqVG6gZDZ+S0fCFyI9dVbctoE?= =?us-ascii?q?s6?= Received: from lx-merez1.mea.qualcomm.com ([10.18.173.103]) by Ironmsg04-R.qualcomm.com with ESMTP; 01 Nov 2017 12:23:37 -0700 From: Maya Erez To: Kalle Valo Cc: Lior David , linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com, Maya Erez Subject: [PATCH v2 07/12] wil6210: missing length check in wmi_set_ie Date: Wed, 1 Nov 2017 21:23:17 +0200 Message-Id: <1509564202-30078-8-git-send-email-qca_merez@qca.qualcomm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1509564202-30078-1-git-send-email-qca_merez@qca.qualcomm.com> References: <1509564202-30078-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 Add a length check in wmi_set_ie to detect unsigned integer overflow. Signed-off-by: Lior David Signed-off-by: Maya Erez --- drivers/net/wireless/ath/wil6210/wmi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c index 16aa624..dd25f63 100644 --- a/drivers/net/wireless/ath/wil6210/wmi.c +++ b/drivers/net/wireless/ath/wil6210/wmi.c @@ -1616,8 +1616,14 @@ int wmi_set_ie(struct wil6210_priv *wil, u8 type, u16 ie_len, const void *ie) }; int rc; u16 len = sizeof(struct wmi_set_appie_cmd) + ie_len; - struct wmi_set_appie_cmd *cmd = kzalloc(len, GFP_KERNEL); + struct wmi_set_appie_cmd *cmd; + if (len < ie_len) { + rc = -EINVAL; + goto out; + } + + cmd = kzalloc(len, GFP_KERNEL); if (!cmd) { rc = -ENOMEM; goto out;