From: Dan Carpenter <dan.carpenter@oracle.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
linux-bluetooth@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/2] Bluetooth: ISO: fix info leak in iso_sock_getsockopt()
Date: Wed, 27 Jul 2022 15:10:24 +0300 [thread overview]
Message-ID: <YuErMEjse5lgAMO3@kili> (raw)
In-Reply-To: <YuEq2Aey0VOrxPB+@kili>
The "qos" struct has holes after the in and out struct members. Zero
out those holes to prevent leaking stack information.
The C standard rules for when struct holes are zeroed out are slightly
weird. The existing assignments might initialize everything, but GCC
is allowed to (and does sometimes) leave the struct holes uninitialized.
However, when you have a struct initializer that doesn't initialize
every member then the holes must be zeroed.
Fixes: ccf74f2390d6 ("Bluetooth: Add BTPROTO_ISO socket type")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
net/bluetooth/iso.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
index 19d003727b50..c982087d3b52 100644
--- a/net/bluetooth/iso.c
+++ b/net/bluetooth/iso.c
@@ -1235,7 +1235,7 @@ static int iso_sock_getsockopt(struct socket *sock, int level, int optname,
{
struct sock *sk = sock->sk;
int len, err = 0;
- struct bt_iso_qos qos;
+ struct bt_iso_qos qos = {}; /* zero out struct holes */
u8 base_len;
u8 *base;
--
2.35.1
next prev parent reply other threads:[~2022-07-27 12:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-27 12:08 [PATCH 1/2] Bluetooth: ISO: unlock on error path in iso_sock_setsockopt() Dan Carpenter
2022-07-27 12:10 ` Dan Carpenter [this message]
2022-07-27 19:51 ` [PATCH 2/2] Bluetooth: ISO: fix info leak in iso_sock_getsockopt() Luiz Augusto von Dentz
2022-07-28 6:40 ` Dan Carpenter
2022-07-27 13:37 ` [1/2] Bluetooth: ISO: unlock on error path in iso_sock_setsockopt() bluez.test.bot
2022-07-27 20:00 ` [PATCH 1/2] " patchwork-bot+bluetooth
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=YuErMEjse5lgAMO3@kili \
--to=dan.carpenter@oracle.com \
--cc=johan.hedberg@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.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