linuxkm/{module_hooks.c,linuxkm_wc_port.h}: in wc_lkm_LockMutex(), when interruptible, check for signals, and add __must_check attribute.
This commit is contained in:
@@ -1398,7 +1398,7 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int wc_LockMutex(wolfSSL_Mutex* m)
|
||||
static __must_check inline int wc_LockMutex(wolfSSL_Mutex* m)
|
||||
{
|
||||
if (in_nmi() || hardirq_count() || in_softirq())
|
||||
return -1;
|
||||
@@ -1443,14 +1443,14 @@
|
||||
/* wc_lkm_LockMutex() can't be used inline in __PIE__ objects, due to
|
||||
* direct access to pv_ops.
|
||||
*/
|
||||
static __always_inline int wc_LockMutex(wolfSSL_Mutex *m)
|
||||
static __must_check __always_inline int wc_LockMutex(wolfSSL_Mutex *m)
|
||||
{
|
||||
return WC_PIE_INDIRECT_SYM(wc_lkm_LockMutex)(m);
|
||||
}
|
||||
|
||||
#else /* !__PIE__ */
|
||||
|
||||
static __always_inline int wc_LockMutex(wolfSSL_Mutex *m)
|
||||
static __must_check __always_inline int wc_LockMutex(wolfSSL_Mutex *m)
|
||||
{
|
||||
return wc_lkm_LockMutex(m);
|
||||
}
|
||||
|
||||
@@ -172,11 +172,14 @@ int wc_lkm_LockMutex(wolfSSL_Mutex* m)
|
||||
}
|
||||
else {
|
||||
for (;;) {
|
||||
int sig_ret = wc_linuxkm_check_for_intr_signals();
|
||||
if (sig_ret)
|
||||
return sig_ret;
|
||||
cond_resched();
|
||||
if (spin_trylock_irqsave(&m->lock, irq_flags)) {
|
||||
m->irq_flags = irq_flags;
|
||||
return 0;
|
||||
}
|
||||
cond_resched();
|
||||
}
|
||||
}
|
||||
__builtin_unreachable();
|
||||
|
||||
Reference in New Issue
Block a user