From: Rui Miguel Silva <rmfrfs@gmail.com>
To: Johan Hovold <johan@kernel.org>
Cc: Rui Miguel Silva <rmfrfs@gmail.com>,
Viresh Kumar <vireshk@kernel.org>, Alex Elder <elder@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
greybus-dev@lists.linaro.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org, stable <stable@vger.kernel.org>
Subject: Re: [PATCH] staging: greybus: spilib: fix use-after-free after deregistration
Date: Sun, 29 Oct 2017 17:44:31 +0000 [thread overview]
Message-ID: <m3lgjtdf28.fsf@gmail.com> (raw)
In-Reply-To: <20171029120133.32585-1-johan@kernel.org>
Hi Johan,
Thanks for the patch.
On Sun 29 Oct 2017 at 12:01, Johan Hovold <johan@kernel.org> wrote:
> Remove erroneous spi_master_put() after controller deregistration which
> would access the already freed spi controller.
>
> Note that spi_unregister_master() drops our only controller reference.
>
> Fixes: ba3e67001b42 ("greybus: SPI: convert to a gpbridge driver")
> Cc: stable <stable@vger.kernel.org> # 4.9
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
---
Cheers,
Rui
> ---
> drivers/staging/greybus/spilib.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/greybus/spilib.c b/drivers/staging/greybus/spilib.c
> index e97b19148497..1e7321a1404c 100644
> --- a/drivers/staging/greybus/spilib.c
> +++ b/drivers/staging/greybus/spilib.c
> @@ -544,11 +544,14 @@ int gb_spilib_master_init(struct gb_connection *connection, struct device *dev,
>
> return 0;
>
> -exit_spi_unregister:
> - spi_unregister_master(master);
> exit_spi_put:
> spi_master_put(master);
>
> + return ret;
> +
> +exit_spi_unregister:
> + spi_unregister_master(master);
> +
> return ret;
> }
> EXPORT_SYMBOL_GPL(gb_spilib_master_init);
> @@ -558,7 +561,6 @@ void gb_spilib_master_exit(struct gb_connection *connection)
> struct spi_master *master = gb_connection_get_data(connection);
>
> spi_unregister_master(master);
> - spi_master_put(master);
> }
> EXPORT_SYMBOL_GPL(gb_spilib_master_exit);
prev parent reply other threads:[~2017-10-29 17:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-29 12:01 [PATCH] staging: greybus: spilib: fix use-after-free after deregistration Johan Hovold
2017-10-29 12:43 ` Viresh Kumar
2017-10-29 12:51 ` Johan Hovold
2017-10-29 12:53 ` Viresh Kumar
2017-10-29 17:44 ` Rui Miguel Silva [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=m3lgjtdf28.fsf@gmail.com \
--to=rmfrfs@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=vireshk@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).