linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kc27041980@gmail.com
To: "Rafael J . Wysocki" <rjw@rjwysocki.net>, Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	KC27041980 <kc27041980@gmail.com>
Subject: [PATCH 1/1] acpi/ec.c: Move call to kref_get() to under the mutex_lock(&ec->mutex)
Date: Mon, 25 Nov 2019 16:33:18 +0530	[thread overview]
Message-ID: <1574679798-18958-1-git-send-email-KC17041980@gmail.com> (raw)

From: KC27041980 <kc27041980@gmail.com>

Move call to kref_get() to under the mutex_lock(&ec->mutex) as this
will remove any delete race scenarios.

Signed-off-by: KC27041980 <kc27041980@gmail.com>
---
 drivers/acpi/ec.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index da1e5c5..9c1bd57 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -1073,8 +1073,12 @@ acpi_ec_get_query_handler_by_value(struct acpi_ec *ec, u8 value)
 			break;
 		}
 	}
+
+	if (found)
+		acpi_ec_get_query_handler(handler);
 	mutex_unlock(&ec->mutex);
-	return found ? acpi_ec_get_query_handler(handler) : NULL;
+
+	return found ? handler : NULL;
 }
 
 static void acpi_ec_query_handler_release(struct kref *kref)
-- 
2.7.4


             reply	other threads:[~2019-11-25 11:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-25 11:03 kc27041980 [this message]
2019-12-16 11:16 ` [PATCH 1/1] acpi/ec.c: Move call to kref_get() to under the mutex_lock(&ec->mutex) Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1574679798-18958-1-git-send-email-KC17041980@gmail.com \
    --to=kc27041980@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).