Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4831788ybl; Wed, 22 Jan 2020 05:33:32 -0800 (PST) X-Google-Smtp-Source: APXvYqz1h0qYqgd9zlX5aYlKav5nQXLRBovHJhPsIgvNt0Y5W1wGExpTrc+JpaCLJkRw7ltA6oPj X-Received: by 2002:a9d:8f1:: with SMTP id 104mr6787004otf.107.1579700011985; Wed, 22 Jan 2020 05:33:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579700011; cv=none; d=google.com; s=arc-20160816; b=PrYLvIuRG+gADOQPvjTVmFGGAC6j0sdlGDasXUVu8nTC6SpYd3RjgP41PfUuijqB8V kqqSA730et9Jdu5xkE+8MEZ8CLlkJo+Iw7Xqdy0N/jiccXXTts44k5sP7DYw1sE05tBZ cN4GmDnzx6KiG4iT7uhO/DVQQwUlOPLrYKd0ULev2QCSF5kG5S2lV3ESuoVcqa0asDTU qvJnW7uAEeVK7ugWSZMA8RkfTcURF/QHi1C4A0rNh5lS8gRjwmIMdbt0ZZsS+ivIonmh LWj3CnGweFU3FPHEtNTrhqvin83W+K+Ri/+hpCOzZpIUZZ9KRuljQES7uE99qvPYr/0Q l9yw== 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=Y3IwBAkAnbOW9vqunzS6dIvQGN7s1ozWHGEorxNH7Rg=; b=GmDoMRazr/7UrYM5k+De8/4GFhEtCNt1yEJpmlsVLAdIGt5L5y8mWgW5EJxY/p7VMk 9n3ADuTzv7Mxa5DRB7GvZfoHF+BEEwl6dhaDcTdb//yJWieNI1Os6cHIWresEyYpe36T VsGhlMbtBo1tRSeiAXBuIBESa6ejzUUf7P2qkbbzWReWC7WBuOvpeQ4v9bdMmYbwQjMG 1oJ6ygUum+x7Q2LS4DJTOON2zOM+arQb/Dy79TCEdlOUSKz/1taBIzyoPHR5a0BQU4Yo j3bPlmlSUVd4Sp9hqCi2q5gxXo71/ifzSCRjQwTDNpE/juB8nCBeFOHSk5wkjQZk0REz 8JBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Lt+9sryS; 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 n8si23540338otr.102.2020.01.22.05.33.16; Wed, 22 Jan 2020 05:33:31 -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=Lt+9sryS; 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 S1729431AbgAVNSs (ORCPT + 99 others); Wed, 22 Jan 2020 08:18:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:34472 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726164AbgAVNSn (ORCPT ); Wed, 22 Jan 2020 08:18:43 -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 7743A205F4; Wed, 22 Jan 2020 13:18:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579699123; bh=l7BJIh0IT3H57HylY1Uzj1ztmKPjNKu1y6WNTJQsjvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lt+9srySG5p6+XgW/9Jf3Z6fokPygBdjE2MB/6fFOYqI6glGKIGzgm2PXe+qZh7i2 WMU8tJaZxq2fAYY5XaGqSGO2cZqahifjmMEIkPwwUANcAp21UhYrtcMq62SzohJy8t stuAxFaRpdGSx4i4/nxrfzh9j24tj+LksEFGEsxw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold Subject: [PATCH 5.4 048/222] USB: serial: ch341: handle unbound port at reset_resume Date: Wed, 22 Jan 2020 10:27:14 +0100 Message-Id: <20200122092837.028566412@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 4d5ef53f75c22d28f490bcc5c771fcc610a9afa4 upstream. Check for NULL port data in reset_resume() to avoid dereferencing a NULL pointer in case the port device isn't bound to a driver (e.g. after a failed control request at port probe). Fixes: 1ded7ea47b88 ("USB: ch341 serial: fix port number changed after resume") Cc: stable # 2.6.30 Reviewed-by: Greg Kroah-Hartman Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/ch341.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -589,9 +589,13 @@ static int ch341_tiocmget(struct tty_str static int ch341_reset_resume(struct usb_serial *serial) { struct usb_serial_port *port = serial->port[0]; - struct ch341_private *priv = usb_get_serial_port_data(port); + struct ch341_private *priv; int ret; + priv = usb_get_serial_port_data(port); + if (!priv) + return 0; + /* reconfigure ch341 serial port after bus-reset */ ch341_configure(serial->dev, priv);