From patchwork Thu Aug 3 13:25:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maya Erez X-Patchwork-Id: 9879091 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 76FAA603B4 for ; Thu, 3 Aug 2017 13:25:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A8AE288E5 for ; Thu, 3 Aug 2017 13:25:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F083288ED; Thu, 3 Aug 2017 13:25:49 +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 16A91288EC for ; Thu, 3 Aug 2017 13:25:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751719AbdHCNZr (ORCPT ); Thu, 3 Aug 2017 09:25:47 -0400 Received: from sabertooth02.qualcomm.com ([65.197.215.38]:45841 "EHLO sabertooth02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751600AbdHCNZq (ORCPT ); Thu, 3 Aug 2017 09:25:46 -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=1501766746; x=1533302746; h=cc:from:to:subject:date:message-id:in-reply-to: references; bh=HxdMHze1aQ3zBmffTkZPps9fOSRrnYyjroIxgAB6n68=; b=JldsxHJ6NT7gyY7OwqOFTwrXhOPYC6iSHlxwK0nisDpbYEeGk1d+q8eY BHdiLWYYqe1qZulC1x6q57cnhHZAojO8Hz5cHbCZxpd06GmwpnnGAs2N2 pdFjkafPG+U3E3qpsgyxrwJ1vJ2qn3UASBYWQRFY/Z2QBVT/X0Nrx26iv s=; X-IronPort-AV: E=Sophos;i="5.41,316,1498546800"; d="scan'208";a="112982863" Received: from unknown (HELO ironmsg02-R.qualcomm.com) ([10.53.140.106]) by sabertooth02.qualcomm.com with ESMTP; 03 Aug 2017 06:25:46 -0700 Cc: Hamad Kadmany , linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com, Maya Erez , Lior David X-IronPort-AV: E=McAfee;i="5900,7806,8610"; a="1010143016" X-MGA-submission: =?us-ascii?q?MDG/Yjf+RmuKhx0w3X+bgxspdWY3qBUYCuWtH8?= =?us-ascii?q?f8EFjVXS4bahLNAqFpW8IwsKWoKzuVL6g6JB3GQ6+YAOOtcqcAtu4y0j?= =?us-ascii?q?n70A/LBwpGXo2dA9yjS16+RjSWuv7hGRqZUpHaFSwPEp96h0DDviUhEW?= =?us-ascii?q?7+?= Received: from lx-merez1.mea.qualcomm.com ([10.18.173.103]) by ironmsg02-R.qualcomm.com with ESMTP; 03 Aug 2017 06:25:43 -0700 From: Maya Erez To: Kalle Valo Subject: [PATCH v3 1/9] wil6210: protect against invalid length of tx management frame Date: Thu, 3 Aug 2017 16:25:31 +0300 Message-Id: <1501766739-31996-2-git-send-email-qca_merez@qca.qualcomm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1501766739-31996-1-git-send-email-qca_merez@qca.qualcomm.com> References: <1501766739-31996-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: Hamad Kadmany Validate buffer length has the minimum needed size when sending management frame to protect against possible buffer overrun. Signed-off-by: Hamad Kadmany Signed-off-by: Lior David Signed-off-by: Maya Erez --- drivers/net/wireless/ath/wil6210/cfg80211.c | 3 +++ drivers/net/wireless/ath/wil6210/debugfs.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c index 0b5383a..77af749 100644 --- a/drivers/net/wireless/ath/wil6210/cfg80211.c +++ b/drivers/net/wireless/ath/wil6210/cfg80211.c @@ -884,6 +884,9 @@ int wil_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, wil_hex_dump_misc("mgmt tx frame ", DUMP_PREFIX_OFFSET, 16, 1, buf, len, true); + if (len < sizeof(struct ieee80211_hdr_3addr)) + return -EINVAL; + cmd = kmalloc(sizeof(*cmd) + len, GFP_KERNEL); if (!cmd) { rc = -ENOMEM; diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index f82506d..a2b5d59 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -801,6 +801,9 @@ static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf, int rc; void *frame; + if (!len) + return -EINVAL; + frame = memdup_user(buf, len); if (IS_ERR(frame)) return PTR_ERR(frame);