Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3485425imu; Sun, 11 Nov 2018 16:10:17 -0800 (PST) X-Google-Smtp-Source: AJdET5f/jvJaOcfmvL7saz50/e5jWzP0gveWT3Vs6LjBCVmKTTV5V3yZyt3AduH9u7B26yB1uTw6 X-Received: by 2002:a63:cb4a:: with SMTP id m10mr15082678pgi.105.1541981417108; Sun, 11 Nov 2018 16:10:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981417; cv=none; d=google.com; s=arc-20160816; b=iUqTo5YxEDR1Mho2+KaIBayF5OE3zOsWlQ5wFliBdWGbqsefcSEpgEwpVRIZNvw53L HAYag1tcO6jlQdbtv9wcQyQs+IWoSv0x7dV6EOEYMCT7WtBtBmshcLLd2INml3Giosoq Qa+XgtSofy2EeUTUgO7BE5Wsc5gbu5VixTYwL1wgW3jSuGGvK7k0TMo1NH3IhVZpm57i 4E+VC93rmW3jwfE8TEsrTZOvRJSvjWsiBHI+cbEXO7aWhNqTUrDhh8VEnm024tWyCVHN AxDpawjPlzbJgrqQoLZfi0XabtqXYfH/5BX7+LJhHy2WWqHDwXsZm1rdMQmzMrJhhmJr Y+hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KSpNSKyRj1C64i+o4WJ0sDSIy5jmtQskH2UkG7+hX+8=; b=mQGNrvtuuZVhdc0wLXhiESpJpYuCt2atyTPbOwfUfVgUsD5Oh9MYKn92Cj8ABP87ZJ CmDAp8/y3zPyERRJWJKDh7XXpMvfFWdNkurjUfX8vjMZi8ludG9x2VXbp8Ex8VvpHdMV lb+PNjEvTOCZ6nGROse2C4vzVSahhyXErxoJmBRAbDzhGqKMXSLimyPFKsodHEoH9Qis QZPsej18EeK2Z1S/q/N5bQQVFNAKyg46eL6uxSAqBoSvLGXXseCst3Qe4onzo+1LDLzE tRAKWqgkN1epH+T8TEpIQ0fXNs1YyxiB0NmXSLaQkX8n7M67Cf9vrMy1GtMsbfY5wizr pXxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=u73oIek8; 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 u11-v6si14689606pgh.55.2018.11.11.16.10.02; Sun, 11 Nov 2018 16:10:17 -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; dkim=pass header.i=@kernel.org header.s=default header.b=u73oIek8; 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 S1732048AbeKLKAK (ORCPT + 99 others); Mon, 12 Nov 2018 05:00:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:60776 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730892AbeKLIR2 (ORCPT ); Mon, 12 Nov 2018 03:17:28 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DD8D5208A3; Sun, 11 Nov 2018 22:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975252; bh=MA/iscuvTDBDIOqtgdXXBolgEbWmjH9NRUADkodB79g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u73oIek83XcYoWTE4l+9rtbbPEnQTkx7rJooofIgKkqc6fqBWpbZ/oE6AB/Ja7Awy rZ3hmbnZE6M5gaKLZM/+SgROQAugVmmv9cXUUajiTkYt7O47Y3+atDcDUzwZ06krty KwAWrz7i5wtFUuYRfpl6ryG2+9Xcb5S5h5Y5Xwus= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 120/361] libertas_tf: prevent underflow in process_cmdrequest() Date: Sun, 11 Nov 2018 14:17:47 -0800 Message-Id: <20181111221636.854982070@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit 3348ef6a6a126706d6a73ed40c18d8033df72783 ] If recvlength is less than MESSAGE_HEADER_LEN (4) we would end up corrupting memory. Fixes: c305a19a0d0a ("libertas_tf: usb specific functions") Signed-off-by: Dan Carpenter Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/marvell/libertas_tf/if_usb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/net/wireless/marvell/libertas_tf/if_usb.c +++ b/drivers/net/wireless/marvell/libertas_tf/if_usb.c @@ -605,9 +605,10 @@ static inline void process_cmdrequest(in { unsigned long flags; - if (recvlength > LBS_CMD_BUFFER_SIZE) { + if (recvlength < MESSAGE_HEADER_LEN || + recvlength > LBS_CMD_BUFFER_SIZE) { lbtf_deb_usbd(&cardp->udev->dev, - "The receive buffer is too large\n"); + "The receive buffer is invalid: %d\n", recvlength); kfree_skb(skb); return; }