Re: [Openlte-discuss] [Patch] Fix mutex double unlocks
An open source 3GPP LTE implementation.
Status: Alpha
Brought to you by:
bwojtowi
|
From: Ben W. <bwo...@gm...> - 2015-12-30 19:53:54
|
Damian,
Sorry for the delayed response. Almost all of the mutexes in the code were
switched to semaphores in the latest release. I double checked the areas
you provided in your patch for double posts and it appears ok.
Thanks,
Ben
On Wed, Sep 9, 2015 at 4:55 AM, Damian Jarek <dam...@ti...> wrote:
> Scoped locks are misused in a few places in enodeb code (the mutex is
> unlocked manually while a scoped lock still holds it, resulting in a double
> unlock). Here's a patch that fixes it:
>
>
> From d4f46393bf498ad8676f7286059af9b3993e1dfb Mon Sep 17 00:00:00 2001
> From: Damian Jarek <dam...@ti...>
> Date: Wed, 9 Sep 2015 10:10:20 +0200
> Subject: [PATCH] Fixed mutex double-unlocks.
>
> Unlocking the mutex directly, while a scoped_lock holds it causes the
> mutex to be unlocked the second time once the scoped_lock goes out of
> scope and its destructor is called.
> ---
> LTE_fdd_enodeb/src/LTE_fdd_enb_gw.cc | 2 +-
> LTE_fdd_enodeb/src/LTE_fdd_enb_hss.cc | 2 +-
> LTE_fdd_enodeb/src/LTE_fdd_enb_interface.cc | 4 ++--
> LTE_fdd_enodeb/src/LTE_fdd_enb_radio.cc | 4 ++--
> LTE_fdd_enodeb/src/LTE_fdd_enb_user_mgr.cc | 2 +-
> 5 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/LTE_fdd_enodeb/src/LTE_fdd_enb_gw.cc
> b/LTE_fdd_enodeb/src/LTE_fdd_enb_gw.cc
> index d4191c0..80537aa 100644
> --- a/LTE_fdd_enodeb/src/LTE_fdd_enb_gw.cc
> +++ b/LTE_fdd_enodeb/src/LTE_fdd_enb_gw.cc
> @@ -209,7 +209,7 @@ void LTE_fdd_enb_gw::stop(void)
> if(started)
> {
> started = false;
> - start_mutex.unlock();
> + lock.unlock();
> pthread_cancel(rx_thread);
> pthread_join(rx_thread, NULL);
>
> diff --git a/LTE_fdd_enodeb/src/LTE_fdd_enb_hss.cc
> b/LTE_fdd_enodeb/src/LTE_fdd_enb_hss.cc
> index 6e0d36a..3d3a78d 100644
> --- a/LTE_fdd_enodeb/src/LTE_fdd_enb_hss.cc
> +++ b/LTE_fdd_enodeb/src/LTE_fdd_enb_hss.cc
> @@ -217,7 +217,7 @@ LTE_FDD_ENB_ERROR_ENUM
> LTE_fdd_enb_hss::del_user(std::string imsi)
> err = LTE_FDD_ENB_ERROR_NONE;
> break;
> }
> - user_mutex.unlock();
> + lock.unlock();
>
> if(use_user_file)
> {
> diff --git a/LTE_fdd_enodeb/src/LTE_fdd_enb_interface.cc
> b/LTE_fdd_enodeb/src/LTE_fdd_enb_interface.cc
> index 916285e..c44f352 100644
> --- a/LTE_fdd_enodeb/src/LTE_fdd_enb_interface.cc
> +++ b/LTE_fdd_enodeb/src/LTE_fdd_enb_interface.cc
> @@ -984,7 +984,7 @@ void LTE_fdd_enb_interface::handle_start(void)
> if(!started)
> {
> started = true;
> - start_mutex.unlock();
> + lock.unlock();
>
> // Construct the system information
> cnfg_db->construct_sys_info();
> @@ -1056,7 +1056,7 @@ void LTE_fdd_enb_interface::handle_stop(void)
> if(started)
> {
> started = false;
> - start_mutex.unlock();
> + lock.unlock();
>
> // Stop all layers
> err = radio->stop();
> diff --git a/LTE_fdd_enodeb/src/LTE_fdd_enb_radio.cc
> b/LTE_fdd_enodeb/src/LTE_fdd_enb_radio.cc
> index 804cac0..9737930 100644
> --- a/LTE_fdd_enodeb/src/LTE_fdd_enb_radio.cc
> +++ b/LTE_fdd_enodeb/src/LTE_fdd_enb_radio.cc
> @@ -158,7 +158,7 @@ LTE_FDD_ENB_ERROR_ENUM LTE_fdd_enb_radio::start(void)
> if(0 != selected_radio_idx)
> {
> started = true;
> - start_mutex.unlock();
> + lock.unlock();
> try
> {
> // Get the DL and UL EARFCNs
> @@ -239,7 +239,7 @@ LTE_FDD_ENB_ERROR_ENUM LTE_fdd_enb_radio::stop(void)
> if(started)
> {
> started = false;
> - start_mutex.unlock();
> + lock.unlock();
> if(0 != selected_radio_idx)
> {
> usrp->issue_stream_cmd(cmd);
> diff --git a/LTE_fdd_enodeb/src/LTE_fdd_enb_user_mgr.cc
> b/LTE_fdd_enodeb/src/LTE_fdd_enb_user_mgr.cc
> index d16dafd..a19f5d8 100644
> --- a/LTE_fdd_enodeb/src/LTE_fdd_enb_user_mgr.cc
> +++ b/LTE_fdd_enodeb/src/LTE_fdd_enb_user_mgr.cc
> @@ -637,7 +637,7 @@ void
> LTE_fdd_enb_user_mgr::handle_c_rnti_timer_expiry(uint32 timer_id)
> }
> timer_id_map_forward.erase(forward_iter);
>
> - timer_id_mutex.unlock();
> + lock.unlock();
> release_c_rnti(c_rnti);
> }
> }
> --
> 1.7.9.5
>
>
>
> --
>
> *Pozdrawiam / Best regards, *
>
> *Damian Jarek, Junior Software Engineer*
>
> *Tieto Poland Sp. z o.o.*
>
> Swobodna 1, 50-088 Wroclaw, Poland, www.tieto.com
>
> *Tieto Poland spółka z ograniczoną odpowiedzialnością z siedzibą w
> Szczecinie, ul. Malczewskiego 26. Zarejestrowana w Sądzie Rejonowym
> Szczecin-Centrum w Szczecinie, XIII Wydział Gospodarczy Krajowego Rejestru
> Sądowego pod numerem 0000124858. NIP: 8542085557 <8542085557>. REGON:
> 812023656. Kapitał zakładowy: 4 271500 PLN*
>
>
> ------------------------------------------------------------------------------
> Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
> Get real-time metrics from all of your servers, apps and tools
> in one place.
> SourceForge users - Click here to start your Free Trial of Datadog now!
> http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
> _______________________________________________
> Openlte-discuss mailing list
> Ope...@li...
> https://lists.sourceforge.net/lists/listinfo/openlte-discuss
>
>
|