From 24b9a38b2bb67561ade8f288cbc380a86c6a010d Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Tue, 18 Apr 2017 04:06:18 +0000 Subject: [PATCH] scst: avoid possible side effect with WARN_ON_ONCE() Reported-By: David Butterfield git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7136 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 36456f224..41f59fdf8 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -4783,6 +4783,7 @@ static void scst_put_acg_work(struct work_struct *work) void scst_put_acg(struct scst_acg *acg) { struct scst_acg_put_work *put_work; + bool rc; put_work = kmalloc(sizeof(*put_work), GFP_KERNEL | __GFP_NOFAIL); if (WARN_ON_ONCE(!put_work)) { @@ -4801,7 +4802,9 @@ void scst_put_acg(struct scst_acg *acg) * Schedule the kref_put() call instead of invoking it directly to * avoid deep recursion and a stack overflow. */ - WARN_ON_ONCE(!queue_work(scst_release_acg_wq, &put_work->work)); + rc = queue_work(scst_release_acg_wq, &put_work->work); + WARN_ON_ONCE(!rc); + return; } void scst_get_acg(struct scst_acg *acg)