[Bug 261454] Fix a possible Null pointer dereference about svc_xprt_alloc()

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 25 Jan 2022 04:18:40 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261454

            Bug ID: 261454
           Summary: Fix a possible Null pointer dereference about
                    svc_xprt_alloc()
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: zhou1615@umn.edu

Created attachment 231294
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=231294&action=edit
A simple fix for this bugs

In sys/rpc/svc_vc.c() file, the return value of svc_xprt_alloc() is not checked
before the dereference in svc_vc_create_conn() function,
svc_vc_create_backchannel() function and svc_vc_create(). svc_xprt_alloc()
could return NULL on failure of allocation, which could lead to NULL pointer
dereference.

Fix this bugs by adding checks of svc_xprt_alloc() in all three functions.

This bug is found by static analyzer, please advise.

-- 
You are receiving this mail because:
You are the assignee for the bug.