diff mbox series

[SRU,M,1/1] tty: n_gsm: require CAP_NET_ADMIN to attach N_GSM0710 ldisc

Message ID 20240605185445.19509-2-bethany.jamison@canonical.com
State New
Headers show
Series CVE-2023-52880 | expand

Commit Message

Bethany Jamison June 5, 2024, 6:54 p.m. UTC
From: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>

Any unprivileged user can attach N_GSM0710 ldisc, but it requires
CAP_NET_ADMIN to create a GSM network anyway.

Require initial namespace CAP_NET_ADMIN to do that.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Link: https://lore.kernel.org/r/20230731185942.279611-1-cascardo@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 67c37756898a5a6b2941a13ae7260c89b54e0d88)
CVE-2023-52880
Signed-off-by: Bethany Jamison <bethany.jamison@canonical.com>
---
 drivers/tty/n_gsm.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 897bd575330c2..4492740b911d9 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -3575,6 +3575,9 @@  static int gsmld_open(struct tty_struct *tty)
 {
 	struct gsm_mux *gsm;
 
+	if (!capable(CAP_NET_ADMIN))
+		return -EPERM;
+
 	if (tty->ops->write == NULL)
 		return -EINVAL;