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
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 3 Oct 2022 10:02:16 +0000
From:   "Kumar, M Chetan" <m.chetan.kumar@...el.com>
To:     Maxim Mikityanskiy <maxtram95@...il.com>,
        linuxwwan <linuxwwan@...el.com>
CC:     Loic Poulain <loic.poulain@...aro.org>,
        Sergey Ryazanov <ryazanov.s.a@...il.com>,
        Johannes Berg <johannes@...solutions.net>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        "Jakub Kicinski" <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH net] net: wwan: iosm: Call mutex_init before locking it

> -----Original Message-----
> From: Maxim Mikityanskiy <maxtram95@...il.com>
> Sent: Saturday, October 1, 2022 4:27 PM
> To: Kumar, M Chetan <m.chetan.kumar@...el.com>; linuxwwan
> <linuxwwan@...el.com>
> Cc: Loic Poulain <loic.poulain@...aro.org>; Sergey Ryazanov
> <ryazanov.s.a@...il.com>; Johannes Berg <johannes@...solutions.net>;
> David S. Miller <davem@...emloft.net>; Eric Dumazet
> <edumazet@...gle.com>; Jakub Kicinski <kuba@...nel.org>; Paolo Abeni
> <pabeni@...hat.com>; netdev@...r.kernel.org; Maxim Mikityanskiy
> <maxtram95@...il.com>
> Subject: [PATCH net] net: wwan: iosm: Call mutex_init before locking it
> 
> 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@...il.com>
> ---
>  drivers/net/wwan/iosm/iosm_ipc_wwan.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wwan/iosm/iosm_ipc_wwan.c
> b/drivers/net/wwan/iosm/iosm_ipc_wwan.c
> index 27151148c782..4712f01a7e33 100644
> --- a/drivers/net/wwan/iosm/iosm_ipc_wwan.c
> +++ b/drivers/net/wwan/iosm/iosm_ipc_wwan.c
> @@ -323,15 +323,16 @@ struct iosm_wwan *ipc_wwan_init(struct
> iosm_imem *ipc_imem, struct device *dev)
>  	ipc_wwan->dev = dev;
>  	ipc_wwan->ipc_imem = ipc_imem;
> 
> +	mutex_init(&ipc_wwan->if_mutex);
> +
>  	/* WWAN core will create a netdev for the default IP MUX channel */
>  	if (wwan_register_ops(ipc_wwan->dev, &iosm_wwan_ops,
> ipc_wwan,
>  			      IP_MUX_SESSION_DEFAULT)) {
> +		mutex_destroy(&ipc_wwan->if_mutex);
>  		kfree(ipc_wwan);
>  		return NULL;
>  	}
> 
> -	mutex_init(&ipc_wwan->if_mutex);
> -
>  	return ipc_wwan;
>  }

Reviewed-by: M Chetan Kumar <m.chetan.kumar@...el.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ