diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2016-01-21 20:28:38 -0500 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2016-01-25 19:50:26 -0500 |
commit | 0a95b851370b84a4b9d92ee6d1fa0926901d0454 (patch) | |
tree | 961bebab8ad070e86c3e5600e3617d28104a16b5 /fs | |
parent | de0ee0edb21fbab4c7afa3e94573ecfebfb0244e (diff) |
btrfs: async-thread: Fix a use-after-free error for trace
Parameter of trace_btrfs_work_queued() can be freed in its workqueue.
So no one use use that pointer after queue_work().
Fix the user-after-free bug by move the trace line before queue_work().
Reported-by: Dave Jones <davej@codemonkey.org.uk>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/async-thread.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c index 88d9af3d4581..5fb60ea7eee2 100644 --- a/fs/btrfs/async-thread.c +++ b/fs/btrfs/async-thread.c | |||
@@ -328,8 +328,8 @@ static inline void __btrfs_queue_work(struct __btrfs_workqueue *wq, | |||
328 | list_add_tail(&work->ordered_list, &wq->ordered_list); | 328 | list_add_tail(&work->ordered_list, &wq->ordered_list); |
329 | spin_unlock_irqrestore(&wq->list_lock, flags); | 329 | spin_unlock_irqrestore(&wq->list_lock, flags); |
330 | } | 330 | } |
331 | queue_work(wq->normal_wq, &work->normal_work); | ||
332 | trace_btrfs_work_queued(work); | 331 | trace_btrfs_work_queued(work); |
332 | queue_work(wq->normal_wq, &work->normal_work); | ||
333 | } | 333 | } |
334 | 334 | ||
335 | void btrfs_queue_work(struct btrfs_workqueue *wq, | 335 | void btrfs_queue_work(struct btrfs_workqueue *wq, |