[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YNJXfNfn4+CaKOyz@kroah.com>
Date: Tue, 22 Jun 2021 23:34:52 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Luis Chamberlain <mcgrof@...nel.org>
Cc: rafael@...nel.org, jeyu@...nel.org, ngupta@...are.org,
sergey.senozhatsky.work@...il.com, minchan@...nel.org,
axboe@...nel.dk, mbenes@...e.com, jpoimboe@...hat.com,
tglx@...utronix.de, keescook@...omium.org, jikos@...nel.org,
rostedt@...dmis.org, peterz@...radead.org,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
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
Powered by blists - more mailing lists