Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3783552ybi; Mon, 29 Jul 2019 12:32:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwbu7A5dlGtnIFy2H+nlk3XgyngJrDKsLHSxelxlitUzh6hUTDs3v7+C2QHmtaJkj2dGjQp X-Received: by 2002:a17:90a:3086:: with SMTP id h6mr115941567pjb.14.1564428769468; Mon, 29 Jul 2019 12:32:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564428769; cv=none; d=google.com; s=arc-20160816; b=Oz8gHZAHCDW3XWYlcSOkVLJmVvN0QWMuNq3MWM/8IIf1NDg/MYD/ZRJbB3lcS8ViAo rUFyp3OJAKgwikGnhvIToK6DAYHSLXVf3xNqM/H3p/QbNcy8UOEm8bksq5Bhnu6nxUYu Ds0BRr6GLSko10O4ngAoEdAM5m/6unJ3tFr51A62QuOB/eISkf48VWB6S85W9Jucs7hF rG6Z0dhRsPqS8sYIjshCysh/lmH0szDNndddfsX4xwhx1SY6Pk0Wm9Q00uj4Uprz+uTx wHESZc+t5LYiIHWgPRiQ3fR7L3UBExadfNw/NzuZFOiC5gHGRFcsHkIE+eqMEzh7Nizw cxfg== 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=0WMMJENTYxu6krhssd4wc3UOOP1olk4CMl5VeBAh44M=; b=NdhKy3bqm3twhnR4Np+9p9noXmcQM8+9YaXRfiX1oPWFUFfC6deZgelpGPoIcBPM2P vWPpncQX6vuqJeJF4W7yt//txDuWwOPm0fiAYgUfswBpAIh2AvWiRNFgQvW00DSeY3Q2 4FxFjgiLBLAIo9khUwA+yx4m7ylqpq+tY6YoNtwqcUF+xB2GeNoSGmDq6zlQx1he0GmE j3GxiHhSs4NstmjhR95Y1AmR4zs1PzwY+83W530BFSxHN2N9F2BI17DdbH8trxedU84l YHDgp93yjvlpO9/h59tsAxMGxOq2HgvEM6GC8sPidSKWgZicHUcY8PSHVue5tr7xmwAV CyeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=r2zBjNQf; 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 n10si33070464pgr.27.2019.07.29.12.32.34; Mon, 29 Jul 2019 12:32:49 -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=r2zBjNQf; 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 S1727632AbfG2T1E (ORCPT + 99 others); Mon, 29 Jul 2019 15:27:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:39540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729871AbfG2T1D (ORCPT ); Mon, 29 Jul 2019 15:27:03 -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 7FB6121655; Mon, 29 Jul 2019 19:27:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428423; bh=AbLRWtZyK/qUXIE4d4ExyYvtPtDnK9hGwteY/sCH6M8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r2zBjNQfwbGe5Er7Du6KONHSuvJrIpCp4aVsSNUsHz2viDD5n0V9O0UR75Hi5fZlz RzmHuV8IhNPqyXopzxL3Zo6HnVyE/FdFkRJ1eLImL3/vE8XSPuRwqA1URyxaAIn2/k tiSbswtTeHKKEQuz9a5tariDql0K2EPt9oNzvTNQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+1fcc5ef45175fc774231@syzkaller.appspotmail.com, Ping-Ke Shih , Larry Finger , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 072/293] rtlwifi: rtl8192cu: fix error handle when usb probe failed Date: Mon, 29 Jul 2019 21:19:23 +0200 Message-Id: <20190729190830.184115675@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 [ Upstream commit 6c0ed66f1a5b84e2a812c7c2d6571a5621bf3396 ] rtl_usb_probe() must do error handle rtl_deinit_core() only if rtl_init_core() is done, otherwise goto error_out2. | usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 | rtl_usb: reg 0xf0, usbctrl_vendorreq TimeOut! status:0xffffffb9 value=0x0 | rtl8192cu: Chip version 0x10 | rtl_usb: reg 0xa, usbctrl_vendorreq TimeOut! status:0xffffffb9 value=0x0 | rtl_usb: Too few input end points found | INFO: trying to register non-static key. | the code is fine but needs lockdep annotation. | turning off the locking correctness validator. | CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.1.0-rc4-319354-g9a33b36 #3 | Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS | Google 01/01/2011 | Workqueue: usb_hub_wq hub_event | Call Trace: | __dump_stack lib/dump_stack.c:77 [inline] | dump_stack+0xe8/0x16e lib/dump_stack.c:113 | assign_lock_key kernel/locking/lockdep.c:786 [inline] | register_lock_class+0x11b8/0x1250 kernel/locking/lockdep.c:1095 | __lock_acquire+0xfb/0x37c0 kernel/locking/lockdep.c:3582 | lock_acquire+0x10d/0x2f0 kernel/locking/lockdep.c:4211 | __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] | _raw_spin_lock_irqsave+0x44/0x60 kernel/locking/spinlock.c:152 | rtl_c2hcmd_launcher+0xd1/0x390 | drivers/net/wireless/realtek/rtlwifi/base.c:2344 | rtl_deinit_core+0x25/0x2d0 drivers/net/wireless/realtek/rtlwifi/base.c:574 | rtl_usb_probe.cold+0x861/0xa70 | drivers/net/wireless/realtek/rtlwifi/usb.c:1093 | usb_probe_interface+0x31d/0x820 drivers/usb/core/driver.c:361 | really_probe+0x2da/0xb10 drivers/base/dd.c:509 | driver_probe_device+0x21d/0x350 drivers/base/dd.c:671 | __device_attach_driver+0x1d8/0x290 drivers/base/dd.c:778 | bus_for_each_drv+0x163/0x1e0 drivers/base/bus.c:454 | __device_attach+0x223/0x3a0 drivers/base/dd.c:844 | bus_probe_device+0x1f1/0x2a0 drivers/base/bus.c:514 | device_add+0xad2/0x16e0 drivers/base/core.c:2106 | usb_set_configuration+0xdf7/0x1740 drivers/usb/core/message.c:2021 | generic_probe+0xa2/0xda drivers/usb/core/generic.c:210 | usb_probe_device+0xc0/0x150 drivers/usb/core/driver.c:266 | really_probe+0x2da/0xb10 drivers/base/dd.c:509 | driver_probe_device+0x21d/0x350 drivers/base/dd.c:671 | __device_attach_driver+0x1d8/0x290 drivers/base/dd.c:778 | bus_for_each_drv+0x163/0x1e0 drivers/base/bus.c:454 | __device_attach+0x223/0x3a0 drivers/base/dd.c:844 | bus_probe_device+0x1f1/0x2a0 drivers/base/bus.c:514 | device_add+0xad2/0x16e0 drivers/base/core.c:2106 | usb_new_device.cold+0x537/0xccf drivers/usb/core/hub.c:2534 | hub_port_connect drivers/usb/core/hub.c:5089 [inline] | hub_port_connect_change drivers/usb/core/hub.c:5204 [inline] | port_event drivers/usb/core/hub.c:5350 [inline] | hub_event+0x138e/0x3b00 drivers/usb/core/hub.c:5432 | process_one_work+0x90f/0x1580 kernel/workqueue.c:2269 | worker_thread+0x9b/0xe20 kernel/workqueue.c:2415 | kthread+0x313/0x420 kernel/kthread.c:253 | ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352 Reported-by: syzbot+1fcc5ef45175fc774231@syzkaller.appspotmail.com Signed-off-by: Ping-Ke Shih Acked-by: Larry Finger Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtlwifi/usb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c index 820c42ff5384..2401c8bdb211 100644 --- a/drivers/net/wireless/realtek/rtlwifi/usb.c +++ b/drivers/net/wireless/realtek/rtlwifi/usb.c @@ -1099,13 +1099,13 @@ int rtl_usb_probe(struct usb_interface *intf, rtlpriv->cfg->ops->read_eeprom_info(hw); err = _rtl_usb_init(hw); if (err) - goto error_out; + goto error_out2; rtl_usb_init_sw(hw); /* Init mac80211 sw */ err = rtl_init_core(hw); if (err) { pr_err("Can't allocate sw for mac80211\n"); - goto error_out; + goto error_out2; } if (rtlpriv->cfg->ops->init_sw_vars(hw)) { pr_err("Can't init_sw_vars\n"); @@ -1126,6 +1126,7 @@ int rtl_usb_probe(struct usb_interface *intf, error_out: rtl_deinit_core(hw); +error_out2: _rtl_usb_io_handler_release(hw); usb_put_dev(udev); complete(&rtlpriv->firmware_loading_complete); -- 2.20.1