Mikulas Patocka and Linus Torvalds
d4252071b9
add barriers to buffer_uptodate and set_buffer_uptodate
...
Let's have a look at this piece of code in __bread_slow:
get_bh(bh);
bh->b_end_io = end_buffer_read_sync;
submit_bh(REQ_OP_READ, 0, bh);
wait_on_buffer(bh);
if (buffer_uptodate(bh))
return bh;
Neither wait_on_buffer nor buffer_uptodate contain any memory barrier.
Consequently, if someone calls sb_bread and then reads the buffer data,
the read of buffer data may be executed before wait_on_buffer(bh) on
architectures with weak memory ordering and it may return invalid data.
Fix this bug by adding a memory barrier to set_buffer_uptodate and an
acquire barrier to buffer_uptodate (in a similar way as
folio_test_uptodate and folio_mark_uptodate).
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com >
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-08-09 15:03:02 -07:00
..
2022-07-28 11:44:30 +02:00
2022-08-04 19:30:35 -07:00
2022-07-28 11:29:36 +02:00
2022-08-06 10:19:51 -07:00
2022-08-04 18:34:05 -07:00
2022-07-18 18:29:13 +01:00
2022-07-25 09:42:24 +01:00
2022-08-04 10:28:48 -04:00
2022-08-02 15:06:57 -05:00
2022-07-28 11:29:36 +02:00
2022-08-06 10:25:16 -07:00
2022-08-04 19:54:32 -07:00
2022-07-26 16:58:31 +02:00
2022-08-01 21:31:22 +02:00
2022-08-07 09:53:58 -07:00
2022-07-28 00:01:30 +01:00
2022-08-05 16:32:45 -07:00
2022-08-04 12:12:54 -07:00
2022-08-06 10:19:51 -07:00
2022-08-09 14:56:49 -07:00
2022-08-04 12:12:54 -07:00
2022-08-06 10:19:51 -07:00
2022-07-28 11:29:36 +02:00
2022-07-29 18:12:35 -07:00
2022-07-29 18:07:15 -07:00
2022-08-02 12:34:03 -04:00
2022-08-02 17:14:47 -06:00
2022-08-07 17:52:35 -07:00
2022-08-04 20:00:14 -07:00
2022-07-22 22:04:37 +02:00
2022-07-22 09:07:07 -07:00
2022-07-21 21:03:09 -07:00
2022-08-09 15:03:02 -07:00
2022-08-03 09:45:08 -07:00
2022-08-02 12:19:18 -07:00
2022-07-17 17:31:38 -07:00
2022-08-01 12:48:15 -07:00
2022-08-07 17:52:35 -07:00
2022-07-17 17:14:32 -07:00
2022-07-30 00:36:10 -04:00
2022-07-28 17:36:30 -04:00
2022-07-28 17:46:14 -04:00
2022-08-08 15:16:29 -07:00
2022-07-26 07:27:48 -04:00
2022-08-03 14:41:36 -07:00
2022-08-09 09:52:28 -07:00
2022-08-02 19:24:24 -07:00
2022-07-22 22:04:30 +02:00
2022-08-07 17:52:35 -07:00
2022-07-19 09:56:34 +02:00
2022-07-25 17:45:40 +02:00
2022-08-05 16:32:45 -07:00
2022-07-28 11:29:36 +02:00
2022-08-05 16:32:45 -07:00
2022-07-17 17:14:47 -07:00
2022-07-22 16:06:03 -05:00
2022-07-26 23:13:36 +02:00
2022-07-22 14:28:22 +02:00
2022-07-28 11:29:36 +02:00
2022-07-28 11:29:36 +02:00
2022-07-28 11:29:36 +02:00
2022-07-28 11:29:36 +02:00
2022-07-27 08:50:50 -06:00
2022-08-03 13:50:22 -07:00
2022-07-19 06:05:45 +02:00
2022-07-20 15:26:05 +01:00
2022-07-22 17:24:47 -05:00
2022-08-04 20:13:46 -07:00
2022-07-17 17:31:38 -07:00
2022-07-17 17:14:33 -07:00
2022-08-01 03:21:00 -04:00
2022-08-01 03:21:00 -04:00
2022-07-22 12:53:22 +01:00
2022-08-02 23:56:25 -04:00
2022-07-17 17:14:30 -07:00
2022-08-05 16:32:45 -07:00
2022-07-27 14:04:52 +02:00
2022-07-17 17:14:34 -07:00
2022-08-05 16:32:45 -07:00
2022-07-29 18:07:19 -07:00
2022-08-02 12:34:04 -04:00
2022-08-07 10:03:24 -07:00
2022-08-03 10:35:43 -07:00
2022-07-29 20:16:58 -04:00
2022-07-28 11:29:36 +02:00
2022-07-27 21:35:32 +10:00
2022-08-01 08:13:21 -07:00
2022-08-02 17:14:49 -06:00
2022-08-02 17:14:47 -06:00
2022-08-02 19:24:24 -07:00
2022-07-19 10:24:01 +02:00
2022-08-04 18:08:34 -07:00
2022-07-21 10:39:42 +02:00
2022-07-17 17:31:37 -07:00
2022-08-05 16:32:45 -07:00
2022-08-05 16:32:45 -07:00
2022-08-05 16:32:45 -07:00
2022-07-20 17:35:40 +02:00
2022-07-26 07:28:08 -04:00
2022-07-29 12:08:44 -05:00
2022-07-17 17:14:37 -07:00
2022-07-28 11:29:36 +02:00
2022-08-08 22:37:19 -04:00
2022-07-28 11:29:36 +02:00
2022-07-26 09:49:12 -07:00
2022-07-28 11:29:36 +02:00
2022-07-28 11:29:36 +02:00
2022-07-28 11:29:36 +02:00
2022-07-25 13:26:14 +02:00
2022-07-21 17:46:18 -07:00
2022-07-21 17:46:18 -07:00
2022-07-21 17:46:18 -07:00
2022-07-30 14:01:28 -04:00
2022-07-26 07:27:47 -04:00
2022-08-06 17:34:06 -07:00
2022-08-02 11:17:00 -07:00
2022-08-02 15:12:13 -07:00
2022-07-28 11:29:36 +02:00
2022-08-08 11:31:40 -07:00
2022-07-29 18:07:15 -07:00
2022-07-22 16:55:44 -07:00
2022-08-03 16:29:08 -07:00
2022-07-18 11:14:35 +01:00
2022-07-28 11:29:36 +02:00
2022-08-05 16:32:45 -07:00
2022-07-18 06:50:18 +02:00
2022-07-28 17:29:56 +02:00
2022-08-03 23:56:20 +03:00
2022-08-05 09:41:12 -07:00
2022-07-19 09:56:51 +02:00
2022-08-08 22:37:24 -04:00
2022-08-06 08:59:35 -07:00
2022-07-25 13:41:22 -06:00
2022-08-01 07:42:49 +02:00
2022-07-28 12:35:12 +02:00
2022-08-02 13:46:35 -07:00