Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3393687ybp; Sun, 6 Oct 2019 10:58:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3+0yDs0xIFc7CsS26cUFoxfHFzsTr7G8tpY7z/Us0VKPMGoEOIK0v3zNIV9hbMphQ9cq0 X-Received: by 2002:aa7:c555:: with SMTP id s21mr25515665edr.151.1570384706112; Sun, 06 Oct 2019 10:58:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570384706; cv=none; d=google.com; s=arc-20160816; b=duBSPu0pBbO0MJYjdtnBD1AjMK9g4WPArgsW9YKPxU9slH0tuDCHbBQQreOXw6phQl gFrZGw9QCX8ydEl6HPmOO6cUbfy3tBxx9Ny4m/6zXaCPiI+6yCoJeN6DEKPn9UZ41DPd 2GZ1XC62D4sbiNESdabE7/yYvqD85Q5aWxT3yyqjbJOpFSefE7ZOdG3pm9xg2hRBIXcY 3EYqD2y8aTBff46a5ykiSy4M0Rq0gb4f9i/5RIfgaEUQmnkiG+Uao0Cwt/+RbPISYCZA dcY7qIQK4/f7Ab7PU+UByK2yuL40yT96VigGg28p2pBBT/I27TKC3Cu50uyeaDoF1UaK ZVfw== 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=xdr7k3Hm/YuexM6Lbrrh0sMwntLowbr4rE3F8H4I6oM=; b=SwPxaXA/C+nEl4nSpe4rkSRZLsxUHpUqWLwJbm43q8DF21oxNq/DFDZfw4Hy3FtSzy bHrGHstGX5b0uErCzkNN7X7sPLyNR+eqAL8GZG29chQ2MVJf5LJIxw8RnOw5MYOlFPVl Vt9s0BX7FNofyK709AhmKnmVV/wwLcchmlmDzKeVpN4eWY04d/Rm2pL3zZk89Y+wRdQI 16LJYgfe+N+ZZjdke46DCVO5sTYnWTBX+WUdbfYbyhX9ADS6beHkTdx/RrUiwYEnoHWM eqJKH30CEPATCXEIrwX+RTtae4OqhQY6NY/RKptJ4laZhb4TDUSmccpzLY2/G9nxAWx6 UDvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JMCK4o6k; 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 z11si7477617edl.1.2019.10.06.10.58.02; Sun, 06 Oct 2019 10:58:26 -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=JMCK4o6k; 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 S1729683AbfJFRc6 (ORCPT + 99 others); Sun, 6 Oct 2019 13:32:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:59518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729677AbfJFRc4 (ORCPT ); Sun, 6 Oct 2019 13:32:56 -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 80FE92087E; Sun, 6 Oct 2019 17:32:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570383176; bh=pUQzzgviHZAl9J4RPTZPd1/kHJ8JsYvcDV5EOmgKvJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JMCK4o6kVrxEVt4u2OG6/9ZrRRbV2Iuu2l4xJY2ANvlE8uQ7CS4AA4rdhl/+5wYlW x2WUhCMcB0Plg0gAcRND0Jrrmvk3naBblWmRBTduZi6HSiRCd3biLBU1Z4ar59zhcU VnhQpb6wUxNQsx6biEwLu4RILzYY3l23D+Pgoe6k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , "David S. Miller" Subject: [PATCH 4.19 082/106] hso: fix NULL-deref on tty open Date: Sun, 6 Oct 2019 19:21:28 +0200 Message-Id: <20191006171157.664209125@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191006171124.641144086@linuxfoundation.org> References: <20191006171124.641144086@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 [ Upstream commit 8353da9fa69722b54cba82b2ec740afd3d438748 ] Fix NULL-pointer dereference on tty open due to a failure to handle a missing interrupt-in endpoint when probing modem ports: BUG: kernel NULL pointer dereference, address: 0000000000000006 ... RIP: 0010:tiocmget_submit_urb+0x1c/0xe0 [hso] ... Call Trace: hso_start_serial_device+0xdc/0x140 [hso] hso_serial_open+0x118/0x1b0 [hso] tty_open+0xf1/0x490 Fixes: 542f54823614 ("tty: Modem functions for the HSO driver") Signed-off-by: Johan Hovold Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/usb/hso.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c @@ -2634,14 +2634,18 @@ static struct hso_device *hso_create_bul */ if (serial->tiocmget) { tiocmget = serial->tiocmget; + tiocmget->endp = hso_get_ep(interface, + USB_ENDPOINT_XFER_INT, + USB_DIR_IN); + if (!tiocmget->endp) { + dev_err(&interface->dev, "Failed to find INT IN ep\n"); + goto exit; + } + tiocmget->urb = usb_alloc_urb(0, GFP_KERNEL); if (tiocmget->urb) { mutex_init(&tiocmget->mutex); init_waitqueue_head(&tiocmget->waitq); - tiocmget->endp = hso_get_ep( - interface, - USB_ENDPOINT_XFER_INT, - USB_DIR_IN); } else hso_free_tiomget(serial); }