diff options
author | Vladimir Zapolskiy <vz@mleia.com> | 2016-03-10 01:22:19 +0200 |
---|---|---|
committer | Sasha Levin <alexander.levin@verizon.com> | 2016-09-15 18:53:30 -0400 |
commit | 14afdb21578a068c8c331e5695c5b7dd971dcb64 (patch) | |
tree | e07c184bec7b358a799176f242cc59f04aa84a45 | |
parent | 6f3e5e4d8e4fc69a3aebe54d9073fa3418ef3fe1 (diff) | |
download | lwn-14afdb21578a068c8c331e5695c5b7dd971dcb64.tar.gz lwn-14afdb21578a068c8c331e5695c5b7dd971dcb64.zip |
dm log writes: fix check of kthread_run() return value
[ Upstream commit 91e630d9ae6de6f740ef7c8176736eb55366833e ]
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
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
-rw-r--r-- | drivers/md/dm-log-writes.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/dm-log-writes.c b/drivers/md/dm-log-writes.c index f8c4e4ea9847..9e136baf5fc5 100644 --- a/drivers/md/dm-log-writes.c +++ b/drivers/md/dm-log-writes.c @@ -456,7 +456,7 @@ static int log_writes_ctr(struct dm_target *ti, unsigned int argc, char **argv) } lc->log_kthread = kthread_run(log_writes_kthread, lc, "log-write"); - if (!lc->log_kthread) { + if (IS_ERR(lc->log_kthread)) { ti->error = "Couldn't alloc kthread"; dm_put_device(ti, lc->dev); dm_put_device(ti, lc->logdev); |