Skip to content

Commit

Permalink
Fix use-after-free in splat_taskq_test7
Browse files Browse the repository at this point in the history
This splat_vprint is using tq_arg->name after tq_arg is freed.

Signed-off-by: Chunwei Chen <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#557
  • Loading branch information
Chunwei Chen authored and behlendorf committed May 31, 2016
1 parent f58040c commit ea5f1a2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions module/splat/splat-taskq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1040,11 +1040,12 @@ splat_taskq_test7_impl(struct file *file, void *arg, boolean_t prealloc)

error = (tq_arg->depth == SPLAT_TASKQ_DEPTH_MAX ? 0 : -EINVAL);

splat_vprint(file, SPLAT_TASKQ_TEST7_NAME,
"Taskq '%s' destroying\n", tq_arg->name);

kmem_free(tqe, sizeof (taskq_ent_t));
kmem_free(tq_arg, sizeof (splat_taskq_arg_t));

splat_vprint(file, SPLAT_TASKQ_TEST7_NAME,
"Taskq '%s' destroying\n", tq_arg->name);
taskq_destroy(tq);

return (error);
Expand Down

0 comments on commit ea5f1a2

Please sign in to comment.