+ if ((error = queue.status) != -EINTR && !signal_pending(current)) {
+ /*
+ * User space could assume that semop() is a memory barrier:
+ * Without the mb(), the cpu could speculatively read in user
+ * space stale data that was overwritten by the previous owner
+ * of the semaphore.
*/
smp_mb();
-
goto out_free;
}
rcu_read_lock();
sma = sem_obtain_lock(ns, semid, sops, nsops, &locknum);
What is the purpose of the !signal_pending()?
Even if there is a signal: If someone has set queue.status, then our semaphore operations completed and we must return that result code.
Obviously: At syscall return, the syscall return code will notice the pending signal and immediately the signal handler is called, but I don't see that this prevents us from using the fast path.
And, at least my opinion: I would avoid placing the error= into the if().