diff options
Diffstat (limited to 'arch/mips/kernel/signal32.c')
-rw-r--r-- | arch/mips/kernel/signal32.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c index dc09206d8c7b..aec58211faaa 100644 --- a/arch/mips/kernel/signal32.c +++ b/arch/mips/kernel/signal32.c | |||
@@ -118,10 +118,13 @@ static int protected_save_fp_context32(struct sigcontext32 __user *sc) | |||
118 | int err; | 118 | int err; |
119 | while (1) { | 119 | while (1) { |
120 | lock_fpu_owner(); | 120 | lock_fpu_owner(); |
121 | err = own_fpu_inatomic(1); | 121 | if (is_fpu_owner()) { |
122 | if (!err) | 122 | err = save_fp_context32(sc); |
123 | err = save_fp_context32(sc); /* this might fail */ | 123 | unlock_fpu_owner(); |
124 | unlock_fpu_owner(); | 124 | } else { |
125 | unlock_fpu_owner(); | ||
126 | err = copy_fp_to_sigcontext32(sc); | ||
127 | } | ||
125 | if (likely(!err)) | 128 | if (likely(!err)) |
126 | break; | 129 | break; |
127 | /* touch the sigcontext and try again */ | 130 | /* touch the sigcontext and try again */ |
@@ -139,10 +142,13 @@ static int protected_restore_fp_context32(struct sigcontext32 __user *sc) | |||
139 | int err, tmp __maybe_unused; | 142 | int err, tmp __maybe_unused; |
140 | while (1) { | 143 | while (1) { |
141 | lock_fpu_owner(); | 144 | lock_fpu_owner(); |
142 | err = own_fpu_inatomic(0); | 145 | if (is_fpu_owner()) { |
143 | if (!err) | 146 | err = restore_fp_context32(sc); |
144 | err = restore_fp_context32(sc); /* this might fail */ | 147 | unlock_fpu_owner(); |
145 | unlock_fpu_owner(); | 148 | } else { |
149 | unlock_fpu_owner(); | ||
150 | err = copy_fp_from_sigcontext32(sc); | ||
151 | } | ||
146 | if (likely(!err)) | 152 | if (likely(!err)) |
147 | break; | 153 | break; |
148 | /* touch the sigcontext and try again */ | 154 | /* touch the sigcontext and try again */ |