Revert "ipc: replace costly bailout check in sysvipc_find_ipc()"
This reverts commit 5d6d68e94e
.
This commit is contained in:
parent
42755cc6a5
commit
15c909dc17
1 changed files with 12 additions and 4 deletions
16
ipc/util.c
16
ipc/util.c
|
@ -754,13 +754,21 @@ struct pid_namespace *ipc_seq_pid_ns(struct seq_file *s)
|
||||||
static struct kern_ipc_perm *sysvipc_find_ipc(struct ipc_ids *ids, loff_t pos,
|
static struct kern_ipc_perm *sysvipc_find_ipc(struct ipc_ids *ids, loff_t pos,
|
||||||
loff_t *new_pos)
|
loff_t *new_pos)
|
||||||
{
|
{
|
||||||
struct kern_ipc_perm *ipc = NULL;
|
struct kern_ipc_perm *ipc;
|
||||||
int max_idx = ipc_get_maxidx(ids);
|
int total, id;
|
||||||
|
|
||||||
if (max_idx == -1 || pos > max_idx)
|
total = 0;
|
||||||
|
for (id = 0; id < pos && total < ids->in_use; id++) {
|
||||||
|
ipc = idr_find(&ids->ipcs_idr, id);
|
||||||
|
if (ipc != NULL)
|
||||||
|
total++;
|
||||||
|
}
|
||||||
|
|
||||||
|
ipc = NULL;
|
||||||
|
if (total >= ids->in_use)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
for (; pos <= max_idx; pos++) {
|
for (; pos < ipc_mni; pos++) {
|
||||||
ipc = idr_find(&ids->ipcs_idr, pos);
|
ipc = idr_find(&ids->ipcs_idr, pos);
|
||||||
if (ipc != NULL) {
|
if (ipc != NULL) {
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
|
|
Loading…
Reference in a new issue