linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kernel/padata.c: always check the return value of __padata_remove_cpu() and __padata_add_cpu()
@ 2013-08-20  3:43 Chen Gang
  2013-08-20  3:44 ` Chen Gang
  0 siblings, 1 reply; 13+ messages in thread
From: Chen Gang @ 2013-08-20  3:43 UTC (permalink / raw)
  To: steffen.klassert; +Cc: linux-crypto, linux-kernel@vger.kernel.org

When failure occures, __padata_add_cpu() and __padata_remove_cpu() will
return -ENOMEM, which need be noticed in any cases (even in cleaning up
cases).

Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 kernel/padata.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/padata.c b/kernel/padata.c
index 072f4ee..6a124cd 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -871,16 +871,20 @@ static int padata_cpu_callback(struct notifier_block *nfb,
 		if (!pinst_has_cpu(pinst, cpu))
 			break;
 		mutex_lock(&pinst->lock);
-		__padata_remove_cpu(pinst, cpu);
+		err = __padata_remove_cpu(pinst, cpu);
 		mutex_unlock(&pinst->lock);
+		if (err)
+			return notifier_from_errno(err);
 
 	case CPU_DOWN_FAILED:
 	case CPU_DOWN_FAILED_FROZEN:
 		if (!pinst_has_cpu(pinst, cpu))
 			break;
 		mutex_lock(&pinst->lock);
-		__padata_add_cpu(pinst, cpu);
+		err = __padata_add_cpu(pinst, cpu);
 		mutex_unlock(&pinst->lock);
+		if (err)
+			return notifier_from_errno(err);
 	}
 
 	return NOTIFY_OK;
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-08-29  5:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-20  3:43 [PATCH] kernel/padata.c: always check the return value of __padata_remove_cpu() and __padata_add_cpu() Chen Gang
2013-08-20  3:44 ` Chen Gang
2013-08-22  5:11   ` Steffen Klassert
2013-08-22  5:27     ` Chen Gang
2013-08-22  6:05       ` Steffen Klassert
2013-08-22  6:16         ` Chen Gang
2013-08-22  6:43         ` [PATCH v2] kernel/padata.c: share code between CPU_ONLINE and CPU_DOWN_FAILED, same to CPU_DOWN_PREPARE and CPU_UP_CANCELED Chen Gang
2013-08-23  3:46           ` Chen Gang
2013-08-23 10:44           ` Steffen Klassert
2013-08-23 10:47             ` Herbert Xu
2013-08-26  1:11               ` Chen Gang
2013-08-29  4:42             ` Herbert Xu
2013-08-29  5:22               ` Chen Gang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).