diff options
Diffstat (limited to 'ipc/util.c')
-rw-r--r-- | ipc/util.c | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/ipc/util.c b/ipc/util.c index e72865f677a7..9b0c4e7753af 100644 --- a/ipc/util.c +++ b/ipc/util.c | |||
@@ -678,7 +678,7 @@ struct kern_ipc_perm *ipc_lock(struct ipc_ids *ids, int id) | |||
678 | out = idr_find(&ids->ipcs_idr, lid); | 678 | out = idr_find(&ids->ipcs_idr, lid); |
679 | if (out == NULL) { | 679 | if (out == NULL) { |
680 | rcu_read_unlock(); | 680 | rcu_read_unlock(); |
681 | return NULL; | 681 | return ERR_PTR(-EINVAL); |
682 | } | 682 | } |
683 | 683 | ||
684 | spin_lock(&out->lock); | 684 | spin_lock(&out->lock); |
@@ -689,36 +689,17 @@ struct kern_ipc_perm *ipc_lock(struct ipc_ids *ids, int id) | |||
689 | if (out->deleted) { | 689 | if (out->deleted) { |
690 | spin_unlock(&out->lock); | 690 | spin_unlock(&out->lock); |
691 | rcu_read_unlock(); | 691 | rcu_read_unlock(); |
692 | return NULL; | 692 | return ERR_PTR(-EINVAL); |
693 | } | 693 | } |
694 | 694 | ||
695 | return out; | 695 | return out; |
696 | } | 696 | } |
697 | 697 | ||
698 | void ipc_lock_by_ptr(struct kern_ipc_perm *perm) | ||
699 | { | ||
700 | rcu_read_lock(); | ||
701 | spin_lock(&perm->lock); | ||
702 | } | ||
703 | |||
704 | void ipc_unlock(struct kern_ipc_perm* perm) | ||
705 | { | ||
706 | spin_unlock(&perm->lock); | ||
707 | rcu_read_unlock(); | ||
708 | } | ||
709 | |||
710 | int ipc_buildid(struct ipc_ids* ids, int id, int seq) | 698 | int ipc_buildid(struct ipc_ids* ids, int id, int seq) |
711 | { | 699 | { |
712 | return SEQ_MULTIPLIER*seq + id; | 700 | return SEQ_MULTIPLIER*seq + id; |
713 | } | 701 | } |
714 | 702 | ||
715 | int ipc_checkid(struct ipc_ids* ids, struct kern_ipc_perm* ipcp, int uid) | ||
716 | { | ||
717 | if(uid/SEQ_MULTIPLIER != ipcp->seq) | ||
718 | return 1; | ||
719 | return 0; | ||
720 | } | ||
721 | |||
722 | #ifdef __ARCH_WANT_IPC_PARSE_VERSION | 703 | #ifdef __ARCH_WANT_IPC_PARSE_VERSION |
723 | 704 | ||
724 | 705 | ||