 can: j1939: make j1939_session_activate() fail if device is no longer… · gregkh/linux@ebb0dfd · GitHub Skip to content Navigation Menu Toggle navigation Sign in Appearance settings Platform AI CODE CREATION GitHub Copilot Write better code with AI GitHub Spark Build and deploy intelligent apps GitHub Models Manage and compare prompts MCP Registry New Integrate external tools DEVELOPER WORKFLOWS Actions Automate any workflow Codespaces Instant dev environments Issues Plan and track work Code Review Manage code changes APPLICATION SECURITY GitHub Advanced Security Find and fix vulnerabilities Code security Secure your code as you build Secret protection  EXPLORE Why GitHub Documentation Blog Changelog Marketplace View all features Solutions BY COMPANY SIZE Enterprises Small and medium teams Startups Nonprofits BY USE CASE App Modernization DevSecOps DevOps CI/CD View all use cases BY INDUSTRY Healthcare Financial services Manufacturing Government View all industries View all solutions Resources EXPLORE BY TOPIC AI Software Development DevOps Security View all topics EXPLORE BY TYPE Customer stories Events &amp; webinars Ebooks &amp; reports Business insights GitHub Skills SUPPORT &amp; SERVICES Documentation Customer support Community forum Trust center Partners View all resources Open Source COMMUNITY GitHub Sponsors Fund open source developers PROGRAMS Security Lab Maintainer Community Accelerator GitHub Stars Archive Program REPOSITORIES Topics Trending Collections Enterprise ENTERPRISE SOLUTIONS Enterprise platform AI-powered developer platform AVAILABLE ADD-ONS GitHub Advanced Security Enterprise-grade security features Copilot for Business Enterprise-grade AI features Premium Support Enterprise-grade 24/7 support Pricing Search or jump to... Search code, repositories, users, issues, pull requests... --> Search Clear Search syntax tips Provide feedback --> We read every piece of feedback, and take your input very seriously.  Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly --> Name Query To see all available qualifiers, see our documentation . Cancel Create saved search Sign in Sign up Appearance settings Resetting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} gregkh / linux Public Notifications You must be signed in to change notification settings Fork 676 Star 636 Code Actions Security and quality 0 Insights Additional navigation options Code Actions Security and quality Insights Commit ebb0dfd Browse files Browse files Tetsuo Handa authored and gregkh committed can: j1939: make j1939_session_activate() fail if device is no longer registered [ Upstream commit 5d56022 ] syzbot is still reporting unregister_netdevice: waiting for vcan0 to become free. Usage count = 2 even after commit 93a27b5 ("can: j1939: add missing calls in NETDEV_UNREGISTER notification handler") was added. A debug printk() patch found that j1939_session_activate() can succeed even after j1939_cancel_active_session() from j1939_netdev_notify(NETDEV_UNREGISTER) has completed. Since j1939_cancel_active_session() is processed with the session list lock held, checking ndev-&gt;reg_state in j1939_session_activate() with the session list lock held can reliably close the race window. Reported-by: syzbot &lt;syzbot+881d65229ca4f9ae8c84@syzkaller.appspotmail.com&gt; Closes: https://syzkaller.appspot.com/bug?extid=881d65229ca4f9ae8c84 Signed-off-by: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt; Acked-by: Oleksij Rempel &lt;o.rempel@pengutronix.de&gt; Link: https://patch.msgid.link/b9653191-d479-4c8b-8536-1326d028db5c@I-love.SAKURA.ne.jp Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt; Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt; 1 parent 02ac597 commit ebb0dfd Copy full SHA for ebb0dfd 1 file changed + 2 Lines changed: 2 additions &amp; 0 deletions File tree Expand file tree Collapse file tree Open diff view settings Filter options net/can/j1939 transport.c Expand file tree Collapse file tree Open diff view settings Collapse file ‎ net/can/j1939/transport.c ‎ Copy file name to clipboard Expand all lines: net/can/j1939/transport.c + 2 Lines changed: 2 additions &amp; 0 deletions Original file line number Diff line number Diff line change @@ -1555,6 +1555,8 @@ int j1939_session_activate(struct j1939_session *session) 1555 1555 if ( active ) { 1556 1556 j1939_session_put ( active ); 1557 1557 ret = - EAGAIN ; 1558 + } else if ( priv -&gt; ndev -&gt; reg_state != NETREG_REGISTERED ) { 1559 + ret = - ENODEV ; 1558 1560 } else { 1559 1561 WARN_ON_ONCE ( session -&gt; state != J1939_SESSION_NEW ); 1560 1562 list_add_tail ( &amp; session -&gt; active_session_list_entry , 0 commit comments Comments 0 ( 0 ) Footer &copy; 2026 GitHub,&nbsp;Inc. Footer navigation Terms Privacy Security Status Community Docs Contact Manage cookies Do not share my personal information You can’t perform that action at this time. 