From nobody Mon Feb 9 08:30:10 2026 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4DA93358A3 for ; Thu, 29 Jan 2026 03:11:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769656299; cv=none; b=ozHCUiPxVjldjEhxJ97CpkhUKl+f3ke66fOzytnQPVj3MCKtPjKbCkoi4kgmxgr2e6ltOsuYYVng5mspevRUgj5P95WZyuJoSiLXEsOk5lw55rdAj9iOtRMjL+e3F+HVs8EI7B1Xo6t9ZhszkdAE5JAxY3f2LsKS3ySIqQxGd90= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769656299; c=relaxed/simple; bh=ji+mYPFRCqdMnMluhdPnzHWfS6NeTlfDWXmEfqSErag=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qGGDIlRzmCbXFKbCsz8C++2e0lJkspu9f0p7xwZSFvFKg0hh3bkFCl7VsOVqkpnqul+qBCBxU3IIO3W3TAE1hD+5f8uY91qf7/Egl0jxKEUOadmN+20RV2+Zxhw+yOyRa7jRViYaw13HY5QsVeSXhM3ZP9NMTbNz+D0rE4Tiefw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=kNWAnEmJ; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="kNWAnEmJ" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-823210d1d8eso231102b3a.1 for ; Wed, 28 Jan 2026 19:11:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1769656297; x=1770261097; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=JWJWtMvK3cJ/FZi3+gRtm63An6XKMQkwUbbJsEmUhfg=; b=kNWAnEmJ2ETKf3i+YJAeUn7dcr8mETIzYmD2Xdta2jCVAZdlhiVZhXrJsz3XolNGB0 u6/MYaDDG5iOXupVPX7gBjVa52XTnnO+Mdrb4IkiuSXIR24lL8UNZQ7x7v8EruLDvbUH m0tYzEToULHFceaiw7ORoeAUN8q5YNLqeR8gw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769656297; x=1770261097; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JWJWtMvK3cJ/FZi3+gRtm63An6XKMQkwUbbJsEmUhfg=; b=ivN0jeAnVr34zcFGznetWZXFJAIcuKDSI61Kq3NiV/RPWI9tFxY66aJ8CRo0RMpuBq m+sHrwq5Hf8+8y9M0SXlmbsAHe/Hk9Ok7f+z9dCSdFtDEKjDJPTG7e83UTNDHM68+Drs rmG42YsR3e3BpXoBgmIaWmouC2zexeP6GQfeuVqwqIvZuLIhhrLujKmAp7NQ7Tej1tZ8 t0kZApUEf/neb8qfjdKpC5wlJOoRrd9udhls193oy+vuj+iIxjjM8JtJAI5jh/B3xpuH Im8VxVCSS12BECshXZsfg2R3+NJxCyb6w52fcaUSqKle1splgOpPI4SwVwxleGLNayjV HCaA== X-Forwarded-Encrypted: i=1; AJvYcCXEkLtaPjuPuHD5/eXR5BKrg+299SDfwO57jqcDEXb9JmcZCPOn5hyNEyc9BiL4kQdj0pylZbbuKwlZz0E=@vger.kernel.org X-Gm-Message-State: AOJu0YzDsqGnh4FomMdJ3EI5/lHrblLXXJDojL1/V2X/HfyFztd0mw1V ozq5uKQsFBEuWPTSPywgD4kVVjZjcI0mveTgB3U6b8/i3ZpTLbIPbWlLIkF5LjzOoQ== X-Gm-Gg: AZuq6aKxkLC5Ih23qH/RFgdQ1CAbxXuTgcC7j0aLyh3cjgnxbQ+zAr2l0zLClM9nkG/ BUEA8PL99Y3EtofloHpt5tuSjufN4Qlnt1bQCZNvzLmYvTNYmJEDaqk2G4ReSKNGT+3Xs8AwP/r 28ySV/L8iDNAWH+r5yuoaDa6cvK510TVXFxG0waS+GQ7uKRGP3prozPLNXAzYUNliOyD+GdWT1Q 9ImpobhFr1/g7NhkbUjPuC+QGuKAMlPfBypQQOpkrGMRYB4YSopWEuQvUGsdq5dWwi0UBEn0kls DSki56DYMao7IaR08T8R6SgEUDQps1w129hP+NvQ8C5uXAuZkuC+va2+DvR6rfuZ0PSeoHC08Y3 CyJ24j+BwETBqnqzmiI5g8pK7aHhHjsCQ1b8IaxynH9JlpzwtqxKqIfrJBv2j2bFHbZ12XZhqKJ xNvT/mjXuk5p5nTMPwfvGOfzKRytYVPGIacgBZ0OZTCXaYivcoasWJca/uAFRxJz3/uLMm8KmS X-Received: by 2002:a05:6a00:244e:b0:81d:d666:72e1 with SMTP id d2e1a72fcca58-8236914777amr6825599b3a.10.1769656297157; Wed, 28 Jan 2026 19:11:37 -0800 (PST) Received: from tigerii.tok.corp.google.com ([2a00:79e0:2031:6:356d:f98:467f:7e27]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82379b1ee89sm3898394b3a.14.2026.01.28.19.11.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jan 2026 19:11:36 -0800 (PST) From: Sergey Senozhatsky To: Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Andrew Lunn Cc: Douglas Anderson , Tomasz Figa , George-Daniel Matei , linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: [PATCHv2] net: usb: r8152: fix resume reset deadlock Date: Thu, 29 Jan 2026 12:10:30 +0900 Message-ID: <20260129031106.3805887-1-senozhatsky@chromium.org> X-Mailer: git-send-email 2.53.0.rc1.217.geba53bf80e-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" rtl8152 can trigger device reset during reset which potentially can result in a deadlock: **** DPM device timeout after 10 seconds; 15 seconds until panic **** Call Trace: schedule+0x483/0x1370 schedule_preempt_disabled+0x15/0x30 __mutex_lock_common+0x1fd/0x470 __rtl8152_set_mac_address+0x80/0x1f0 dev_set_mac_address+0x7f/0x150 rtl8152_post_reset+0x72/0x150 usb_reset_device+0x1d0/0x220 rtl8152_resume+0x99/0xc0 usb_resume_interface+0x3e/0xc0 usb_resume_both+0x104/0x150 usb_resume+0x22/0x110 The problem is that rtl8152 resume calls reset under tp->control mutex while reset basically re-enters rtl8152 and attempts to acquire the same tp->control lock once again. Reset INACCESSIBLE device outside of tp->control mutex scope to avoid recursive mutex_lock() deadlock. Fixes: 4933b066fefb ("r8152: If inaccessible at resume time, issue a reset") Reviewed-by: Douglas Anderson Signed-off-by: Sergey Senozhatsky --- v1 -> v2: - incorporated review feedback from Doug drivers/net/usb/r8152.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 30f937527cd2..5e556e26c682 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -8538,19 +8538,6 @@ static int rtl8152_system_resume(struct r8152 *tp) usb_submit_urb(tp->intr_urb, GFP_NOIO); } =20 - /* If the device is RTL8152_INACCESSIBLE here then we should do a - * reset. This is important because the usb_lock_device_for_reset() - * that happens as a result of usb_queue_reset_device() will silently - * fail if the device was suspended or if too much time passed. - * - * NOTE: The device is locked here so we can directly do the reset. - * We don't need usb_lock_device_for_reset() because that's just a - * wrapper over device_lock() and device_resume() (which calls us) - * does that for us. - */ - if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) - usb_reset_device(tp->udev); - return 0; } =20 @@ -8661,19 +8648,33 @@ static int rtl8152_suspend(struct usb_interface *in= tf, pm_message_t message) static int rtl8152_resume(struct usb_interface *intf) { struct r8152 *tp =3D usb_get_intfdata(intf); + bool runtime_resume =3D test_bit(SELECTIVE_SUSPEND, &tp->flags); int ret; =20 mutex_lock(&tp->control); =20 rtl_reset_ocp_base(tp); =20 - if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) + if (runtime_resume) ret =3D rtl8152_runtime_resume(tp); else ret =3D rtl8152_system_resume(tp); =20 mutex_unlock(&tp->control); =20 + /* If the device is RTL8152_INACCESSIBLE here then we should do a + * reset. This is important because the usb_lock_device_for_reset() + * that happens as a result of usb_queue_reset_device() will silently + * fail if the device was suspended or if too much time passed. + * + * NOTE: The device is locked here so we can directly do the reset. + * We don't need usb_lock_device_for_reset() because that's just a + * wrapper over device_lock() and device_resume() (which calls us) + * does that for us. + */ + if (!runtime_resume && test_bit(RTL8152_INACCESSIBLE, &tp->flags)) + usb_reset_device(tp->udev); + return ret; } =20 --=20 2.53.0.rc1.217.geba53bf80e-goog