Messages in this thread | | | Date | Tue, 22 Jun 2021 23:34:52 +0200 | From | Greg KH <> | Subject | Re: [PATCH] drivers/base/core: refcount kobject and bus on device attribute read / store |
| |
On Tue, Jun 22, 2021 at 02:06:59PM -0700, Luis Chamberlain wrote: > static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr, > char *buf) > { > - struct device_attribute *dev_attr = to_dev_attr(attr); > - struct device *dev = kobj_to_dev(kobj); > + struct device_attribute *dev_attr; > + struct device *dev; > + struct bus_type *bus = NULL; > ssize_t ret = -EIO; > > + dev = get_device(kobj_to_dev(kobj)); > + if (!dev) > + return ret;
That check is impossible to ever hit, please recognize what things like kobj_to_dev() really are doing when calling it.
thanks,
greg k-h
| |