linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: wilc1000: fix check of kthread_run() return value
@ 2016-03-09 23:13 Vladimir Zapolskiy
  2016-03-09 23:27 ` Julian Calaby
  0 siblings, 1 reply; 8+ messages in thread
From: Vladimir Zapolskiy @ 2016-03-09 23:13 UTC (permalink / raw)
  To: Glen Lee, Greg Kroah-Hartman
  Cc: Johnny Kim, Austin Shin, Chris Park, Tony Cho, Leo Kim,
	linux-wireless, devel

The kthread_run() function returns either a valid task_struct or
ERR_PTR() value, check for NULL is invalid. The change fixes potential
oops, e.g. in OOM situation.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 54fe9d7..5077c30 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -849,10 +849,10 @@ static int wlan_initialize_threads(struct net_device *dev)
 	PRINT_D(INIT_DBG, "Creating kthread for transmission\n");
 	wilc->txq_thread = kthread_run(linux_wlan_txq_task, (void *)dev,
 				     "K_TXQ_TASK");
-	if (!wilc->txq_thread) {
+	if (IS_ERR(wilc->txq_thread)) {
 		PRINT_ER("couldn't create TXQ thread\n");
 		wilc->close = 0;
-		return -ENOBUFS;
+		return PTR_ERR(wilc->txq_thread);
 	}
 	down(&wilc->txq_thread_started);
 
-- 
2.1.4


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

end of thread, other threads:[~2016-03-10  6:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-09 23:13 [PATCH] staging: wilc1000: fix check of kthread_run() return value Vladimir Zapolskiy
2016-03-09 23:27 ` Julian Calaby
2016-03-09 23:30   ` Vladimir Zapolskiy
2016-03-09 23:42     ` Julian Calaby
2016-03-10  0:02       ` Vladimir Zapolskiy
2016-03-10  0:24         ` Julian Calaby
2016-03-10  0:36           ` Vladimir Zapolskiy
2016-03-10  6:49             ` Kim, Leo

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).