Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2093606ybl; Thu, 30 Jan 2020 11:14:33 -0800 (PST) X-Google-Smtp-Source: APXvYqxrg3rigT/99tHi8oasXba0Gvx+bPt8o1f7tJctSEfY6u+i8SIe/sEX+BkFRwN0EFZmbUW3 X-Received: by 2002:aca:eb14:: with SMTP id j20mr3769210oih.12.1580411672610; Thu, 30 Jan 2020 11:14:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580411672; cv=none; d=google.com; s=arc-20160816; b=GMsEooicNgwRnbXGh91gYY7Cfd1qKN7XHeF1p+8VNukRuFDO9jtoQCRYO6q2R+1gnc 75PKRwDlt1/oGahZFcu4+Kw1jR5LUQReca3FCmjeCBiOpw9bsJ/tLQKzYlQ7ChsVU/yH 6NmLe78A53PSEciLVOxH84wM73EYLR0VXS/PN8onc8/d7xZ7AvuTXrmib4I8m3e66FVG u3weTNgLegXHs21NOzSzkpgdVgjVliceyaHNxTe0NONz3QvrSUXeMLMvH7ryql2FQFFB d8WbFoweog0zGycLTavLGoiKYBOAumTm2HEVzc58p7zp4kIkPabRRktAWgd2BD52XkEN pnjg== 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=gQzbWoS31hLY4zI/DW0FL0sM6+femMSzlah8hkY6L5M=; b=nJty5X1TjNZaujKw7nf2o6wi5FDxm5xG3J0i3Ss6Vsf2joYBW0rRWU44z81oYOXT1Q dqb6h/t1e5BNQ6+2irBy4ENi6zuvTn/w5G9W96F5Yp472BB8vfOuGaKmLpGMou36dZOj tCf++Ht7iDD4p3gTHlpb7pjDcWcbf7vM67Zci9pVr9N4wqb30FyTDOqodjKzwlAaQ0s+ 5eHmEqs8irgvVIe+3k0SLyGY8NU/a7Ahpay2TwXuqChzeBVH3BQFgLhaZDWMBX/zazjl qr7k4CVVHhDv3ltPbGge8xiXAtctQHxGS9EJ7E1nAbRrU6y7j3guCENbrdAvt659crE7 sSSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dGDLMQqg; 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 j16si3561918otq.23.2020.01.30.11.14.12; Thu, 30 Jan 2020 11:14:32 -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=dGDLMQqg; 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 S1730067AbgA3Sk6 (ORCPT + 99 others); Thu, 30 Jan 2020 13:40:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:48648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730049AbgA3Sky (ORCPT ); Thu, 30 Jan 2020 13:40:54 -0500 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 2DAAF205F4; Thu, 30 Jan 2020 18:40:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580409653; bh=vLl1+z6hqSi6GBnz1nn3dYlO3YxHBtltxog8ULeao+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dGDLMQqgq8sXmFMVF5F47JcpPvoI9VV3cW/tL9PSVcQ5KgKCLGiIVTjAXVpF1m886 3JwEPSdJ3IZg/eSYBQiFHY2cbZyizo3+29TtbYtmuoSN1AWHyj3EF7sOAQfd4hbdLV uFO9xd4OpJgN+4MeHf4skoVINyHpqgQHtVtA7REs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold Subject: [PATCH 5.5 06/56] USB: serial: ir-usb: add missing endpoint sanity check Date: Thu, 30 Jan 2020 19:38:23 +0100 Message-Id: <20200130183610.241024057@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200130183608.849023566@linuxfoundation.org> References: <20200130183608.849023566@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: Johan Hovold commit 2988a8ae7476fe9535ab620320790d1714bdad1d upstream. Add missing endpoint sanity check to avoid dereferencing a NULL-pointer on open() in case a device lacks a bulk-out endpoint. Note that prior to commit f4a4cbb2047e ("USB: ir-usb: reimplement using generic framework") the oops would instead happen on open() if the device lacked a bulk-in endpoint and on write() if it lacked a bulk-out endpoint. Fixes: f4a4cbb2047e ("USB: ir-usb: reimplement using generic framework") Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable Reviewed-by: Greg Kroah-Hartman Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/ir-usb.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c @@ -195,6 +195,9 @@ static int ir_startup(struct usb_serial struct usb_irda_cs_descriptor *irda_desc; int rates; + if (serial->num_bulk_in < 1 || serial->num_bulk_out < 1) + return -ENODEV; + irda_desc = irda_usb_find_class_desc(serial, 0); if (!irda_desc) { dev_err(&serial->dev->dev,