The shared pd feature in Oracle Linux was added by
commit
a1911c2c180d ("IB/Shared PD support from Oracle").
It adds a field named shpd to 'struct ib_pd' but fails to
initialize it in all the places it is allocated.
This results its uninitialized content being referenced
in mlx4_ib_dealloc_pd() and actions taken based on it
which eventually leads to resource leaks even when shared
pd feature is not being used.
This fix here initializes it to NULL in ib_alloc_pd() where
the ib_core module allocates the data structure.
Orabug:
29384815
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
Reviewed-by: Rama Nichanamatlu <rama.nichanamatlu@oracle.com>
Reviewed-by: HÃ¥kon Bugge <haakon.bugge@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
pd = device->alloc_pd(device, NULL, NULL);
if (!IS_ERR(pd)) {
+ /* init all fields of allocated object */
pd->device = device;
pd->uobject = NULL;
+ pd->shpd = NULL;
atomic_set(&pd->usecnt, 0);
}