 sunrpc: handle SVC_GARBAGE during svc auth processing as auth error · gregkh/linux@c90459c · 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 c90459c Browse files Browse files jtlayton authored and gregkh committed sunrpc: handle SVC_GARBAGE during svc auth processing as auth error commit 94d10a4 upstream. tianshuo han reported a remotely-triggerable crash if the client sends a kernel RPC server a specially crafted packet. If decoding the RPC reply fails in such a way that SVC_GARBAGE is returned without setting the rq_accept_statp pointer, then that pointer can be dereferenced and a value stored there. If it's the first time the thread has processed an RPC, then that pointer will be set to NULL and the kernel will crash. In other cases, it could create a memory scribble. The server sunrpc code treats a SVC_GARBAGE return from svc_authenticate or pg_authenticate as if it should send a GARBAGE_ARGS reply. RFC 5531 says that if authentication fails that the RPC should be rejected instead with a status of AUTH_ERR. Handle a SVC_GARBAGE return as an AUTH_ERROR, with a reason of AUTH_BADCRED instead of returning GARBAGE_ARGS in that case. This sidesteps the whole problem of touching the rpc_accept_statp pointer in this situation and avoids the crash. Cc: stable@kernel.org Fixes: 29cd292 ("SUNRPC: Fix encoding of accepted but unsuccessful RPC replies") Reported-by: tianshuo han &lt;hantianshuo233@gmail.com&gt; Reviewed-by: Chuck Lever &lt;chuck.lever@oracle.com&gt; Signed-off-by: Jeff Layton &lt;jlayton@kernel.org&gt; Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt; Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt; 1 parent eeb37e4 commit c90459c Copy full SHA for c90459c 1 file changed + 2 - 9 Lines changed: 2 additions &amp; 9 deletions File tree Expand file tree Collapse file tree Open diff view settings Filter options net/sunrpc svc.c Expand file tree Collapse file tree Open diff view settings Collapse file ‎ net/sunrpc/svc.c ‎ Copy file name to clipboard Expand all lines: net/sunrpc/svc.c + 2 - 9 Lines changed: 2 additions &amp; 9 deletions Original file line number Diff line number Diff line change @@ -1369,7 +1369,8 @@ svc_process_common(struct svc_rqst *rqstp) 1369 1369 case SVC_OK : 1370 1370 break ; 1371 1371 case SVC_GARBAGE : 1372 - goto err_garbage_args ; 1372 + rqstp -&gt; rq_auth_stat = rpc_autherr_badcred ; 1373 + goto err_bad_auth ; 1373 1374 case SVC_SYSERR : 1374 1375 goto err_system_err ; 1375 1376 case SVC_DENIED : @@ -1510,14 +1511,6 @@ svc_process_common(struct svc_rqst *rqstp) 1510 1511 * rqstp -&gt; rq_accept_statp = rpc_proc_unavail ; 1511 1512 goto sendit ; 1512 1513 1513 - err_garbage_args : 1514 - svc_printk ( rqstp , &quot;failed to decode RPC header\n&quot; ); 1515 - 1516 - if ( serv -&gt; sv_stats ) 1517 - serv -&gt; sv_stats -&gt; rpcbadfmt ++ ; 1518 - * rqstp -&gt; rq_accept_statp = rpc_garbage_args ; 1519 - goto sendit ; 1520 - 1521 1514 err_system_err : 1522 1515 if ( serv -&gt; sv_stats ) 1523 1516 serv -&gt; sv_stats -&gt; rpcbadfmt ++ ; 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. 