Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4831840ybl; Wed, 22 Jan 2020 05:33:35 -0800 (PST) X-Google-Smtp-Source: APXvYqwSLwIf0sjRMAjexpb2jPV2EH8YW5I2B03rkCkFjuwn8VkzMNks4XyOjZsvlhcAianbNZXT X-Received: by 2002:a9d:6e03:: with SMTP id e3mr7394921otr.46.1579700014974; Wed, 22 Jan 2020 05:33:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579700014; cv=none; d=google.com; s=arc-20160816; b=es+gL/jTn1obzyNgQwxVHOHbFyj33Q+6L6NHn+0Mm+cZB3bsO2goIBF5CtO3XbrvGt vunLmkA/NEClWN0TrOq94vjkAZPUFx8yMxv0ic3zJh/ytiXnd/X7OhUaOzzNjcUrI6t2 zSFBevtKvh9AeIpgJty2zutvyvFNkqjGXWEusK5L1KgGR5OmrDrcruuf/JpmibF+O30U CqayYiyDS9INRRxKhHmP14+Ozx7D0XpFuxW72CuNy4sUPXMamEeM3IeHJR3Lt8BLD5DM horjw0eLCS+wp6M9kojIxzUk6+0/s0c005yVnxK78EYzyUNdW40tgoEvwXR4IWFnR+9w vQlw== 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=8q8TfqmFdcWw6UkNlO7DA310mea5nQOmFMcdwrIoGvs=; b=ociRVCyIMIfYekCcCwIA38icvWRJwQQRxvPBBKE+AkGCeWxiC4dC5195XwZuiBamd/ /HqpX61JFmCuO3yfrC68wiZZPVpfUW01XEyvLYosSBP66SRvk43UMydaGOinHOrBTA3J tmu4zYXIF2gEX3+2LZKssgcM+8gKbNjYRm+2PwWM//t+7Q2je1S+7DllbiX2O5vzQBAR DxIOkARMSb9pxl/rWG7WzlAI3LypkweaRa8TWr1Ebs2WzgIpO/ptRvOKn+HNI59BCX0O BDLmZROVOxWsdOLAXnDPrGmonWJjt9frAw6jB8bqviHor9i5TPvDN1ZfA9JqBxbsicei 4H+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mxqbLnmk; 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 p17si984470otq.261.2020.01.22.05.33.19; Wed, 22 Jan 2020 05:33:34 -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=mxqbLnmk; 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 S1726761AbgAVNTC (ORCPT + 99 others); Wed, 22 Jan 2020 08:19:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:34740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729473AbgAVNS4 (ORCPT ); Wed, 22 Jan 2020 08:18:56 -0500 Received: from localhost (unknown [84.241.205.26]) (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 40C9424125; Wed, 22 Jan 2020 13:18:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579699135; bh=zHGxkpxG/eZRsdg4/16Zck/ramCs3aNedGgjwlOlSDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mxqbLnmkwN+KqkiGcug85yFSc622iYRce77cW1OjIlwiuOqysicyLmF9B18cxR7RT HxI5/7VCHC2qz+fk823eo/hmmnvo7ds01dwHGOSC0sXjKCx/TxyseD/X9sEOEBYPAA r/WSwP2BFctfknnmaKIwFmbulY9iAtLB59gKWpZg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold Subject: [PATCH 5.4 051/222] USB: serial: keyspan: handle unbound ports Date: Wed, 22 Jan 2020 10:27:17 +0100 Message-Id: <20200122092837.265058198@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200122092833.339495161@linuxfoundation.org> References: <20200122092833.339495161@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 3018dd3fa114b13261e9599ddb5656ef97a1fa17 upstream. Check for NULL port data in the control URB completion handlers to avoid dereferencing a NULL pointer in the unlikely case where a port device isn't bound to a driver (e.g. after an allocation failure on port probe()). Fixes: 0ca1268e109a ("USB Serial Keyspan: add support for USA-49WG & USA-28XG") 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/keyspan.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c @@ -1058,6 +1058,8 @@ static void usa49_glocont_callback(struc for (i = 0; i < serial->num_ports; ++i) { port = serial->port[i]; p_priv = usb_get_serial_port_data(port); + if (!p_priv) + continue; if (p_priv->resend_cont) { dev_dbg(&port->dev, "%s - sending setup\n", __func__); @@ -1459,6 +1461,8 @@ static void usa67_glocont_callback(struc for (i = 0; i < serial->num_ports; ++i) { port = serial->port[i]; p_priv = usb_get_serial_port_data(port); + if (!p_priv) + continue; if (p_priv->resend_cont) { dev_dbg(&port->dev, "%s - sending setup\n", __func__);