[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191115102832.GA1647@linux-8ccs>
Date: Fri, 15 Nov 2019 11:28:33 +0100
From: Jessica Yu <jeyu@...nel.org>
To: Konstantin Khorenko <khorenko@...tuozzo.com>
Cc: Prarit Bhargava <prarit@...hat.com>,
Barret Rhoden <brho@...gle.com>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
linux-kernel@...r.kernel.org, David Arcari <darcari@...hat.com>,
Heiko Carstens <heiko.carstens@...ibm.com>
Subject: Re: [PATCH 1/1] kernel/module.c: wakeup processes in module_wq on
module unload
+++ Konstantin Khorenko [13/11/19 12:29 +0300]:
>Fix the race between load and unload a kernel module.
>
>sys_delete_module()
> try_stop_module()
> mod->state = _GOING
> add_unformed_module()
> old = find_module_all()
> (old->state == _GOING =>
> wait_event_interruptible())
>
> During pre-condition
> finished_loading() rets 0
> schedule()
> (never gets waken up later)
> free_module()
> mod->state = _UNFORMED
> list_del_rcu(&mod->list)
> (dels mod from "modules" list)
>
>return
>
>The race above leads to modprobe hanging forever on loading
>a module.
>
>Error paths on loading module call wake_up_all(&module_wq) after
>freeing module, so let's do the same on straight module unload.
>
>Fixes: 6e6de3dee51a ("kernel/module.c: Only return -EEXIST
>for modules that have finished loading")
>
>Signed-off-by: Konstantin Khorenko <khorenko@...tuozzo.com>
Thanks Konstantin for catching this. I've applied this to
modules-next.
Jessica
Powered by blists - more mailing lists