ipc/sem: play nicer with large nsops allocations
[sfrench/cifs-2.6.git] / ipc / sem.c
index 16414b8a8cca2d83c7e0490f707d7d62899512be..4c0cfaad560c3627715ca99cfbd584f8211d42f3 100644 (file)
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -1784,7 +1784,7 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops,
        if (nsops > ns->sc_semopm)
                return -E2BIG;
        if (nsops > SEMOPM_FAST) {
-               sops = kmalloc(sizeof(*sops)*nsops, GFP_KERNEL);
+               sops = kvmalloc(sizeof(*sops)*nsops, GFP_KERNEL);
                if (sops == NULL)
                        return -ENOMEM;
        }
@@ -2016,7 +2016,7 @@ out_unlock_free:
        rcu_read_unlock();
 out_free:
        if (sops != fast_sops)
-               kfree(sops);
+               kvfree(sops);
        return error;
 }