The drm_gem_objects_lookup() helper allocates an object array and may take references on entries before returning an error. This relies on __GFP_ZERO initialization and is not documented clearly, which makes the API easy to misuse.
This series: 1. Documents the current failure semantics explicitly. 2. Adds drm_gem_objects_lookup_safe() which provides the same lookup but guarantees cleanup on failure (puts any acquired objects and frees the array), leaving successful behavior unchanged. No behavioral change is made to the existing API. Srinivasan Shanmugam (2): drm/gem: Document drm_gem_objects_lookup() failure semantics drm/gem: add drm_gem_objects_lookup_safe() helper drivers/gpu/drm/drm_gem.c | 68 ++++++++++++++++++++++++++++++++++++--- include/drm/drm_gem.h | 2 ++ 2 files changed, 66 insertions(+), 4 deletions(-) -- 2.34.1
