Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3338277imu; Sun, 11 Nov 2018 12:42:10 -0800 (PST) X-Google-Smtp-Source: AJdET5dy65vFPO1DaGQ72ESD6oAzLrutDP98UADxxWdM2gFhOgUI6z705gOQttu0YXLbFnHBaYiL X-Received: by 2002:a62:5615:: with SMTP id k21-v6mr17284744pfb.190.1541968930087; Sun, 11 Nov 2018 12:42:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541968930; cv=none; d=google.com; s=arc-20160816; b=qARZ0VIIPou8UN9CVChDeNqaXox7uPuazLdP7cgyGiffRwtqKdQWlMGOX1hkNV0Wao ncVY8X5z/mkDpzZqRX34HvE+8IR1oeYyYulB2sTDYI/GJO15sClPIsUDIGO/TvcsM9O2 RmqZeqWdjapmZi9/jsDBcWyseUVReoCsUREpmUrCtIXkIr4MS2oa54xxe4kg7rtaOTcl 8vC+zozwBndEmmFv1HVaNbmDMiNPui8NqnCVk30K54x3o47j9TF1W1lynpPwIaX9JdZT A5AO/LyWLR139bogUvs7Of0uWYEHskJuxjHyfHgYf+SRWs4OEJ+f2tQCN2IwYveTACrG JprQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=HX+XTW5ZdZu86RcMWsc/S2/OPMUglLZngREKUiNyn9M=; b=fuzUBVsmi0tk0NGLVhh5ixZF+nMW0c+RjnWQ4CyeF2NtASQs5ZB+3AaGrSGg4Kcn49 N3ir9Kop5BrnQmFPaHU1ya+V1qgNX8oFyt1w4Po4lWi2uHCJAzVOmuRjUFVdHDegIvyu rLLHva6YmDyMuVMn1eyOkrw89BxVpuNmWoCTf5SL7hM327lVP2Lc1vmw3Gv6B8H/L01g 4OV3Wx52CICrfIigmqvfZAK6U+HJX4ajlE3f/dWg+Us0GgLvJqYYaSlJBBxb1oo+nbHQ IV2TzWlajks8ToSqc72lwc76IELPBtbY1+lChnfvPxN2EORwK/cmYWVPfaFqiLPG1cmh lbxQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m12-v6si4385142pfi.286.2018.11.11.12.41.55; Sun, 11 Nov 2018 12:42:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729955AbeKLFsF (ORCPT + 99 others); Mon, 12 Nov 2018 00:48:05 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:49410 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729854AbeKLFsD (ORCPT ); Mon, 12 Nov 2018 00:48:03 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvsQ-0000l8-BX; Sun, 11 Nov 2018 19:58:34 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsO-0001O2-35; Sun, 11 Nov 2018 19:58:32 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Kalle Valo" , "Dan Carpenter" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 025/366] mwifiex: pcie: tighten a check in mwifiex_pcie_process_event_ready() In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter commit 01eca2842874b9a85b7cd1e1b0e5b34a5d53a21f upstream. If "evt_len" is 1 then we try to memcpy() negative 3 bytes and it would cause memory corruption. Fixes: d930faee141b ("mwifiex: add support for Marvell pcie8766 chipset") Signed-off-by: Dan Carpenter Signed-off-by: Kalle Valo [bwh: Backported to 3.16: adjust filename] Signed-off-by: Ben Hutchings --- drivers/net/wireless/mwifiex/pcie.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/wireless/mwifiex/pcie.c +++ b/drivers/net/wireless/mwifiex/pcie.c @@ -1692,7 +1692,8 @@ static int mwifiex_pcie_process_event_re skb_pull(skb_cmd, INTF_HEADER_LEN); dev_dbg(adapter->dev, "info: Event length: %d\n", evt_len); - if ((evt_len > 0) && (evt_len < MAX_EVENT_SIZE)) + if (evt_len > MWIFIEX_EVENT_HEADER_LEN && + evt_len < MAX_EVENT_SIZE) memcpy(adapter->event_body, skb_cmd->data + MWIFIEX_EVENT_HEADER_LEN, evt_len - MWIFIEX_EVENT_HEADER_LEN);