This is already done for us internally by the signal machinery.
Unified · Split
| @@ -987,7 +987,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, · 986 unmodified lines | |||
| 987 | * wait_lock. This ensures the lock cancellation is ordered | 987 | * wait_lock. This ensures the lock cancellation is ordered |
| 988 | * against mutex_unlock() and wake-ups do not go missing. | 988 | * against mutex_unlock() and wake-ups do not go missing. |
| 989 | */ | 989 | */ |
| 990 | if (unlikely(signal_pending_state(state, current))) { | 990 | if (signal_pending_state(state, current)) { |
| 991 | ret = -EINTR; | 991 | ret = -EINTR; |
| 992 | goto err; | 992 | goto err; |
| 993 | } | 993 | } |