tty: n_gsm: fix resource allocation order in gsm_activate_mux()
authorDaniel Starke <daniel.starke@siemens.com>
Fri, 1 Jul 2022 12:23:32 +0000 (14:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:24:05 +0000 (14:24 +0200)
commite46bc8cacdb6d409303d9178ac56e927e3b2f002
treef68f287def4af9133f1d49708b411e76723c52ba
parentc9754e10f1a57c1be24f6fb0cade58253e05a109
tty: n_gsm: fix resource allocation order in gsm_activate_mux()

[ Upstream commit 7349660438603ed19282e75949561406531785a5 ]

Within gsm_activate_mux() all timers and locks are initiated before the
actual resource for the control channel is allocated. This can lead to race
conditions.

Allocate the control channel DLCI object first to avoid race conditions.

Fixes: e1eaea46bb40 ("tty: n_gsm line discipline")
Signed-off-by: Daniel Starke <daniel.starke@siemens.com>
Link: https://lore.kernel.org/r/20220701122332.2039-2-daniel.starke@siemens.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/n_gsm.c