Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754110AbdFSPdy (ORCPT ); Mon, 19 Jun 2017 11:33:54 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44308 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750733AbdFSPdu (ORCPT ); Mon, 19 Jun 2017 11:33:50 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter Subject: [PATCH 3.18 18/32] staging: rtl8188eu: prevent an underflow in rtw_check_beacon_data() Date: Mon, 19 Jun 2017 23:21:02 +0800 Message-Id: <20170619152036.714916668@linuxfoundation.org> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170619152035.750974520@linuxfoundation.org> References: <20170619152035.750974520@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 862 Lines: 30 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter commit 784047eb2d3405a35087af70cba46170c5576b25 upstream. The "len" could be as low as -14 so we should check for negatives. Fixes: 9a7fe54ddc3a ("staging: r8188eu: Add source files for new driver - part 1") Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_ap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -873,7 +873,7 @@ int rtw_check_beacon_data(struct adapter return _FAIL; - if (len > MAX_IE_SZ) + if (len < 0 || len > MAX_IE_SZ) return _FAIL; pbss_network->IELength = len;