linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Gottwald <Gotti79@posteo.net>
To: marcel@holtmann.org
Cc: gregkh@linuxfoundation.org, gottwald@igel.com,
	Johan Hedberg <johan.hedberg@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: A2MP: Do not set rsp.id to zero
Date: Sun, 18 Oct 2020 18:25:47 +0200	[thread overview]
Message-ID: <f095b9edf561b7f36d45f3bf1ab92f0417b8d8ae.camel@posteo.net> (raw)
In-Reply-To: <1603008332-8402-1-git-send-email-gotti79@posteo.net>

Am Sonntag, den 18.10.2020, 10:05 +0200 schrieb Stefan Gottwald:
> Due to security reasons the rsp struct is not zerod out in one case this will
> also zero out the former set rsp.id which seems to be wrong.
> 
> Signed-off-by: Stefan Gottwald <gotti79@posteo.net>
> ---
>  net/bluetooth/a2mp.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
> index da7fd7c..7a1e0b7 100644
> --- a/net/bluetooth/a2mp.c
> +++ b/net/bluetooth/a2mp.c
> @@ -381,10 +381,11 @@ static int a2mp_getampassoc_req(struct amp_mgr *mgr, struct sk_buff *skb,
>  	hdev = hci_dev_get(req->id);
>  	if (!hdev || hdev->amp_type == AMP_TYPE_BREDR || tmp) {
>  		struct a2mp_amp_assoc_rsp rsp;
> -		rsp.id = req->id;
>  
>  		memset(&rsp, 0, sizeof(rsp));
>  
> +		rsp.id = req->id;
> +
>  		if (tmp) {
>  			rsp.status = A2MP_STATUS_COLLISION_OCCURED;
>  			amp_mgr_put(tmp);

As it seems I'm too slow there is already a fix from the author of the initial patch.

https://lore.kernel.org/linux-bluetooth/20201016180956.707681-2-luiz.dentz@gmail.com/

There is a additional patch in this series which might also be a important fix

https://lore.kernel.org/linux-bluetooth/20201016180956.707681-1-luiz.dentz@gmail.com/

Thanks to a LWN member pointing this out to me.


      reply	other threads:[~2020-10-18 16:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-18  8:05 [PATCH] Bluetooth: A2MP: Do not set rsp.id to zero Stefan Gottwald
2020-10-18 16:25 ` Stefan Gottwald [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=f095b9edf561b7f36d45f3bf1ab92f0417b8d8ae.camel@posteo.net \
    --to=gotti79@posteo.net \
    --cc=davem@davemloft.net \
    --cc=gottwald@igel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan.hedberg@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=netdev@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).