NvBufSurfaceFromFd failed

Dear all,

I use following OS and platform.
Jetpack 5.1.1
Jetson AGX Orin,

I used NvBufferCreateEx API to create buffer.
But it got NULL buffer pointer when used NvBufSurfaceFromFd.
I think, it maybe is bug about NvBufferCreateEx or NvBufSurfaceFromFd.
Could you give me suggestion or patch to fix the bug?

/* Following is my test code. */

#include "NvUtils.h"
#include <string.h>
#include "video_encode.h"
#include "nvbuf_utils.h"

int
main(int argc, char *argv[])
{    
    int ret = 0;    
    NvBufferCreateParams cParams;
    context_t ctx;
    NvBufSurface *nvbuf_surf = 0;
    int fd;
    
    ctx.width = 1280;
    ctx.height = 720;
    ctx.fps_n = 22;
    ctx.iframe_interval = 120;
    ctx.idr_interval = 120;
    ctx.stats = true;
    
    cParams.width = 1280;
    cParams.height = 720;
    cParams.layout = NvBufferLayout_Pitch;
    cParams.colorFormat = NvBufferColorFormat_YUV420;
    cParams.nvbuf_tag = NvBufferTag_VIDEO_ENC;
    cParams.payloadType = NvBufferPayload_SurfArray;
    
    /* Create output plane fd for DMABUF io-mode */
    ret = NvBufferCreateEx(&fd, &cParams);
        
    if(ret < 0)
    {
       printf("Failed to create NvBuffer");
       return ret;
    }
    else
    {
       printf("create NvBuffer OK, fd=%d\n", fd);
    }
    
    ret = NvBufSurfaceFromFd(fd, (void**)(&nvbuf_surf));
    if(ret < 0 || nvbuf_surf == NULL)
    {
       printf("NvBufSurfaceFromFd Failed, ret=%d, nvbuf_surf pointer= %p\n", ret, nvbuf_surf);
       NvBufferDestroy(fd);
       return ret;
    }
    
    NvBufferDestroy(fd);
    
    return ret;
}

/* test result , it got NULL buffer pointer */

create NvBuffer OK, fd=29
NvBufSurfaceFromFd Failed, ret=0, nvbuf_surf pointer= (nil)

Best regards

-Jason