shmget: Make shmobj underwent IPC_RMID invisible to shmget

Refs: #926
Change-Id: I16120623b581da5d5d484fd05d5111788c8ad5e2
This commit is contained in:
Tomoki Shirasawa
2018-06-11 11:40:48 +09:00
committed by Masamichi Takagi
parent 229b041320
commit 9bb8076dc0
7 changed files with 170 additions and 15 deletions

View File

@@ -295,6 +295,7 @@ void shmobj_destroy(struct shmobj *obj)
--the_shm_info.used_ids;
list_add(&obj->chain, &kds_free_list);
/* For index reuse, release in descending order of index. */
for (;;) {
struct shmobj *p;

View File

@@ -4758,7 +4758,8 @@ int shmobj_list_lookup_by_key(key_t key, struct shmobj **objp)
struct shmobj *obj;
list_for_each_entry(obj, &kds_list, chain) {
if (obj->ds.shm_perm.key == key) {
if (obj->ds.shm_perm.key == key &&
!(obj->ds.shm_perm.mode & SHM_DEST)) {
break;
}
}