aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/util.c')
-rw-r--r--ipc/util.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/ipc/util.c b/ipc/util.c
index cecb46e89ab0..e1b4c6db8aa0 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -139,19 +139,10 @@ __initcall(ipc_init);
139 */ 139 */
140void ipc_init_ids(struct ipc_ids *ids) 140void ipc_init_ids(struct ipc_ids *ids)
141{ 141{
142 init_rwsem(&ids->rwsem);
143
144 ids->in_use = 0; 142 ids->in_use = 0;
145 ids->seq = 0; 143 ids->seq = 0;
146 ids->next_id = -1; 144 ids->next_id = -1;
147 { 145 init_rwsem(&ids->rwsem);
148 int seq_limit = INT_MAX/SEQ_MULTIPLIER;
149 if (seq_limit > USHRT_MAX)
150 ids->seq_max = USHRT_MAX;
151 else
152 ids->seq_max = seq_limit;
153 }
154
155 idr_init(&ids->ipcs_idr); 146 idr_init(&ids->ipcs_idr);
156} 147}
157 148
@@ -304,7 +295,7 @@ int ipc_addid(struct ipc_ids *ids, struct kern_ipc_perm *new, int size)
304 295
305 if (next_id < 0) { 296 if (next_id < 0) {
306 new->seq = ids->seq++; 297 new->seq = ids->seq++;
307 if (ids->seq > ids->seq_max) 298 if (ids->seq > IPCID_SEQ_MAX)
308 ids->seq = 0; 299 ids->seq = 0;
309 } else { 300 } else {
310 new->seq = ipcid_to_seqx(next_id); 301 new->seq = ipcid_to_seqx(next_id);