Skip to content

Commit

Permalink
tty: n_gsm: require CAP_NET_ADMIN to attach N_GSM0710 ldisc
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thadeu Lima de Souza Cascardo authored and gregkh committed Aug 4, 2023
1 parent fcb451f commit 67c3775
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/tty/n_gsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3576,6 +3576,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;

Expand Down

0 comments on commit 67c3775

Please sign in to comment.