linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rui Miguel Silva <rui.silva@linaro.org>
To: Johan Hovold <johan@kernel.org>
Cc: 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,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	stable <stable@vger.kernel.org>
Subject: Re: [PATCH] staging: greybus: power_supply: fix prop-descriptor request size
Date: Thu, 04 Apr 2019 08:06:53 +0100	[thread overview]
Message-ID: <m38swqp7ua.fsf@linaro.org> (raw)
In-Reply-To: <20190404065330.12382-1-johan@kernel.org>

Hi Johan,
Thanks for the patch.

On Thu 04 Apr 2019 at 07:53, Johan Hovold wrote:
> Since moving the message buffers off the stack, the dynamically
> allocated get-prop-descriptor request buffer is incorrectly 
> sized due to
> using the pointer rather than request-struct size when creating 
> the
> operation.
>
> Fortunately, the pointer size is always larger than this 
> one-byte
> request, but this could still cause trouble on the remote end 
> due to the
> unexpected message size.
>
> Fixes: 9d15134d067e ("greybus: power_supply: rework get 
> descriptors")
> Cc: stable <stable@vger.kernel.org>     # 4.9
> Cc: Rui Miguel Silva <rui.silva@linaro.org>
> Signed-off-by: Johan Hovold <johan@kernel.org>

Nice catch. LGTM.

Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>

---
Cheers,
	Rui


> ---
>  drivers/staging/greybus/power_supply.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/greybus/power_supply.c 
> b/drivers/staging/greybus/power_supply.c
> index 0529e5628c24..ae5c0285a942 100644
> --- a/drivers/staging/greybus/power_supply.c
> +++ b/drivers/staging/greybus/power_supply.c
> @@ -520,7 +520,7 @@ static int 
> gb_power_supply_prop_descriptors_get(struct gb_power_supply 
> *gbpsy)
>  
>  	op = gb_operation_create(connection,
>  				 GB_POWER_SUPPLY_TYPE_GET_PROP_DESCRIPTORS,
> -				 sizeof(req), sizeof(*resp) + 
> props_count *
> +				 sizeof(*req), sizeof(*resp) + 
> props_count *
>  				 sizeof(struct 
>  gb_power_supply_props_desc),
>  				 GFP_KERNEL);
>  	if (!op)


      reply	other threads:[~2019-04-04  7:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-04  6:53 [PATCH] staging: greybus: power_supply: fix prop-descriptor request size Johan Hovold
2019-04-04  7:06 ` 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=m38swqp7ua.fsf@linaro.org \
    --to=rui.silva@linaro.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=elder@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=greybus-dev@lists.linaro.org \
    --cc=gustavo@embeddedor.com \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.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).