lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 26 Apr 2018 08:52:35 +0300 From: Dan Carpenter <dan.carpenter@...cle.com> To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Sun Peng <sun_peng@...sec.com.cn> Cc: Jiri Slaby <jslaby@...e.com>, linux-kernel@...r.kernel.org, security@...nel.org, Tony Lindgren <tony@...mide.com>, Lars Poeschel <poeschel@...onage.de>, Sascha Hauer <s.hauer@...gutronix.de> Subject: [PATCH 1/4] tty: n_gsm: add some locking around gsm_mux[] We should take "gsm_mux_lock" when we access gsm_mux[]. Reported-by: Sun Peng <sun_peng@...sec.com.cn> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com> diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 3b3e1f6632d7..cc7f68814200 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2898,18 +2898,22 @@ static int gsmtty_install(struct tty_driver *driver, struct tty_struct *tty) bool alloc = false; int ret; - line = line & 0x3F; if (mux >= MAX_MUX) return -ENXIO; - /* FIXME: we need to lock gsm_mux for lifetimes of ttys eventually */ - if (gsm_mux[mux] == NULL) - return -EUNATCH; + + line = line & 0x3F; if (line == 0 || line > 61) /* 62/63 reserved */ return -ECHRNG; + + spin_lock(&gsm_mux_lock); gsm = gsm_mux[mux]; + spin_unlock(&gsm_mux_lock); + if (!gsm) + return -EUNATCH; if (gsm->dead) return -EL2HLT; + /* If DLCI 0 is not yet fully open return an error. This is ok from a locking perspective as we don't have to worry about this
Powered by blists - more mailing lists