kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: sco: prevent information leak in sco_conn_defer_accept()
@ 2021-06-25 15:00 Dan Carpenter
  2021-07-22 14:14 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-06-25 15:00 UTC (permalink / raw)
  To: Marcel Holtmann, Frédéric Dalleau
  Cc: Johan Hedberg, Luiz Augusto von Dentz, Gustavo Padovan,
	linux-bluetooth, kernel-janitors

Smatch complains that some of these struct members are not initialized
leading to a stack information disclosure:

    net/bluetooth/sco.c:778 sco_conn_defer_accept() warn:
    check that 'cp.retrans_effort' doesn't leak information

This seems like a valid warning.  I've added a default case to fix
this issue.  It's sort of unusual to have case SCO_AIRMODE_CVSD,
followed by a default case but I think it's nicely readable.  :)

Fixes: 2f69a82acf6f ("Bluetooth: Use voice setting in deferred SCO connection request")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 net/bluetooth/sco.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index d9a4e88dacbb..e2ee00fea64b 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -770,6 +770,7 @@ static void sco_conn_defer_accept(struct hci_conn *conn, u16 setting)
 			cp.retrans_effort = 0x02;
 			break;
 		case SCO_AIRMODE_CVSD:
+		default:
 			cp.max_latency = cpu_to_le16(0xffff);
 			cp.retrans_effort = 0xff;
 			break;
-- 
2.30.2


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

* Re: [PATCH] Bluetooth: sco: prevent information leak in sco_conn_defer_accept()
  2021-06-25 15:00 [PATCH] Bluetooth: sco: prevent information leak in sco_conn_defer_accept() Dan Carpenter
@ 2021-07-22 14:14 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2021-07-22 14:14 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Frédéric Dalleau, Johan Hedberg,
	Luiz Augusto von Dentz, Gustavo Padovan, linux-bluetooth,
	kernel-janitors

Hi Dan,

> Smatch complains that some of these struct members are not initialized
> leading to a stack information disclosure:
> 
>    net/bluetooth/sco.c:778 sco_conn_defer_accept() warn:
>    check that 'cp.retrans_effort' doesn't leak information
> 
> This seems like a valid warning.  I've added a default case to fix
> this issue.  It's sort of unusual to have case SCO_AIRMODE_CVSD,
> followed by a default case but I think it's nicely readable.  :)
> 
> Fixes: 2f69a82acf6f ("Bluetooth: Use voice setting in deferred SCO connection request")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> net/bluetooth/sco.c | 1 +
> 1 file changed, 1 insertion(+)

I actually prefer a separate default statement since otherwise I get confused. Your patch with that minor change has been applied to bluetooth-next tree.

Regards

Marcel


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

end of thread, other threads:[~2021-07-22 14:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25 15:00 [PATCH] Bluetooth: sco: prevent information leak in sco_conn_defer_accept() Dan Carpenter
2021-07-22 14:14 ` Marcel Holtmann

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).