summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Zapolskiy <vz@mleia.com>2016-03-09 18:22:19 -0500
committerMike Snitzer <snitzer@redhat.com>2016-08-30 19:41:43 -0400
commit91e630d9ae6de6f740ef7c8176736eb55366833e (patch)
tree5041057fb7bb3d50805dd0de8c29d0126b337675
parent7efb367320f56fc4d549875b6f3a6940018ef2e5 (diff)
dm log writes: fix check of kthread_run() return value
The kthread_run() function returns either a valid task_struct or ERR_PTR() value, check for NULL is invalid. This change fixes potential for oops, e.g. in OOM situation. Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Cc: stable@vger.kernel.org
-rw-r--r--drivers/md/dm-log-writes.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/dm-log-writes.c b/drivers/md/dm-log-writes.c
index ba24f4f37efc..49e4d8d4558f 100644
--- a/drivers/md/dm-log-writes.c
+++ b/drivers/md/dm-log-writes.c
@@ -459,9 +459,9 @@ static int log_writes_ctr(struct dm_target *ti, unsigned int argc, char **argv)
459 goto bad; 459 goto bad;
460 } 460 }
461 461
462 ret = -EINVAL;
463 lc->log_kthread = kthread_run(log_writes_kthread, lc, "log-write"); 462 lc->log_kthread = kthread_run(log_writes_kthread, lc, "log-write");
464 if (!lc->log_kthread) { 463 if (IS_ERR(lc->log_kthread)) {
464 ret = PTR_ERR(lc->log_kthread);
465 ti->error = "Couldn't alloc kthread"; 465 ti->error = "Couldn't alloc kthread";
466 dm_put_device(ti, lc->dev); 466 dm_put_device(ti, lc->dev);
467 dm_put_device(ti, lc->logdev); 467 dm_put_device(ti, lc->logdev);