All of lore.kernel.org
 help / color / mirror / Atom feed
From: caiwen.zhang@intel.com
To: ofono@ofono.org
Subject: [PATCH] gprs: avoid remove context when context operation is in progress
Date: Tue, 01 Nov 2016 14:19:11 +0800	[thread overview]
Message-ID: <1477981151-28551-1-git-send-email-caiwen.zhang@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 947 bytes --]

From: Caiwen Zhang <caiwen.zhang@intel.com>

If remove the context before context activation / deactivation is
completed, it may cause crash.
---
 src/gprs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index 3a4a819..4aa00f9 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -2154,13 +2154,13 @@ static DBusMessage *gprs_remove_context(DBusConnection *conn,
 	if (ctx == NULL)
 		return __ofono_error_not_found(msg);
 
+	/* This context is already being messed with */
+	if (ctx->pending)
+		return __ofono_error_busy(msg);
+
 	if (ctx->active) {
 		struct ofono_gprs_context *gc = ctx->context_driver;
 
-		/* This context is already being messed with */
-		if (ctx->pending)
-			return __ofono_error_busy(msg);
-
 		gprs->pending = dbus_message_ref(msg);
 		gc->driver->deactivate_primary(gc, ctx->context.cid,
 					gprs_deactivate_for_remove, ctx);
-- 
1.9.1


             reply	other threads:[~2016-11-01  6:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-01  6:19 caiwen.zhang [this message]
2016-11-01 16:35 ` [PATCH] gprs: avoid remove context when context operation is in progress Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2016-11-01  5:51 caiwen.zhang

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=1477981151-28551-1-git-send-email-caiwen.zhang@intel.com \
    --to=caiwen.zhang@intel.com \
    --cc=ofono@ofono.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.