Skip to contentSkip to conversation

cr: don't unlock ipc before freeing

PATCH In review Serge E. Hallyn 2 participants 2 messages May 29, 2009 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cr: don't unlock ipc before freeing

Sorry, this should have been a part of the analogous sem fix.

    [re commit 615744ad97 ... c/r: support share-memory sysv-ipc]
---
 ipc/checkpoint_msg.c |    4 ++--
 ipc/checkpoint_shm.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
ipc/checkpoint_msg.c +2 -2
index a988a9e..fb1a61e 100644
@@ -348,12 +348,12 @@ int restore_ipc_msg(struct ckpt_ctx *ctx)
 	msq->q_qnum = h->q_qnum;
 
 	ret = load_ipc_msg_hdr(ctx, h, msq);
-	ipc_unlock(perms);
 
 	if (ret < 0) {
 		ckpt_debug("msq: need to remove (%d)\n", ret);
 		freeque(current->nsproxy->ipc_ns, perms);
-	}
+	} else
+		ipc_unlock(perms);
 	up_write(&msg_ids->rw_mutex);
  out:
 	free_msg_list(&messages);  /* no-op if all ok, else cleanup msgs */
ipc/checkpoint_shm.c +2 -2
index 713f910..0d8eb14 100644
@@ -239,7 +239,6 @@ int restore_ipc_shm(struct ckpt_ctx *ctx)
 	get_file(file);
 
 	ret = load_ipc_shm_hdr(ctx, h, shp);
-	ipc_unlock(perms);
 	if (ret < 0)
 		goto mutex;
 
@@ -253,7 +252,8 @@ int restore_ipc_shm(struct ckpt_ctx *ctx)
 	if (ret < 0) {
 		ckpt_debug("shm: need to remove (%d)\n", ret);
 		do_shm_rmid(current->nsproxy->ipc_ns, perms);
-	}
+	} else
+		ipc_unlock(perms);
 	up_write(&shm_ids->rw_mutex);
  out:
 	ckpt_hdr_put(ctx, h);
Signature · 1 line
1.6.1

A message that is not in the archive (sent off-list or not yet received): 20090529212132.GA12973-r/[email protected]

#2 lore raw

It's in.

Quoted 51 lines · Serge E. Hallyn

Sorry, this should have been a part of the analogous sem fix.

    [re commit 615744ad97 ... c/r: support share-memory sysv-ipc]
---
 ipc/checkpoint_msg.c |    4 ++--
 ipc/checkpoint_shm.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
ipc/checkpoint_msg.c +2 -2
index a988a9e..fb1a61e 100644
@@ -348,12 +348,12 @@ int restore_ipc_msg(struct ckpt_ctx *ctx)
 	msq->q_qnum = h->q_qnum;
 
 	ret = load_ipc_msg_hdr(ctx, h, msq);
-	ipc_unlock(perms);
 
 	if (ret < 0) {
 		ckpt_debug("msq: need to remove (%d)\n", ret);
 		freeque(current->nsproxy->ipc_ns, perms);
-	}
+	} else
+		ipc_unlock(perms);
 	up_write(&msg_ids->rw_mutex);
  out:
 	free_msg_list(&messages);  /* no-op if all ok, else cleanup msgs */
ipc/checkpoint_shm.c +2 -2
index 713f910..0d8eb14 100644
@@ -239,7 +239,6 @@ int restore_ipc_shm(struct ckpt_ctx *ctx)
 	get_file(file);
 
 	ret = load_ipc_shm_hdr(ctx, h, shp);
-	ipc_unlock(perms);
 	if (ret < 0)
 		goto mutex;
 
@@ -253,7 +252,8 @@ int restore_ipc_shm(struct ckpt_ctx *ctx)
 	if (ret < 0) {
 		ckpt_debug("shm: need to remove (%d)\n", ret);
 		do_shm_rmid(current->nsproxy->ipc_ns, perms);
-	}
+	} else
+		ipc_unlock(perms);
 	up_write(&shm_ids->rw_mutex);
  out:
 	ckpt_hdr_put(ctx, h);