From patchwork Wed Oct 25 13:14:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maya Erez X-Patchwork-Id: 10026687 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 AB1D660375 for ; Wed, 25 Oct 2017 13:14:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB39328B2A for ; Wed, 25 Oct 2017 13:14:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FE0A28B69; Wed, 25 Oct 2017 13:14:30 +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 60DCC28B2A for ; Wed, 25 Oct 2017 13:14:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751902AbdJYNO3 (ORCPT ); Wed, 25 Oct 2017 09:14:29 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:35612 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751863AbdJYNO0 (ORCPT ); Wed, 25 Oct 2017 09:14:26 -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=1508937266; x=1540473266; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=yL2bvORUfRx7Lk30spXPTBTP1eoc1Q29OY231R9rrSo=; b=zIZ+QPbScy8k/i2kZDZtGp5mjxLkTDyzJVcTRK1vKDlYJ8aQtCXqT9MH e+xm772LLQ0aHkmoF2B2XPuk7EFf+p9VIPf0nOj1Xx743LwumY8r5F8ck 5nBAGEmqz23vJL86q8B/u07/xlKGdqqmhdGmxI1xDiXEFCIzgqXocMbqf s=; Received: from ironmsg03-r-new.qualcomm.com (HELO Ironmsg03-R.qualcomm.com) ([10.53.140.107]) by alexa-out.qualcomm.com with ESMTP; 25 Oct 2017 06:14:26 -0700 X-IronPort-AV: E=McAfee;i="5900,7806,8694"; a="1469080400" X-MGA-submission: =?us-ascii?q?MDHBcG9RcmhmpvuspgHg7vuZji6XF1whn+tvWF?= =?us-ascii?q?xsgFhEFUnWpKex7n4Ehss8obKkIWmz4qBVuONQiok0PXBsKNs+PoTeii?= =?us-ascii?q?Iz6w2d2SbUBskSJ9XOvkH+n8v6HLMMQTjtUa/UHvAFHIwt3mtyh/t2Tb?= =?us-ascii?q?dw?= Received: from lx-merez1.mea.qualcomm.com ([10.18.173.103]) by Ironmsg03-R.qualcomm.com with ESMTP; 25 Oct 2017 06:14:24 -0700 From: Maya Erez To: Kalle Valo Cc: Lior David , linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com, Maya Erez Subject: [PATCH 07/12] wil6210: missing length check in wmi_set_ie Date: Wed, 25 Oct 2017 16:14:02 +0300 Message-Id: <1508937247-11890-8-git-send-email-qca_merez@qca.qualcomm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508937247-11890-1-git-send-email-qca_merez@qca.qualcomm.com> References: <1508937247-11890-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;