On Tue, Jun 04, 2024 at 02:08:30PM -0400, Felix Kuehling wrote: > > +int drm_gem_prime_handle_to_fd(struct drm_device *dev, > > + struct drm_file *file_priv, uint32_t handle, > > + uint32_t flags, > > + int *prime_fd) > > +{ > > + struct dma_buf *dmabuf; > > + int fd = get_unused_fd_flags(flags); > > + > > + if (fd < 0) > > + return fd; > > + > > + dmabuf = drm_gem_prime_handle_to_dmabuf(dev, file_priv, handle, flags); > > + if (IS_ERR(dmabuf)) > > + return PTR_ERR(dmabuf); That ought to be if (IS_ERR(dmabuf)) { put_unused_fd(fd); return PTR_ERR(dmabuf); } or we'll leak an allocated descriptor. Will fix and repost...