384
385 id = ipc_addid(&shm_ids(ns), &shp->shm_perm, ns->shm_ctlmni);
386 if (id < 0) {
387 error = id;
388 goto no_id;
389 }
390
391 shp->shm_cprid = task_tgid_vnr(current);
392 shp->shm_lprid = 0;
393 shp->shm_atim = shp->shm_dtim = 0;
394 shp->shm_ctim = get_seconds();
395 shp->shm_segsz = size;
396 shp->shm_nattch = 0;
397 shp->shm_file = file;
398
399
400
401
402 file->f_dentry->d_inode->i_ino = shp->shm_perm.id;
403
404 ns->shm_tot += numpages;
405 error = shp->shm_perm.id;
406 shm_unlock(shp);
407 return error;
408
409no_id:
410 fput(file);
411no_file:
412 security_shm_free(shp);
413 ipc_rcu_putref(shp);
414 return error;
415}
416
417
418
419
420static inline int shm_security(struct kern_ipc_perm *ipcp, int shmflg)
421{
422 struct shmid_kernel *shp;
423
424 shp = container_of(ipcp, struct shmid_kernel, shm_perm);