From patchwork Thu Aug 3 19:08:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maya Erez X-Patchwork-Id: 9879755 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 08D3D603F4 for ; Thu, 3 Aug 2017 19:09:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EEA922892C for ; Thu, 3 Aug 2017 19:09:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E387F28961; Thu, 3 Aug 2017 19:09:19 +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 6DC282892C for ; Thu, 3 Aug 2017 19:09:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751860AbdHCTIc (ORCPT ); Thu, 3 Aug 2017 15:08:32 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:49050 "EHLO alexa-out-lv-02.qualcomm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751600AbdHCTIa (ORCPT ); Thu, 3 Aug 2017 15:08:30 -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=1501787310; x=1533323310; h=cc:from:to:subject:date:message-id:in-reply-to: references; bh=HxdMHze1aQ3zBmffTkZPps9fOSRrnYyjroIxgAB6n68=; b=f+MkaJplv2bJR5EIse1GJAXLC4Lc6bIG1aCetoVl5tNuZY4f8b7w+t8k 75WFfb/PGkGLBfGUfdd9mT14RW7yTgFGOyiGTB3joKARsV4VL782ZTRts Ck/+7TVe/5/o4WJIwO+2Ig5kHZO6Cs8PVjz0KgOHOoCr3/1l9I9fzhFRQ Y=; X-IronPort-AV: E=Sophos;i="5.41,317,1498546800"; d="scan'208";a="2484433" Received: from ironmsg03-r-new.qualcomm.com (HELO Ironmsg03-R.qualcomm.com) ([10.53.140.107]) by alexa-out-lv-02.qualcomm.com with ESMTP; 03 Aug 2017 12:08:30 -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="1417424167" X-MGA-submission: =?us-ascii?q?MDH/uVMVSxgQOuzaCyU0/PVh2nndTkdD2FZ18W?= =?us-ascii?q?umRnoIqHthFYzN+oi7EcEJqdDNHRsn26eypgtzhSCcSf/q04UR07EcAZ?= =?us-ascii?q?J8bEsiJH4Gt7CYAh5VYNigO4ORXtvHOK8TMg0uRkcQ7qi7Cc4atdeVfF?= =?us-ascii?q?YG?= Received: from lx-merez1.mea.qualcomm.com ([10.18.173.103]) by Ironmsg03-R.qualcomm.com with ESMTP; 03 Aug 2017 12:08:28 -0700 From: Maya Erez To: Kalle Valo Subject: [PATCH v4 01/10] wil6210: protect against invalid length of tx management frame Date: Thu, 3 Aug 2017 22:08:13 +0300 Message-Id: <1501787302-22885-2-git-send-email-qca_merez@qca.qualcomm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1501787302-22885-1-git-send-email-qca_merez@qca.qualcomm.com> References: <1501787302-22885-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);