Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2097010ybl; Thu, 30 Jan 2020 11:18:07 -0800 (PST) X-Google-Smtp-Source: APXvYqz1z37ORw9jCIsAavfq/iRwLIw5wODwO6LlxVspgK/hdcoC3KPk704jN1t29hEvz56RnROv X-Received: by 2002:aca:1108:: with SMTP id 8mr4000791oir.127.1580411887603; Thu, 30 Jan 2020 11:18:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580411887; cv=none; d=google.com; s=arc-20160816; b=1HNzvGajNjdUTWlgdbydTbmi+zZ63OoikSKRHFvCjyJ/y7k/H7W2N9OoYNPj3oD/y9 BV4FmWsyl64KYnu9/p0fZCAbp+P5ZPMkJziL2xWua72/2rxWbLDzaQg1Ply3bzpBNwJq ciH8Qnr0OcfkWceoXdqLtWIot8IPr1LC4NrcsdvUjY+Q4PCunhYz3V9Rl/ksi3DfUIyV ivG7OkJkmzTOk2jXawzGaklKv56a9Es2HLx1CQDxptOBGw7fa8xRAJYuN+A5n6SlZ+KG pZ0VgUt27mQOctWn7jAxDDCFRQdEExsFQz4zvJDEJLc4W46AO/47kCZyGXpmB+JUT7zV aEmQ== 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=OA8Yu5f9frG+eMR8ivczYD6sc3ZRb2jpjPlJZcYZMLwuKSGZEj5/Ep5V9Bz98U9XVm jlpbGecOGHAw8F1qoQv73u6qaJRuMIkvGE6nIl0k9DXNuciVZVbMaRjs8RQ8DQlDD4F5 gXO/CeXRcM8G0xvLRZjLptM51N4RFgFFmU4lf3oc5ddK4sQ8Td62MmMAn9B0Ym57XEsK gm6s3cSEG4/DphgxkJkNTYH2fhkp4+rXQrOTOb6OxUxZEP+aoi8Yn8csAl70eUZRrZn9 36TRqc0asJLq2ZnGOEzgc6kq6hdhqu19mpo7I/N+TDhDGss0bXTk2xVgkL6Qo/wmw/5E /oVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="GF/SgxRU"; 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 v67si3282774oia.26.2020.01.30.11.17.55; Thu, 30 Jan 2020 11:18:07 -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="GF/SgxRU"; 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 S1730787AbgA3SoM (ORCPT + 99 others); Thu, 30 Jan 2020 13:44:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:53168 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730747AbgA3SoJ (ORCPT ); Thu, 30 Jan 2020 13:44:09 -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 8CA69205F4; Thu, 30 Jan 2020 18:44:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580409849; bh=vLl1+z6hqSi6GBnz1nn3dYlO3YxHBtltxog8ULeao+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GF/SgxRUfudmheeUDcPxkDEird7+8cVuX9UP8IENeFRTXp/c7XgE2K/8RvQB8iUIs VMKWEQab3pnemUGSRvRQw3ChzGgiaWOto9HzOmiK1JytNmjWpbGd6hk0ZxvpKgZzcA 64qRtprSeyUD/b1t/6Ux2Bh+axQ0u+MXTTgniKHg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold Subject: [PATCH 5.4 006/110] USB: serial: ir-usb: add missing endpoint sanity check Date: Thu, 30 Jan 2020 19:37:42 +0100 Message-Id: <20200130183614.848488156@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200130183613.810054545@linuxfoundation.org> References: <20200130183613.810054545@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,