net: wwan: iosm: Call mutex_init before locking it
authorMaxim Mikityanskiy <maxtram95@gmail.com>
Sat, 1 Oct 2022 10:57:13 +0000 (13:57 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 10:34:49 +0000 (12:34 +0200)
commitdc4e9cd6d6a6493b7b195700b39042d484a5d850
treef00e448fbd1ee1a2fcf63a4bbedff8e78840d0d7
parent0b6516a4e3eb0e2dc88a538458f3f732940f44fd
net: wwan: iosm: Call mutex_init before locking it

[ Upstream commit ba0fbdb95da5ddd8db457ce6ba09d16dd979a294 ]

wwan_register_ops calls wwan_create_default_link, which ends up in the
ipc_wwan_newlink callback that locks ipc_wwan->if_mutex. However, this
mutex is not yet initialized by that point. Fix it by moving mutex_init
above the wwan_register_ops call. This also makes the order of
operations in ipc_wwan_init symmetric to ipc_wwan_deinit.

Fixes: 83068395bbfc ("net: iosm: create default link via WWAN core")
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
Reviewed-by: M Chetan Kumar <m.chetan.kumar@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wwan/iosm/iosm_ipc_wwan.c