Repository navigation
Commit bbe9de6
xen-blkback: fix compatibility bug with single page rings
[ Upstream commit d75e7f6 ]
Prior to commit 4a8c31a ("xen/blkback: rework connect_ring() to avoid
inconsistent xenstore 'ring-page-order' set by malicious blkfront"), the
behaviour of xen-blkback when connecting to a frontend was:
- read 'ring-page-order'
- if not present then expect a single page ring specified by 'ring-ref'
- else expect a ring specified by 'ring-refX' where X is between 0 and
1 << ring-page-order
This was correct behaviour, but was broken by the afforementioned commit to
become:
- read 'ring-page-order'
- if not present then expect a single page ring (i.e. ring-page-order = 0)
- expect a ring specified by 'ring-refX' where X is between 0 and
1 << ring-page-order
- if that didn't work then see if there's a single page ring specified by
'ring-ref'
This incorrect behaviour works most of the time but fails when a frontend
that sets 'ring-page-order' is unloaded and replaced by one that does not
because, instead of reading 'ring-ref', xen-blkback will read the stale
'ring-ref0' left around by the previous frontend will try to map the wrong
grant reference.
This patch restores the original behaviour.
Fixes: 4a8c31a ("xen/blkback: rework connect_ring() to avoid inconsistent xenstore 'ring-page-order' set by malicious blkfront")
Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Reviewed-by: Dongli Zhang <dongli.zhang@oracle.com>
Reviewed-by: "Roger Pau Monné" <roger.pau@citrix.com>
Link: https://lore.kernel.org/r/20210202175659.18452-1-paul@xen.org
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 565e7c9 commit bbe9de6
2 files changed
Lines changed: 17 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| 316 | + | |
316 | 317 | | |
317 | 318 | | |
318 | 319 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
998 | 998 | | |
999 | 999 | | |
1000 | 1000 | | |
1001 | | - | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
1002 | 1008 | | |
1003 | 1009 | | |
1004 | 1010 | | |
1005 | 1011 | | |
1006 | | - | |
1007 | | - | |
1008 | | - | |
1009 | 1012 | | |
1010 | 1013 | | |
1011 | 1014 | | |
1012 | 1015 | | |
1013 | 1016 | | |
1014 | 1017 | | |
1015 | 1018 | | |
1016 | | - | |
1017 | | - | |
1018 | | - | |
1019 | | - | |
1020 | | - | |
1021 | | - | |
1022 | | - | |
1023 | | - | |
1024 | | - | |
1025 | | - | |
1026 | | - | |
1027 | | - | |
1028 | 1019 | | |
1029 | 1020 | | |
1030 | 1021 | | |
| |||
1129 | 1120 | | |
1130 | 1121 | | |
1131 | 1122 | | |
1132 | | - | |
1133 | | - | |
1134 | | - | |
1135 | | - | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
1136 | 1132 | | |
1137 | 1133 | | |
1138 | 1134 | | |
| |||
1141 | 1137 | | |
1142 | 1138 | | |
1143 | 1139 | | |
1144 | | - | |
1145 | | - | |
1146 | 1140 | | |
1147 | 1141 | | |
1148 | 1142 | | |
| |||
0 commit comments