From patchwork Tue Nov 14 13:25:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maya Erez X-Patchwork-Id: 10057637 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 65775601D3 for ; Tue, 14 Nov 2017 13:26:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B1E728F6C for ; Tue, 14 Nov 2017 13:26:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5047829033; Tue, 14 Nov 2017 13:26:08 +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 3DF5728FA1 for ; Tue, 14 Nov 2017 13:26:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755381AbdKNN0G (ORCPT ); Tue, 14 Nov 2017 08:26:06 -0500 Received: from sabertooth01.qualcomm.com ([65.197.215.72]:54358 "EHLO sabertooth01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755363AbdKNN0A (ORCPT ); Tue, 14 Nov 2017 08:26:00 -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=1510665960; x=1542201960; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=yL2bvORUfRx7Lk30spXPTBTP1eoc1Q29OY231R9rrSo=; b=LI/0uT+MtrPSyMlGNsKolejU3JAmliF8lmBEimMJV08l2iXupzAQus7O +ECiC1RmzIq8dmTjO0cA1NvW2gPcvHWTjednGL2xvKhsWDy4yQ3HGhcwA SegZ0fZeQJ7nfFT6yKx1VzSL7OichngxzZQkofDkWP5062ysOBEl+zEsl g=; X-IronPort-AV: E=Sophos;i="5.44,393,1505804400"; d="scan'208";a="116748183" Received: from unknown (HELO Ironmsg04-L.qualcomm.com) ([10.53.140.111]) by sabertooth01.qualcomm.com with ESMTP; 14 Nov 2017 05:26:00 -0800 X-IronPort-AV: E=McAfee;i="5900,7806,8714"; a="1464221503" X-MGA-submission: =?us-ascii?q?MDGGzAR+Rs6vrYSE4MQ0RBpulMoKrjAbftI7hQ?= =?us-ascii?q?myAN3DsshNBSoEOJoRd/7NXg6BCMwv02aK0yCzBd6xXqDN4ofPhNh27j?= =?us-ascii?q?quYw+UPqV9skNR73eiBVmM5z6xJ32ZD3cIq4mMb2t06gH4vLhJRjmLGl?= =?us-ascii?q?UP?= Received: from lx-merez1.mea.qualcomm.com ([10.18.173.103]) by Ironmsg04-L.qualcomm.com with ESMTP; 14 Nov 2017 05:25:58 -0800 From: Maya Erez To: Kalle Valo Cc: Lior David , linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com, Maya Erez Subject: [PATCH v3 07/12] wil6210: missing length check in wmi_set_ie Date: Tue, 14 Nov 2017 15:25:39 +0200 Message-Id: <1510665944-30198-8-git-send-email-qca_merez@qca.qualcomm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1510665944-30198-1-git-send-email-qca_merez@qca.qualcomm.com> References: <1510665944-30198-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;