From patchwork Wed Oct 10 09:29:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 148544 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp617275lji; Wed, 10 Oct 2018 02:29:56 -0700 (PDT) X-Google-Smtp-Source: ACcGV609bQE09ZjA64j2z8gPBcdgHpthK96lZwvn06JvV/prQvbCyqi5XY5vxPzJdKkUJ56blC30 X-Received: by 2002:a62:f553:: with SMTP id n80-v6mr33774544pfh.59.1539163796299; Wed, 10 Oct 2018 02:29:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539163796; cv=none; d=google.com; s=arc-20160816; b=UCQnbEEhBG84wx79IBmH6lxPwOk4w4pSeAC6P2jVIJ8xx0rte8fZYMdePj6GBorTeq hn1816Gauf+pmRRSmmCoBcqYvNM3rFSrevfmhpy02FU6KqZNAHju61InmSMvy5P8W9ej 5arlazACY+69yUWpiXhSE/8CkxaDgFcLusEB1igqTDoca6zvmx0icpiRGqgcE9P1eSBD 2zRXWXs2L5c4sJf8STYvxO8rboe3xppP3e2isiC/J2S0LxdhDh8g4EE6qsbLE14JEB1i I9EzORxRluD7kTZZMRI9Jaxht1Ox+vzyFwkLyhGK2KSAPfBShpMbfEte9g4xafRFnofd pk0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=XspLHCwx2YbdRsEwwX12dvQf/Vv9r/FuE99oV54V9Ls=; b=qPK4/vvGhrlTNfK4YA1bVCfSaNfzjHC2g9RB0NH6M2IUeHLoTiEhW1Qcq1IAG6DiJf Xar6M4Pm+A7TBECBOayHg9XPzRkXSM94fYi8lIroEBfVLm/iX2Lgj7utLaQTQIf3sIhE SzldVR1cVULBeog45mYl/FRkZXmOneIQHGtj/hVILSrdgxAQo7YJvh8IBg+u45trc6rq E41EbO3Q0/gEm8ynQTWJxmZhLnOIFqGe6ExC0NqwJ0I9P909WPYR16G5rMH+rJ/VEm2P ZwlOsX3A0fisOOIM74ObbDxZtJyPwruBgMRA7HmK0sx739giwgHfQumudM9WJBYdSA5B TpgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Pf/ClDZG"; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12-v6si27119281pfd.102.2018.10.10.02.29.56; Wed, 10 Oct 2018 02:29:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org header.s=google header.b="Pf/ClDZG"; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726579AbeJJQvN (ORCPT + 14 others); Wed, 10 Oct 2018 12:51:13 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:39377 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726515AbeJJQvN (ORCPT ); Wed, 10 Oct 2018 12:51:13 -0400 Received: by mail-pg1-f193.google.com with SMTP id r9-v6so2241062pgv.6 for ; Wed, 10 Oct 2018 02:29:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=XspLHCwx2YbdRsEwwX12dvQf/Vv9r/FuE99oV54V9Ls=; b=Pf/ClDZG4qId4Hq+ieGwLWpShmjgLH8BU6Guj4G4dLNOzZWD3xyPVAWz+pntVGgA6A I0B482VwdkCRzsWObH4y1zSHL6gu1WYb9Z5D2UaIEQ7Tkp/sX/AaRNQ6HGpZ3bchI8GA 5kL/aYzGpTlpDHd+RX+1W9+B7NhsvtRo8WLDY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=XspLHCwx2YbdRsEwwX12dvQf/Vv9r/FuE99oV54V9Ls=; b=ns4zSCE4KUFKTgFQhnM2HZC4jiGSdxSuFVOAPUk0xK3uzBFlDWKrPZ1hP//M2IFFnz 1Bi1IaDl3hDJhgrudbf3GV83n/VYB63p2pnEwlypBE/9zzMz66N5TCeabiNjQfOnE+ee zD7q8hsku/2hgbAVPjTA8fclpsr0oTs/q0a8Ra4/O0mAmHaOfq66fXV5ugBcZyGs6e6e KmNrh6in0LyDoCuiF/pm6pOGdVgXwPjMwpsafcSCPeWQtVlI/dGIh0gYWuaxg8K3VKqO Oxv3fZPtkhOnSxnYiE2vjr1Vx/gI8F8LfK4el1fwiZDmYtRRe1+Tp18kQ5BBBFiOarzX h6sw== X-Gm-Message-State: ABuFfog99EKys3hStXk8s8TyifBdlbx++M2g7RmElxEnATqzC2Sl2gJW 3BNt8pwXf4xfSRZPGIdDBUD3qw== X-Received: by 2002:a65:53c9:: with SMTP id z9-v6mr29245787pgr.203.1539163794147; Wed, 10 Oct 2018 02:29:54 -0700 (PDT) Received: from localhost.localdomain ([106.51.16.178]) by smtp.gmail.com with ESMTPSA id k71-v6sm37977548pge.44.2018.10.10.02.29.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Oct 2018 02:29:52 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Prateek Sood , Tejun Heo Subject: [PATCH for-4.14.y 1/4] cgroup/cpuset: remove circular dependency deadlock Date: Wed, 10 Oct 2018 14:59:46 +0530 Message-Id: <1539163789-32338-1-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Prateek Sood commit aa24163b2ee5c92120e32e99b5a93143a0f4258e upstream. Remove circular dependency deadlock in a scenario where hotplug of CPU is being done while there is updation in cgroup and cpuset triggered from userspace. Process A => kthreadd => Process B => Process C => Process A Process A cpu_subsys_offline(); cpu_down(); _cpu_down(); percpu_down_write(&cpu_hotplug_lock); //held cpuhp_invoke_callback(); workqueue_offline_cpu(); queue_work_on(); // unbind_work on system_highpri_wq __queue_work(); insert_work(); wake_up_worker(); flush_work(); wait_for_completion(); worker_thread(); manage_workers(); create_worker(); kthread_create_on_node(); wake_up_process(kthreadd_task); kthreadd kthreadd(); kernel_thread(); do_fork(); copy_process(); percpu_down_read(&cgroup_threadgroup_rwsem); __rwsem_down_read_failed_common(); //waiting Process B kernfs_fop_write(); cgroup_file_write(); cgroup_procs_write(); percpu_down_write(&cgroup_threadgroup_rwsem); //held cgroup_attach_task(); cgroup_migrate(); cgroup_migrate_execute(); cpuset_can_attach(); mutex_lock(&cpuset_mutex); //waiting Process C kernfs_fop_write(); cgroup_file_write(); cpuset_write_resmask(); mutex_lock(&cpuset_mutex); //held update_cpumask(); update_cpumasks_hier(); rebuild_sched_domains_locked(); get_online_cpus(); percpu_down_read(&cpu_hotplug_lock); //waiting Eliminating deadlock by reversing the locking order for cpuset_mutex and cpu_hotplug_lock. Signed-off-by: Prateek Sood Signed-off-by: Tejun Heo Signed-off-by: Amit Pundir --- Build tested on 4.14.74 for ARCH=arm/arm64 allmodconfig. kernel/cgroup/cpuset.c | 53 ++++++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 23 deletions(-) -- 2.7.4 diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 4657e2924ecb..54f4855b92fa 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -817,6 +817,18 @@ static int generate_sched_domains(cpumask_var_t **domains, return ndoms; } +static void cpuset_sched_change_begin(void) +{ + cpus_read_lock(); + mutex_lock(&cpuset_mutex); +} + +static void cpuset_sched_change_end(void) +{ + mutex_unlock(&cpuset_mutex); + cpus_read_unlock(); +} + /* * Rebuild scheduler domains. * @@ -826,16 +838,14 @@ static int generate_sched_domains(cpumask_var_t **domains, * 'cpus' is removed, then call this routine to rebuild the * scheduler's dynamic sched domains. * - * Call with cpuset_mutex held. Takes get_online_cpus(). */ -static void rebuild_sched_domains_locked(void) +static void rebuild_sched_domains_cpuslocked(void) { struct sched_domain_attr *attr; cpumask_var_t *doms; int ndoms; lockdep_assert_held(&cpuset_mutex); - get_online_cpus(); /* * We have raced with CPU hotplug. Don't do anything to avoid @@ -843,27 +853,25 @@ static void rebuild_sched_domains_locked(void) * Anyways, hotplug work item will rebuild sched domains. */ if (!cpumask_equal(top_cpuset.effective_cpus, cpu_active_mask)) - goto out; + return; /* Generate domain masks and attrs */ ndoms = generate_sched_domains(&doms, &attr); /* Have scheduler rebuild the domains */ partition_sched_domains(ndoms, doms, attr); -out: - put_online_cpus(); } #else /* !CONFIG_SMP */ -static void rebuild_sched_domains_locked(void) +static void rebuild_sched_domains_cpuslocked(void) { } #endif /* CONFIG_SMP */ void rebuild_sched_domains(void) { - mutex_lock(&cpuset_mutex); - rebuild_sched_domains_locked(); - mutex_unlock(&cpuset_mutex); + cpuset_sched_change_begin(); + rebuild_sched_domains_cpuslocked(); + cpuset_sched_change_end(); } /** @@ -949,7 +957,7 @@ static void update_cpumasks_hier(struct cpuset *cs, struct cpumask *new_cpus) rcu_read_unlock(); if (need_rebuild_sched_domains) - rebuild_sched_domains_locked(); + rebuild_sched_domains_cpuslocked(); } /** @@ -1281,7 +1289,7 @@ static int update_relax_domain_level(struct cpuset *cs, s64 val) cs->relax_domain_level = val; if (!cpumask_empty(cs->cpus_allowed) && is_sched_load_balance(cs)) - rebuild_sched_domains_locked(); + rebuild_sched_domains_cpuslocked(); } return 0; @@ -1314,7 +1322,6 @@ static void update_tasks_flags(struct cpuset *cs) * * Call with cpuset_mutex held. */ - static int update_flag(cpuset_flagbits_t bit, struct cpuset *cs, int turning_on) { @@ -1347,7 +1354,7 @@ static int update_flag(cpuset_flagbits_t bit, struct cpuset *cs, spin_unlock_irq(&callback_lock); if (!cpumask_empty(trialcs->cpus_allowed) && balance_flag_changed) - rebuild_sched_domains_locked(); + rebuild_sched_domains_cpuslocked(); if (spread_flag_changed) update_tasks_flags(cs); @@ -1615,7 +1622,7 @@ static int cpuset_write_u64(struct cgroup_subsys_state *css, struct cftype *cft, cpuset_filetype_t type = cft->private; int retval = 0; - mutex_lock(&cpuset_mutex); + cpuset_sched_change_begin(); if (!is_cpuset_online(cs)) { retval = -ENODEV; goto out_unlock; @@ -1651,7 +1658,7 @@ static int cpuset_write_u64(struct cgroup_subsys_state *css, struct cftype *cft, break; } out_unlock: - mutex_unlock(&cpuset_mutex); + cpuset_sched_change_end(); return retval; } @@ -1662,7 +1669,7 @@ static int cpuset_write_s64(struct cgroup_subsys_state *css, struct cftype *cft, cpuset_filetype_t type = cft->private; int retval = -ENODEV; - mutex_lock(&cpuset_mutex); + cpuset_sched_change_begin(); if (!is_cpuset_online(cs)) goto out_unlock; @@ -1675,7 +1682,7 @@ static int cpuset_write_s64(struct cgroup_subsys_state *css, struct cftype *cft, break; } out_unlock: - mutex_unlock(&cpuset_mutex); + cpuset_sched_change_end(); return retval; } @@ -1714,7 +1721,7 @@ static ssize_t cpuset_write_resmask(struct kernfs_open_file *of, kernfs_break_active_protection(of->kn); flush_work(&cpuset_hotplug_work); - mutex_lock(&cpuset_mutex); + cpuset_sched_change_begin(); if (!is_cpuset_online(cs)) goto out_unlock; @@ -1738,7 +1745,7 @@ static ssize_t cpuset_write_resmask(struct kernfs_open_file *of, free_trial_cpuset(trialcs); out_unlock: - mutex_unlock(&cpuset_mutex); + cpuset_sched_change_end(); kernfs_unbreak_active_protection(of->kn); css_put(&cs->css); flush_workqueue(cpuset_migrate_mm_wq); @@ -2039,14 +2046,14 @@ static int cpuset_css_online(struct cgroup_subsys_state *css) /* * If the cpuset being removed has its flag 'sched_load_balance' * enabled, then simulate turning sched_load_balance off, which - * will call rebuild_sched_domains_locked(). + * will call rebuild_sched_domains_cpuslocked(). */ static void cpuset_css_offline(struct cgroup_subsys_state *css) { struct cpuset *cs = css_cs(css); - mutex_lock(&cpuset_mutex); + cpuset_sched_change_begin(); if (is_sched_load_balance(cs)) update_flag(CS_SCHED_LOAD_BALANCE, cs, 0); @@ -2054,7 +2061,7 @@ static void cpuset_css_offline(struct cgroup_subsys_state *css) cpuset_dec(); clear_bit(CS_ONLINE, &cs->flags); - mutex_unlock(&cpuset_mutex); + cpuset_sched_change_end(); } static void cpuset_css_free(struct cgroup_subsys_state *css) From patchwork Wed Oct 10 09:29:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 148545 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp617342lji; Wed, 10 Oct 2018 02:29:58 -0700 (PDT) X-Google-Smtp-Source: ACcGV61kja6DL2hiJc2Npzg74dj4q5Rd69AmoRht14a7fBdc7ZKTj7wySAYpukGgP3rLDv+WNBw4 X-Received: by 2002:a62:7604:: with SMTP id r4-v6mr34329983pfc.230.1539163798657; Wed, 10 Oct 2018 02:29:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539163798; cv=none; d=google.com; s=arc-20160816; b=E+FGvZtbaU4RKXopLsr92c/Z2AhfQxEhzB4h9dxrKkEbtLj6vr2b3Vma6OlCQEfOOk 99mOcnAZqRdySddvIzqw9z3kML2lTANY0hD8opBOIIGycPOYRKDzG8uN0j6WPz72QC8E YqVzeosnDK/9HmY//jgApNhOwPpnj8c9MQfPHzfw/d5cfviiOg5magjDodxd3j19g40E SMlZ/af1c+oJdkZwIn1gEO7pF0n+ciaYyR0hPeD0GVwQlhfdQg7fYBrERcZSKKYAz7Bn 1OK597OcHA4MlE20ahwQ5ue87cgW1Zss0HZsKzD8ipEnm0isUKI5tjw01KojaOJALVUR Hn0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=i9/fks+Ui8IICciChnvqF/Gou4A+KDqQNmSOaif6vQU=; b=hz9O/SFKE1fdOzvWwzE/qPeusIJNu+3kv+i4vFNsDq2mKImMoqR/7uSCUbh/Dznhdn k4R4DNj6jev1uvMqF3S7FwjWgTctyCWCz0rB5GrHaV0tbKiiLYxIzI+YMwX5bVGtKMBl e2Kr+yfxTdZHFrc4I8HPyDWfK4nJ+bwWZKQMszgi1LB2uveNz3Fi+FPIOemUfJkYAbdb CpskvolWX8lwqYoHPrO+FdqVJNnzH2sUgCdmd5ad4cu/lzspbm1+vyjIdvIthx05OGl5 fb5zWOwJWB8mPmSunxkUq61Gpq7mttEa78MieT0cTKDZCSplt8YjKKfbg4pOML6VnulH Y0nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i6YNGTgj; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12-v6si27119281pfd.102.2018.10.10.02.29.58; Wed, 10 Oct 2018 02:29:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org header.s=google header.b=i6YNGTgj; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726617AbeJJQvQ (ORCPT + 14 others); Wed, 10 Oct 2018 12:51:16 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:38001 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726515AbeJJQvP (ORCPT ); Wed, 10 Oct 2018 12:51:15 -0400 Received: by mail-pl1-f194.google.com with SMTP id b5-v6so2253861plr.5 for ; Wed, 10 Oct 2018 02:29:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=i9/fks+Ui8IICciChnvqF/Gou4A+KDqQNmSOaif6vQU=; b=i6YNGTgjPLU6zT77xmc7h/Ahs8PtlqZ4WW/tJWx0tbaAk7d9qWwO1B5UEWf03oqFLr WyQz2csRsbqomsDLRpViLnQDolX+Hj42FVzKYTSIyLH1jZybL117NTU98ZN52fTviBxU JW7g32/ir1OYoNhMEvLf5Lk6KZphLOjP60eyA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=i9/fks+Ui8IICciChnvqF/Gou4A+KDqQNmSOaif6vQU=; b=NLnupWigwR9/qvjtwkNwfzrEyMzJ67biMRCfTyKmpmGaB7xLhA1PR/XjChl5YeEGFG dgEBU/wFlMSwNIf6HwKC+ktSwqlDsUIXGswfOZ7ln5UYtFsli4aKZUkOV6jEIeEnaHMs KRySXIsqcAIJBDgnYPdkl0TsSP4jOTTYa18Z7QI9TTTmEDmpR6X8zh0jqQUcO+AixGKj 8E1/GEbQZofUv/sxCsvf2AamMDpRxr++yyFHEewj/bpR8BElVxjV2wpT1tEdpsP48sRW efkzlHir9tmGVLQ72wEH06cgEuARyForj9MFBgkZ4AVvFN74WXSNNCXHCcE/P7s4PYlY mZcQ== X-Gm-Message-State: ABuFfog+Z0hp0KbdngeUbQZ3GRYONh9sNeAOFfwrPO4p2md7EmHAryOv b5rifpzX+0Eb90Ko+Lgc36qLPA== X-Received: by 2002:a17:902:c6b:: with SMTP id 98-v6mr32739601pls.233.1539163797051; Wed, 10 Oct 2018 02:29:57 -0700 (PDT) Received: from localhost.localdomain ([106.51.16.178]) by smtp.gmail.com with ESMTPSA id k71-v6sm37977548pge.44.2018.10.10.02.29.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Oct 2018 02:29:55 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Carl Huang , Kalle Valo Subject: [PATCH for-4.14.y 2/4] ath10k: fix use-after-free in ath10k_wmi_cmd_send_nowait Date: Wed, 10 Oct 2018 14:59:47 +0530 Message-Id: <1539163789-32338-2-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539163789-32338-1-git-send-email-amit.pundir@linaro.org> References: <1539163789-32338-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Carl Huang commit 9ef0f58ed7b4a55da4a64641d538e0d9e46579ac upstream. The skb may be freed in tx completion context before trace_ath10k_wmi_cmd is called. This can be easily captured when KASAN(Kernel Address Sanitizer) is enabled. The fix is to move trace_ath10k_wmi_cmd before the send operation. As the ret has no meaning in trace_ath10k_wmi_cmd then, so remove this parameter too. Signed-off-by: Carl Huang Tested-by: Brian Norris Reviewed-by: Brian Norris Signed-off-by: Kalle Valo Signed-off-by: Amit Pundir --- To be applied on 4.9.y and 4.4.y as well. Build tested on 4.14.74, 4.9.131 and 4.4.159 for ARCH=arm/arm64 allmodconfig. drivers/net/wireless/ath/ath10k/trace.h | 12 ++++-------- drivers/net/wireless/ath/ath10k/wmi.c | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) -- 2.7.4 diff --git a/drivers/net/wireless/ath/ath10k/trace.h b/drivers/net/wireless/ath/ath10k/trace.h index e0d00cef0bd8..5b974bb76e6c 100644 --- a/drivers/net/wireless/ath/ath10k/trace.h +++ b/drivers/net/wireless/ath/ath10k/trace.h @@ -152,10 +152,9 @@ TRACE_EVENT(ath10k_log_dbg_dump, ); TRACE_EVENT(ath10k_wmi_cmd, - TP_PROTO(struct ath10k *ar, int id, const void *buf, size_t buf_len, - int ret), + TP_PROTO(struct ath10k *ar, int id, const void *buf, size_t buf_len), - TP_ARGS(ar, id, buf, buf_len, ret), + TP_ARGS(ar, id, buf, buf_len), TP_STRUCT__entry( __string(device, dev_name(ar->dev)) @@ -163,7 +162,6 @@ TRACE_EVENT(ath10k_wmi_cmd, __field(unsigned int, id) __field(size_t, buf_len) __dynamic_array(u8, buf, buf_len) - __field(int, ret) ), TP_fast_assign( @@ -171,17 +169,15 @@ TRACE_EVENT(ath10k_wmi_cmd, __assign_str(driver, dev_driver_string(ar->dev)); __entry->id = id; __entry->buf_len = buf_len; - __entry->ret = ret; memcpy(__get_dynamic_array(buf), buf, buf_len); ), TP_printk( - "%s %s id %d len %zu ret %d", + "%s %s id %d len %zu", __get_str(driver), __get_str(device), __entry->id, - __entry->buf_len, - __entry->ret + __entry->buf_len ) ); diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 38a97086708b..2ab5311659ea 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -1741,8 +1741,8 @@ int ath10k_wmi_cmd_send_nowait(struct ath10k *ar, struct sk_buff *skb, cmd_hdr->cmd_id = __cpu_to_le32(cmd); memset(skb_cb, 0, sizeof(*skb_cb)); + trace_ath10k_wmi_cmd(ar, cmd_id, skb->data, skb->len); ret = ath10k_htc_send(&ar->htc, ar->wmi.eid, skb); - trace_ath10k_wmi_cmd(ar, cmd_id, skb->data, skb->len, ret); if (ret) goto err_pull; From patchwork Wed Oct 10 09:29:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 148546 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp617386lji; Wed, 10 Oct 2018 02:30:01 -0700 (PDT) X-Google-Smtp-Source: ACcGV60KF7+7znqePG/FwhYW3ZVyr2B693CHXvhQKHCkbvILq/nnMJ3mppxl8pYxx63HA5AxxQBk X-Received: by 2002:a65:4145:: with SMTP id x5-v6mr4826357pgp.309.1539163801450; Wed, 10 Oct 2018 02:30:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539163801; cv=none; d=google.com; s=arc-20160816; b=rVY44L0DJ5QBq61x5qOoOnQW9t71mzArEmAgSsmrm2/9rWT8cf4eZ2diCq/mtl1uqJ nToV9XBElliU/e40bWv/ExuyuiiP8jAGQbN0NSR6mAsLbA0DbhTOpYnBRkO7JXyVyTzI fYKEX239daZWNkUDOWzMTxPq3/ep3ZF58RTuvWng10UWiHBLNeg0fB9abcIp4PhHQ45i mxiPp99tFX5Eg7tRU6T41QRrIJ7A7SNzlzuJg89Q9vW+r5g3jwf4+O2nw0zLLevF9Ms6 wM41Yg027FHR6ZN2pGWQMNepeicsLjJKNb7UR7ZJNBjK5+I36F1idaC4d884wmNdFHoD YS2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=VAY8GX4ta6JXyQAYfpeQVycPtRT2uthkiW7mRzYrSgc=; b=Eln+FGZq65jWE0XBHVVSQasjWHIwAmMwOeMeAcgYhkDkohNsV71xHfpAdg9kzK+wvI Ml796HdFz5I68ServZbn5bdNsF5Msaw1k2QcLtdluEjE8Qp1eKuVpNJ4ZUN9909BaFCZ KmFzbnmevSrLmlD+caJOcgChX5mVN7hA0t10ngGVNIn33ns+lIe8sd/Mx0hLdytD9MlF n7RJcWlaKt5SGskWxjcDpbLJSUREOv7/flv0YNtIhgYcnu8atTw8H6yiC6sGLICcY/gH FkWWX6eFfbQsZUo7lIgAfSa9pu+HaxWWnjKUSDbszrWhJxplOngS7ykB4pDSeEYaf1VE HIMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g9YiX0lk; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12-v6si27119281pfd.102.2018.10.10.02.30.01; Wed, 10 Oct 2018 02:30:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org header.s=google header.b=g9YiX0lk; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726827AbeJJQvT (ORCPT + 14 others); Wed, 10 Oct 2018 12:51:19 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:34097 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726515AbeJJQvS (ORCPT ); Wed, 10 Oct 2018 12:51:18 -0400 Received: by mail-pl1-f195.google.com with SMTP id f18-v6so2263528plr.1 for ; Wed, 10 Oct 2018 02:30:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VAY8GX4ta6JXyQAYfpeQVycPtRT2uthkiW7mRzYrSgc=; b=g9YiX0lkYeNf9+qu8xdNhBe+DJ7rjtH/XN3O6a6fDHiNP0stb6TO3S4d6wqx4eYHMm RP4tbeKjfNsHYCplfldipisUjuvUxBhCPeG/HZa1/rWD4sZCXmilSBHPdn0+Chu2dOy9 8xLFp45q8JIY/YYaR1EVljp1oyxx9QnoEM0Fo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VAY8GX4ta6JXyQAYfpeQVycPtRT2uthkiW7mRzYrSgc=; b=QQ4b1+3+587MzgQVaoTMH3WA0mipAQTF57r+73XMqCfqgzwwBtGyfYlLAmNX0CXvuG S4u91q3evAtH9HHaZCLqc94pAVpw96BEFnzCBmFB27XrCxK94IKM/1BMf0V2RhcAJ0Ox h++6V4qi6FXP3PrS3s5WipuZTH0VXjMZgT4ct+vZpnLkELMv9qHBf+wXVKZEwo567N0x /xWaO94GORVUhhcfSD7OSaD6Jsd13BvnBv++YHbbp3//AvATy+udElSCpWF/2oeEZVW9 oCZiIaN1fI8x82vy/7kk77JIRg6/moA3iGryLEk/UfXdohVXM+nnY3xhMTO+G81L5Y50 DSfg== X-Gm-Message-State: ABuFfoji6bTqFTU8MZ30ySxKEWvswA/yIsN49XGxqUI3ldTi93U5ApZg i3e53RDIo+IRuNR9xwPO+KhXn/zWF6I= X-Received: by 2002:a17:902:7109:: with SMTP id a9-v6mr32301921pll.310.1539163799833; Wed, 10 Oct 2018 02:29:59 -0700 (PDT) Received: from localhost.localdomain ([106.51.16.178]) by smtp.gmail.com with ESMTPSA id k71-v6sm37977548pge.44.2018.10.10.02.29.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Oct 2018 02:29:58 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Yu Wang , Kalle Valo Subject: [PATCH for-4.14.y 3/4] ath10k: fix kernel panic issue during pci probe Date: Wed, 10 Oct 2018 14:59:48 +0530 Message-Id: <1539163789-32338-3-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539163789-32338-1-git-send-email-amit.pundir@linaro.org> References: <1539163789-32338-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Yu Wang commit 50e79e25250bf928369996277e85b00536b380c7 upstream. If device gone during chip reset, ar->normal_mode_fw.board is not initialized, but ath10k_debug_print_hwfw_info() will try to access its member, which will cause 'kernel NULL pointer' issue. This was found using a faulty device (pci link went down sometimes) in a random insmod/rmmod/other-op test. To fix it, check ar->normal_mode_fw.board before accessing the member. pci 0000:02:00.0: BAR 0: assigned [mem 0xf7400000-0xf75fffff 64bit] ath10k_pci 0000:02:00.0: enabling device (0000 -> 0002) ath10k_pci 0000:02:00.0: pci irq msi oper_irq_mode 2 irq_mode 0 reset_mode 0 ath10k_pci 0000:02:00.0: failed to read device register, device is gone ath10k_pci 0000:02:00.0: failed to wait for target init: -5 ath10k_pci 0000:02:00.0: failed to warm reset: -5 ath10k_pci 0000:02:00.0: firmware crashed during chip reset ath10k_pci 0000:02:00.0: firmware crashed! (uuid 5d018951-b8e1-404a-8fde-923078b4423a) ath10k_pci 0000:02:00.0: (null) target 0x00000000 chip_id 0x00340aff sub 0000:0000 ath10k_pci 0000:02:00.0: kconfig debug 1 debugfs 1 tracing 1 dfs 1 testmode 1 ath10k_pci 0000:02:00.0: firmware ver api 0 features crc32 00000000 ... BUG: unable to handle kernel NULL pointer dereference at 00000004 ... Call Trace: [] ath10k_print_driver_info+0x12/0x20 [ath10k_core] [] ath10k_pci_fw_crashed_dump+0x6d/0x4d0 [ath10k_pci] [] ? ath10k_pci_sleep.part.19+0x57/0xc0 [ath10k_pci] [] ath10k_pci_hif_power_up+0x14e/0x1b0 [ath10k_pci] [] ? do_page_fault+0xb/0x10 [] ath10k_core_register_work+0x24/0x840 [ath10k_core] [] ? netlbl_unlhsh_remove+0x178/0x410 [] ? __do_page_fault+0x480/0x480 [] process_one_work+0x114/0x3e0 [] worker_thread+0x37/0x4a0 [] kthread+0xa4/0xc0 [] ? create_worker+0x180/0x180 [] ? kthread_park+0x50/0x50 [] ret_from_fork+0x1b/0x28 Code: 78 80 b8 50 09 00 00 00 75 5d 8d 75 94 c7 44 24 08 aa d7 52 fb c7 44 24 04 64 00 00 00 89 34 24 e8 82 52 e2 c5 8b 83 dc 08 00 00 <8b> 50 04 8b 08 31 c0 e8 20 57 e3 c5 89 44 24 10 8b 83 58 09 00 EIP: []- ath10k_debug_print_board_info+0x34/0xb0 [ath10k_core] SS:ESP 0068:f4921d90 CR2: 0000000000000004 Signed-off-by: Yu Wang Signed-off-by: Kalle Valo [AmitP: Minor rebasing for 4.14.y and 4.9.y] Signed-off-by: Amit Pundir --- To be applied on 4.9.y as well. Build tested on 4.14.74 and 4.9.131 for ARCH=arm/arm64 allmodconfig. drivers/net/wireless/ath/ath10k/debug.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index df514507d3f1..22003895f854 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2005-2011 Atheros Communications Inc. * Copyright (c) 2011-2013 Qualcomm Atheros, Inc. + * Copyright (c) 2018, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -163,6 +164,8 @@ void ath10k_debug_print_hwfw_info(struct ath10k *ar) void ath10k_debug_print_board_info(struct ath10k *ar) { char boardinfo[100]; + const struct firmware *board; + u32 crc; if (ar->id.bmi_ids_valid) scnprintf(boardinfo, sizeof(boardinfo), "%d:%d", @@ -170,11 +173,16 @@ void ath10k_debug_print_board_info(struct ath10k *ar) else scnprintf(boardinfo, sizeof(boardinfo), "N/A"); + board = ar->normal_mode_fw.board; + if (!IS_ERR_OR_NULL(board)) + crc = crc32_le(0, board->data, board->size); + else + crc = 0; + ath10k_info(ar, "board_file api %d bmi_id %s crc32 %08x", ar->bd_api, boardinfo, - crc32_le(0, ar->normal_mode_fw.board->data, - ar->normal_mode_fw.board->size)); + crc); } void ath10k_debug_print_boot_info(struct ath10k *ar) From patchwork Wed Oct 10 09:29:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 148547 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp617437lji; Wed, 10 Oct 2018 02:30:04 -0700 (PDT) X-Google-Smtp-Source: ACcGV61uUOMFKXXu1xdl9OWIRVrlwHtppQTtVyWtGSxdl7fbbCo9KCQZ+IhA1cT085BkQRmJLohl X-Received: by 2002:a17:902:16a4:: with SMTP id h33-v6mr24699192plh.3.1539163804849; Wed, 10 Oct 2018 02:30:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539163804; cv=none; d=google.com; s=arc-20160816; b=BG55jPBzWxJaKpaf1kHgxjHA0Q1XVhLNXLlrE3+pZFclD0GsEaYqZAVjqpMAws0D3r jHBW1x1KDDolaeGzb5jM3HCn+MG0h2husNki4jAHBUei3UbILYTKkMbSs2XhrzWWDqZB iYtM0mMfvjGkTGEjXRNkpVbTOkaTQcUGaUYjrDIbTtWArOhoKwBjwL2a1/v5P/koudbT LjOP6TLoN+F4BwmPl1NvnCNgkwRI8XfVAb/H9qt4dq1mxeJzx6IWzEA+LU7J8f2IYY2P 9r2CvyOMgrEXFdJdUmiqDA5vKC4pBImbBc9szcl5VfVPvp3GeSx+T499Ep7ScjRV5jf2 yWAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=y+PDdsHHh+P9RHRQlEHLjCkh9tUozsbI5JNl7NI13zI=; b=b9T4zG9P5XFPaLoeRUdPELIlvX8t4cQf70RJCfJ1sat5YW3/LZgyRJuM/Yrwtazg/r b6K3fA3v1enGdYHW/1o9bvLneKv8Poc5b834qiQO+xZzxHpsibcgZlhzEydXN+9sJmrE JPS65GxPm6dr/9cjdsahjU6MCsXLcGMIWklsnYp6GRQ/bMh42U8VQfO7enuaRrf/al4+ HybAfvNM4i/CaLAkzTubJXo8NaYaPpGJ+AePXUVzRiFMZOWxTe364U0UP0rVSIml2gHG mZFb1ICIH3OtXmSwJM53od7YbIh8OHPgYfk6TYXSXko9NMh+ZoZ/IngRNpZoSEhAd136 wANA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=agRNH3FO; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12-v6si27119281pfd.102.2018.10.10.02.30.04; Wed, 10 Oct 2018 02:30:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org header.s=google header.b=agRNH3FO; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726830AbeJJQvW (ORCPT + 14 others); Wed, 10 Oct 2018 12:51:22 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:38008 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726515AbeJJQvW (ORCPT ); Wed, 10 Oct 2018 12:51:22 -0400 Received: by mail-pl1-f194.google.com with SMTP id b5-v6so2254000plr.5 for ; Wed, 10 Oct 2018 02:30:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=y+PDdsHHh+P9RHRQlEHLjCkh9tUozsbI5JNl7NI13zI=; b=agRNH3FOZoUieGNK7NWVs2O8+EQndrlx6GOBOMnyKA6fwX4tbDB1n5p8W8RNhZXD4F OSl0mAOJK5GHvwr5EgX8qSCElvN8c+W8aA9zq0KkC/zGZiIxE3dvg/rFhh7Qo1I0oTBo BLxUCy3aXr3sBXoAm91KLyKBXmpJdyoNnlB7E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=y+PDdsHHh+P9RHRQlEHLjCkh9tUozsbI5JNl7NI13zI=; b=oDmHARJG8FBpAPyTAYWz1G8muN9P3ek/nYG1WeANsoYoWX3oU4lC1qwLhz/X4biWVu KIHSyhFQA5X7uLqmKVUPTfkoB8YfQVmxmwquPPo2twg5XywGHu2Wizov23QoUG7HSI+M SbWCR1VywurPbj2TMdf7In2ts7qlRLCgs23sdmb7FNnjPYrxWTM45y+Q/YBd9wK8982a Tp9/NAp4aLVDm2nmuC9BqSjNRn2/RFP4J1MxJtlYjqICKbw17eoQ8XETsWlq+teCjIRq Ick4IJjWegiYqpQELGt6Bj2SuNsqW1+iYEZp9xLBZ0Wa1m4t9vxy5ZvloaHdsgD0QelG 6P9A== X-Gm-Message-State: ABuFfojHKCTQPWZTHYbNubNWtGxEIKw2FBx7xkM2Kr5HUNFuKcI+JuEb tILPmofk46VARaT64p1VpYntkpmtwPs= X-Received: by 2002:a17:902:708b:: with SMTP id z11-v6mr8841336plk.151.1539163803111; Wed, 10 Oct 2018 02:30:03 -0700 (PDT) Received: from localhost.localdomain ([106.51.16.178]) by smtp.gmail.com with ESMTPSA id k71-v6sm37977548pge.44.2018.10.10.02.30.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Oct 2018 02:30:01 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , James Smart , James Smart , Keith Busch , Jens Axboe Subject: [PATCH for-4.14.y 4/4] nvme_fc: fix ctrl create failures racing with workq items Date: Wed, 10 Oct 2018 14:59:49 +0530 Message-Id: <1539163789-32338-4-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539163789-32338-1-git-send-email-amit.pundir@linaro.org> References: <1539163789-32338-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: James Smart commit cf25809bec2c7df4b45df5b2196845d9a4a3c89b upstream. If there are errors during initial controller create, the transport will teardown the partially initialized controller struct and free the ctlr memory. Trouble is - most of those errors can occur due to asynchronous events happening such io timeouts and subsystem connectivity failures. Those failures invoke async workq items to reset the controller and attempt reconnect. Those may be in progress as the main thread frees the ctrl memory, resulting in NULL ptr oops. Prevent this from happening by having the main ctrl failure thread changing state to DELETING followed by synchronously cancelling any pending queued work item. The change of state will prevent the scheduling of resets or reconnect events. Signed-off-by: James Smart Signed-off-by: Keith Busch Signed-off-by: Jens Axboe Signed-off-by: Amit Pundir --- Build tested on 4.14.74 for ARCH=arm/arm64 allmodconfig. drivers/nvme/host/fc.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.7.4 diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 7deb7b5d8683..058d542647dd 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -2868,6 +2868,10 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, } if (ret) { + nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_DELETING); + cancel_work_sync(&ctrl->ctrl.reset_work); + cancel_delayed_work_sync(&ctrl->connect_work); + /* couldn't schedule retry - fail out */ dev_err(ctrl->ctrl.device, "NVME-FC{%d}: Connect retry failed\n", ctrl->cnum);