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 PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 16 Sep 2014 15:26:37 +0200 From: Richard Weinberger <richard@....at> To: dedekind1@...il.com Cc: linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org, Richard Weinberger <richard@....at> Subject: [PATCH 1/2] UBI: Call worker functions without work_sem held There is no need to call the worker function with work_sem held. We only need the semaphore to synchronize workers and protect the work list. Signed-off-by: Richard Weinberger <richard@....at> --- drivers/mtd/ubi/wl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index 20f4917..b1e2ed1 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c @@ -245,6 +245,7 @@ static int do_work(struct ubi_device *ubi) ubi->works_count -= 1; ubi_assert(ubi->works_count >= 0); spin_unlock(&ubi->wl_lock); + up_read(&ubi->work_sem); /* * Call the worker function. Do not touch the work structure @@ -254,7 +255,6 @@ static int do_work(struct ubi_device *ubi) err = wrk->func(ubi, wrk, 0); if (err) ubi_err("work failed with error code %d", err); - up_read(&ubi->work_sem); return err; } @@ -1452,7 +1452,7 @@ static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk, serve_prot_queue(ubi); /* And take care about wear-leveling */ - err = ensure_wear_leveling(ubi, 1); + err = ensure_wear_leveling(ubi, 0); return err; } @@ -1730,13 +1730,14 @@ int ubi_wl_flush(struct ubi_device *ubi, int vol_id, int lnum) ubi->works_count -= 1; ubi_assert(ubi->works_count >= 0); spin_unlock(&ubi->wl_lock); + up_read(&ubi->work_sem); err = wrk->func(ubi, wrk, 0); if (err) { - up_read(&ubi->work_sem); return err; } + down_read(&ubi->work_sem); spin_lock(&ubi->wl_lock); found = 1; break; -- 1.8.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists