> -----Original Message----- > From: linux-rdma-owner@xxxxxxxxxxxxxxx <linux-rdma- > owner@xxxxxxxxxxxxxxx> On Behalf Of Leon Romanovsky > Sent: Thursday, May 2, 2019 3:12 AM > To: Doug Ledford <dledford@xxxxxxxxxx>; Jason Gunthorpe > <jgg@xxxxxxxxxxxx> > Cc: Leon Romanovsky <leonro@xxxxxxxxxxxx>; RDMA mailing list <linux- > rdma@xxxxxxxxxxxxxxx>; Jason Gunthorpe <jgg@xxxxxxxx> > Subject: [PATCH rdma-next v1] RDMA/device: Don't fire uevent before device > is fully initialized > > From: Leon Romanovsky <leonro@xxxxxxxxxxxx> > > When the refcount is 0 the device is invisible to netlink. However in the > patch below the refcount = 1 was moved to after the device_add(). > This creates a race where userspace can issue a netlink query after the > device_add() event and not see the device as visible. > > Ensure that no uevent is fired before device is fully registered. > > Fixes: d79af7242bb2 ("RDMA/device: Expose ib_device_try_get(()") > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx> > --- > Changelog v0->v1: > * Dropped uevent suppress in compat devices. > --- > drivers/infiniband/core/device.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/infiniband/core/device.c > b/drivers/infiniband/core/device.c > index 8ae4906a60e7..7c51406e34e2 100644 > --- a/drivers/infiniband/core/device.c > +++ b/drivers/infiniband/core/device.c > @@ -1244,6 +1244,11 @@ int ib_register_device(struct ib_device *device, > const char *name) > > ib_device_register_rdmacg(device); > > + /* > + * Ensure that ADD uevent is not fired because it > + * too early amd device is not initialized yet. > + */ You probably sent older version? Minor nit comment correction. s/it too early amd/it is too early and