Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1020749ybe; Wed, 4 Sep 2019 11:15:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyectEXGgXkYcCGPPVZY6YhtgGVofRUh1pZTB9nPjo/9JSrHK3lDe6eXaZJ61pf2OtQokeA X-Received: by 2002:a62:60c7:: with SMTP id u190mr48254962pfb.54.1567620913808; Wed, 04 Sep 2019 11:15:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567620913; cv=none; d=google.com; s=arc-20160816; b=nEMQMROd5q2gkEo3zZ0+OtU9JINh86ZeXwItzRn4z8KzzUJSosCfvkXpPZLOoBr4WS jQEkF9Jfm5t8Y6Iixe5soRhzNkvNvtZ9ZoU/mwhxxoXhuXky2IwQlzJqPQp63vgVWzrc 7eSyW8wvUyanBe6nWrYcOrMpvEb4zrhCHEdrDpZJNdLSmyF/JjLgmiYREA1GvpQOx/hT 8Mye8sitF3qWG/lPBSbnoRFPsACxPMD99RmtsrVjfzadpmzhGGR5Gp6Ii9d7xkM9/Wci rRGg9qvQl9AFR25gHVQWfFR4R/e75+4FafTWdssS5fw930YDlt88JNoyJk5PM5N79EG/ vxmQ== 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=C+crZiqMlWvOVEVIdyyv55OsP4CYntL1AId2nz0KOuU=; b=c7BEvagVIrO6xcLL0jna89+4VYRQ38L1M5dICJYSMxA+Ol2g+yGk7w8p6IElw2xCqk HCpN6FxwpJo7z3NiT1BGZCIX2QC8VAIrgUdUrRTjHAesmzdLYcEo2GbBtTBkRwXvvU47 07sb2kJjAh2qoRw6eOg3uleq7ACdO92QRo66yWXfXVtTlHHz0zZ1Qv3HF3KyjFnSsqtU B0DczXSyGiRepPTG2CXl6H0pRf4NlOb0aofE1QdvWMbBifIIpxHy3wXy3pKa5wxwOv3N gDYWWa13vp6/cAss0/sEh7m3v73JMaYjRhR3QMad8FJl6FVkI8wdFpoUgJ8BWk3cLDr5 nrOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eZABwiQk; 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 z199si8586673pfc.283.2019.09.04.11.14.58; Wed, 04 Sep 2019 11:15:13 -0700 (PDT) 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=eZABwiQk; 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 S2390500AbfIDSMY (ORCPT + 99 others); Wed, 4 Sep 2019 14:12:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:56730 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390483AbfIDSMW (ORCPT ); Wed, 4 Sep 2019 14:12:22 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 9A4B2208E4; Wed, 4 Sep 2019 18:12:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620742; bh=JGrzN6UeZqnNk2EPqbW69dSFxVo/JYTqdlEC7Nk+WQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eZABwiQk8lpyN2X19jM9S0dnHjJ7EBRmZyHADVBs1Pk8TcteL81KALqRwQ/FHLrtn hb49g30Ss+qsjj+p4VL9Rf0/da7NhzXcyUnuoeVVVH1dBMiPWuD5MArrYFSL+QXLQh Rhb2eBy76HRSm/osGOQ0LkDaWcz43eGxAbrZ54iA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Neukum Subject: [PATCH 5.2 078/143] usbtmc: more sanity checking for packet size Date: Wed, 4 Sep 2019 19:53:41 +0200 Message-Id: <20190904175317.111350107@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175314.206239922@linuxfoundation.org> References: <20190904175314.206239922@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Oliver Neukum commit de7b9aa633b693e77942e12f1769506efae6917b upstream. A malicious device can make the driver divide ny zero with a nonsense maximum packet size. Signed-off-by: Oliver Neukum Cc: stable Link: https://lore.kernel.org/r/20190820092826.17694-1-oneukum@suse.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/class/usbtmc.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class/usbtmc.c @@ -2362,8 +2362,11 @@ static int usbtmc_probe(struct usb_inter goto err_put; } + retcode = -EINVAL; data->bulk_in = bulk_in->bEndpointAddress; data->wMaxPacketSize = usb_endpoint_maxp(bulk_in); + if (!data->wMaxPacketSize) + goto err_put; dev_dbg(&intf->dev, "Found bulk in endpoint at %u\n", data->bulk_in); data->bulk_out = bulk_out->bEndpointAddress;