From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Todd Poynor <toddpoynor@gmail.com>
Cc: Rob Springer <rspringer@google.com>,
John Joseph <jnjoseph@google.com>,
Ben Chan <benchan@chromium.org>,
devel@driverdev.osuosl.org, Todd Poynor <toddpoynor@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] staging: gasket: core: hold reference on device kobj while in use
Date: Sat, 28 Jul 2018 09:23:50 +0200 [thread overview]
Message-ID: <20180728072350.GA9809@kroah.com> (raw)
In-Reply-To: <20180728052200.228796-6-toddpoynor@gmail.com>
On Fri, Jul 27, 2018 at 10:22:00PM -0700, Todd Poynor wrote:
> From: Todd Poynor <toddpoynor@google.com>
>
> Hold a reference on the struct device kobject while a pointer to that
> device is in use by gasket.
>
> Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Todd Poynor <toddpoynor@google.com>
> ---
> drivers/staging/gasket/gasket_core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
> index 859a6df9e12df..1dc7273e38734 100644
> --- a/drivers/staging/gasket/gasket_core.c
> +++ b/drivers/staging/gasket/gasket_core.c
> @@ -449,6 +449,7 @@ static int gasket_alloc_dev(
> gasket_dev->dev_idx = dev_idx;
> snprintf(gasket_dev->kobj_name, GASKET_NAME_MAX, "%s", kobj_name);
> gasket_dev->dev = parent;
> + kobject_get(&gasket_dev->dev->kobj);
Hint, if you are a driver, working with devices, you should never call a
kobject_* or sysfs_* call. If you are, you are doing something really
wrong and odd and should seriously reconsider it. No driver should ever
be touching a "raw" kobject.
For this case, get_device()/put_device() is what you should be using.
thanks,
greg k-h
prev parent reply other threads:[~2018-07-28 7:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-28 5:21 [PATCH 0/5] staging: gasket: fixes and cleanups Todd Poynor
2018-07-28 5:21 ` [PATCH 1/5] staging: gasket: sysfs: remove check for refcount already zero Todd Poynor
2018-07-28 5:21 ` [PATCH 2/5] staging: gasket: apex: fixup undefined PCI class Todd Poynor
2018-07-28 5:21 ` [PATCH 3/5] staging: gasket: sysfs: remove unnecessary NULL check on device ptr Todd Poynor
2018-07-28 5:21 ` [PATCH 4/5] staging: gasket: page table: remove code for "no dma_ops" Todd Poynor
2018-07-28 5:22 ` [PATCH 5/5] staging: gasket: core: hold reference on device kobj while in use Todd Poynor
2018-07-28 7:23 ` Greg Kroah-Hartman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180728072350.GA9809@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=benchan@chromium.org \
--cc=devel@driverdev.osuosl.org \
--cc=jnjoseph@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rspringer@google.com \
--cc=toddpoynor@gmail.com \
--cc=toddpoynor@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox