Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10716433ybi; Thu, 25 Jul 2019 04:09:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqznIP3jqTI/xqR0X+yE8JjmDd3z95LNbCmLd4laDrfKdCfElU4pZ7tbUXJir2WbNw2LXAhw X-Received: by 2002:a63:2744:: with SMTP id n65mr72653591pgn.277.1564052942214; Thu, 25 Jul 2019 04:09:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564052942; cv=none; d=google.com; s=arc-20160816; b=MkGcMHm6rZetleV4f988qn2xhJuOjm3hqimTtBrcRxMz47lGDqo5iJC97xWrpi9iV4 o5G7uWF6Oz88vROyWmRFps/G72ecG9/46u9A0LXzpFFKN3pptEfUEiS9EmlosjpBWfd5 Cta3xpp6DIZuZlhkzVFqSXN4JdG/YAf7USaZK3oIMUgoCaSTxxTRbtZ/IM24/veDTM1D GNqYOIEmisO5chlwuxRZhXLk4asfMiWHdM59RCHbTjUW4gpHViR2ysYWK6ZPQ/eZK0Eg F/RB4dMgLb22wmqar3mG9kvaGTWjKed0a+Rwfj0KKIoioj3xkE+q2tYvnhHJyyNoVPuJ Ct2A== 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=m+6NZnZvIK0PKw0WzFPMLYJNig26j47CX5nDW9pFMeE=; b=IIO2BYT6x8iuBaFCLLAqC0T9Cbe8o99q+qy0ldwuOG1LgqtoS2v3tCA/4vlqR+WIv2 aMOnh/vqOncQa280lnBNgena7lgA7Yj6zebm512UaeE67H9jo61sApvmwuVlM0IUrvz+ jsBJP/C1w8PL+DmckJPPc+DEmSdpUxAEfcNYSz9lsPy5uvFkfrBeDoFqBbkFcKL1pCow 4sRealGjNH3HDcUPAvgWy3pxysFjQnXZ1I7e3JcJdUs0oS1FnZ7OpWfwPYRyqp6g9uZz Z80msjpDepAZvfej7sMeEWHAIN3qQ/YYlxGeCaPN7v5SIx6CEnsO+bf4x+atWGP7rfUP tZTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QwDslVIC; 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 m37si16618156pje.45.2019.07.25.04.08.15; Thu, 25 Jul 2019 04:09:02 -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=QwDslVIC; 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 S2390695AbfGYFjA (ORCPT + 99 others); Thu, 25 Jul 2019 01:39:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:53094 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390670AbfGYFi7 (ORCPT ); Thu, 25 Jul 2019 01:38:59 -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 D001D22BEB; Thu, 25 Jul 2019 05:38:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564033138; bh=h+kyfekLQOXDkRchEEawfPWP62nwihVO5AUNjmjhppk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QwDslVICf6Jn2/5aA6Re01mcpuAuuO7PyL2HdDS+6YRG9TZxqkADoD0Z7fOeDDK2f 0FMobIiYBIy8lbvVY/gXiJQtXlXYljDxxMFDqTjQtkBkPZNtq3Iczoz+xIYovX/ire Q/ofaiBAgYl/O9O+gd09sCcRTVmeNbYiH0xzC2yI= 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.19 105/271] rtlwifi: rtl8192cu: fix error handle when usb probe failed Date: Wed, 24 Jul 2019 21:19:34 +0200 Message-Id: <20190724191704.204853234@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@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 2ac5004d7a40..5adb939afee8 100644 --- a/drivers/net/wireless/realtek/rtlwifi/usb.c +++ b/drivers/net/wireless/realtek/rtlwifi/usb.c @@ -1081,13 +1081,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"); @@ -1108,6 +1108,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