All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: ISO: Fix info leak in iso_sock_getsockopt()
@ 2022-07-28 22:11 Luiz Augusto von Dentz
  2022-07-28 23:03 ` bluez.test.bot
  2022-07-29  0:10 ` [PATCH] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2022-07-28 22:11 UTC (permalink / raw)
  To: linux-bluetooth

From: Dan Carpenter <dan.carpenter@oracle.com>

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,
so instead of using yet another variable and copy the QoS settings just
use a pointer to the stored QoS settings.

Fixes: ccf74f2390d6 ("Bluetooth: Add BTPROTO_ISO socket type")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 net/bluetooth/iso.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
index 19d003727b50..dded22cde0d1 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;
 	u8 base_len;
 	u8 *base;
 
@@ -1261,12 +1261,12 @@ static int iso_sock_getsockopt(struct socket *sock, int level, int optname,
 
 	case BT_ISO_QOS:
 		if (sk->sk_state == BT_CONNECTED || sk->sk_state == BT_CONNECT2)
-			qos = iso_pi(sk)->conn->hcon->iso_qos;
+			qos = &iso_pi(sk)->conn->hcon->iso_qos;
 		else
-			qos = iso_pi(sk)->qos;
+			qos = &iso_pi(sk)->qos;
 
-		len = min_t(unsigned int, len, sizeof(qos));
-		if (copy_to_user(optval, (char *)&qos, len))
+		len = min_t(unsigned int, len, sizeof(*qos));
+		if (copy_to_user(optval, qos, len))
 			err = -EFAULT;
 
 		break;
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: Bluetooth: ISO: Fix info leak in iso_sock_getsockopt()
  2022-07-28 22:11 [PATCH] Bluetooth: ISO: Fix info leak in iso_sock_getsockopt() Luiz Augusto von Dentz
@ 2022-07-28 23:03 ` bluez.test.bot
  2022-07-29  0:10 ` [PATCH] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2022-07-28 23:03 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 1855 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=663892

---Test result---

Test Summary:
CheckPatch                    FAIL      2.39 seconds
GitLint                       PASS      0.79 seconds
SubjectPrefix                 PASS      0.72 seconds
BuildKernel                   PASS      32.56 seconds
BuildKernel32                 PASS      28.31 seconds
Incremental Build with patchesPASS      39.94 seconds
TestRunner: Setup             PASS      465.81 seconds
TestRunner: l2cap-tester      PASS      16.35 seconds
TestRunner: bnep-tester       PASS      6.51 seconds
TestRunner: mgmt-tester       PASS      101.11 seconds
TestRunner: rfcomm-tester     PASS      9.82 seconds
TestRunner: sco-tester        PASS      9.07 seconds
TestRunner: smp-tester        PASS      9.62 seconds
TestRunner: userchan-tester   PASS      6.30 seconds

Details
##############################
Test: CheckPatch - FAIL - 2.39 seconds
Run checkpatch.pl script with rule in .checkpatch.conf
Bluetooth: ISO: Fix info leak in iso_sock_getsockopt()\ERROR:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Dan Carpenter <dan.carpenter@oracle.com>'

total: 1 errors, 0 warnings, 0 checks, 24 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/12931756.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.




---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Bluetooth: ISO: Fix info leak in iso_sock_getsockopt()
  2022-07-28 22:11 [PATCH] Bluetooth: ISO: Fix info leak in iso_sock_getsockopt() Luiz Augusto von Dentz
  2022-07-28 23:03 ` bluez.test.bot
@ 2022-07-29  0:10 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2022-07-29  0:10 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Thu, 28 Jul 2022 15:11:45 -0700 you wrote:
> From: Dan Carpenter <dan.carpenter@oracle.com>
> 
> 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,
> so instead of using yet another variable and copy the QoS settings just
> use a pointer to the stored QoS settings.
> 
> [...]

Here is the summary with links:
  - Bluetooth: ISO: Fix info leak in iso_sock_getsockopt()
    https://git.kernel.org/bluetooth/bluetooth-next/c/2cd0542726ba

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-29  0:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-28 22:11 [PATCH] Bluetooth: ISO: Fix info leak in iso_sock_getsockopt() Luiz Augusto von Dentz
2022-07-28 23:03 ` bluez.test.bot
2022-07-29  0:10 ` [PATCH] " patchwork-bot+bluetooth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.