]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.69/dm-integrity-change-suspending-variable-from-bool-to-int.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.14.69 / dm-integrity-change-suspending-variable-from-bool-to-int.patch
CommitLineData
bed0f502
GKH
1From c21b16392701543d61e366dca84e15fe7f0cf0cf Mon Sep 17 00:00:00 2001
2From: Mikulas Patocka <mpatocka@redhat.com>
3Date: Tue, 3 Jul 2018 20:13:25 +0200
4Subject: dm integrity: change 'suspending' variable from bool to int
5
6From: Mikulas Patocka <mpatocka@redhat.com>
7
8commit c21b16392701543d61e366dca84e15fe7f0cf0cf upstream.
9
10Early alpha processors can't write a byte or short atomically - they
11read 8 bytes, modify the byte or two bytes in registers and write back
128 bytes.
13
14The modification of the variable "suspending" may race with
15modification of the variable "failed". Fix this by changing
16"suspending" to an int.
17
18Cc: stable@vger.kernel.org
19Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
20Signed-off-by: Mike Snitzer <snitzer@redhat.com>
21Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22
23---
24 drivers/md/dm-integrity.c | 6 +++---
25 1 file changed, 3 insertions(+), 3 deletions(-)
26
27--- a/drivers/md/dm-integrity.c
28+++ b/drivers/md/dm-integrity.c
29@@ -177,7 +177,7 @@ struct dm_integrity_c {
30 __u8 sectors_per_block;
31
32 unsigned char mode;
33- bool suspending;
34+ int suspending;
35
36 int failed;
37
38@@ -2209,7 +2209,7 @@ static void dm_integrity_postsuspend(str
39
40 del_timer_sync(&ic->autocommit_timer);
41
42- ic->suspending = true;
43+ WRITE_ONCE(ic->suspending, 1);
44
45 queue_work(ic->commit_wq, &ic->commit_work);
46 drain_workqueue(ic->commit_wq);
47@@ -2219,7 +2219,7 @@ static void dm_integrity_postsuspend(str
48 dm_integrity_flush_buffers(ic);
49 }
50
51- ic->suspending = false;
52+ WRITE_ONCE(ic->suspending, 0);
53
54 BUG_ON(!RB_EMPTY_ROOT(&ic->in_progress));
55