On Tue, 23 Mar 2021 14:55:22 -0300 Jason Gunthorpe <jgg@xxxxxxxxxx> wrote: > There is a small race where the parent is NULL even though the kobj has > already been made visible in sysfs. > > For instance the attribute_group is made visible in sysfs_create_files() > and the mdev_type_attr_show() does: > > ret = attr->show(kobj, type->parent->dev, buf); > > Which will crash on NULL parent. Move the parent setup to before the type > pointer leaves the stack frame. > > Fixes: 7b96953bc640 ("vfio: Mediated device Core driver") > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx> > --- > drivers/vfio/mdev/mdev_sysfs.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Cornelia Huck <cohuck@xxxxxxxxxx>