diff options
Diffstat (limited to 'ipc/msg.c')
| -rw-r--r-- | ipc/msg.c | 17 |
1 files changed, 14 insertions, 3 deletions
| @@ -105,6 +105,7 @@ int msg_init_ns(struct ipc_namespace *ns) | |||
| 105 | void msg_exit_ns(struct ipc_namespace *ns) | 105 | void msg_exit_ns(struct ipc_namespace *ns) |
| 106 | { | 106 | { |
| 107 | struct msg_queue *msq; | 107 | struct msg_queue *msq; |
| 108 | struct kern_ipc_perm *perm; | ||
| 108 | int next_id; | 109 | int next_id; |
| 109 | int total, in_use; | 110 | int total, in_use; |
| 110 | 111 | ||
| @@ -113,10 +114,11 @@ void msg_exit_ns(struct ipc_namespace *ns) | |||
| 113 | in_use = msg_ids(ns).in_use; | 114 | in_use = msg_ids(ns).in_use; |
| 114 | 115 | ||
| 115 | for (total = 0, next_id = 0; total < in_use; next_id++) { | 116 | for (total = 0, next_id = 0; total < in_use; next_id++) { |
| 116 | msq = idr_find(&msg_ids(ns).ipcs_idr, next_id); | 117 | perm = idr_find(&msg_ids(ns).ipcs_idr, next_id); |
| 117 | if (msq == NULL) | 118 | if (perm == NULL) |
| 118 | continue; | 119 | continue; |
| 119 | ipc_lock_by_ptr(&msq->q_perm); | 120 | ipc_lock_by_ptr(perm); |
| 121 | msq = container_of(perm, struct msg_queue, q_perm); | ||
| 120 | freeque(ns, msq); | 122 | freeque(ns, msq); |
| 121 | total++; | 123 | total++; |
| 122 | } | 124 | } |
| @@ -144,6 +146,9 @@ static inline struct msg_queue *msg_lock_check_down(struct ipc_namespace *ns, | |||
| 144 | { | 146 | { |
| 145 | struct kern_ipc_perm *ipcp = ipc_lock_check_down(&msg_ids(ns), id); | 147 | struct kern_ipc_perm *ipcp = ipc_lock_check_down(&msg_ids(ns), id); |
| 146 | 148 | ||
| 149 | if (IS_ERR(ipcp)) | ||
| 150 | return (struct msg_queue *)ipcp; | ||
| 151 | |||
| 147 | return container_of(ipcp, struct msg_queue, q_perm); | 152 | return container_of(ipcp, struct msg_queue, q_perm); |
| 148 | } | 153 | } |
| 149 | 154 | ||
| @@ -155,6 +160,9 @@ static inline struct msg_queue *msg_lock(struct ipc_namespace *ns, int id) | |||
| 155 | { | 160 | { |
| 156 | struct kern_ipc_perm *ipcp = ipc_lock(&msg_ids(ns), id); | 161 | struct kern_ipc_perm *ipcp = ipc_lock(&msg_ids(ns), id); |
| 157 | 162 | ||
| 163 | if (IS_ERR(ipcp)) | ||
| 164 | return (struct msg_queue *)ipcp; | ||
| 165 | |||
| 158 | return container_of(ipcp, struct msg_queue, q_perm); | 166 | return container_of(ipcp, struct msg_queue, q_perm); |
| 159 | } | 167 | } |
| 160 | 168 | ||
| @@ -163,6 +171,9 @@ static inline struct msg_queue *msg_lock_check(struct ipc_namespace *ns, | |||
| 163 | { | 171 | { |
| 164 | struct kern_ipc_perm *ipcp = ipc_lock_check(&msg_ids(ns), id); | 172 | struct kern_ipc_perm *ipcp = ipc_lock_check(&msg_ids(ns), id); |
| 165 | 173 | ||
| 174 | if (IS_ERR(ipcp)) | ||
| 175 | return (struct msg_queue *)ipcp; | ||
| 176 | |||
| 166 | return container_of(ipcp, struct msg_queue, q_perm); | 177 | return container_of(ipcp, struct msg_queue, q_perm); |
| 167 | } | 178 | } |
| 168 | 179 | ||
