diff options
author | SeongJae Park <sj@kernel.org> | 2022-07-15 22:51:06 +0000 |
---|---|---|
committer | Juergen Gross <jgross@suse.com> | 2022-08-12 12:13:46 +0200 |
commit | fc9be616bb8f3ed9cf560308f86904f5c06be205 (patch) | |
tree | 5b21db057d98fe9519d8becea175d12c89c0f956 /mm/percpu-stats.c | |
parent | b1c3497e604ddccea5af4071831ed0e4680fb35e (diff) | |
download | linux-fc9be616bb8f3ed9cf560308f86904f5c06be205.tar.bz2 |
xen-blkback: fix persistent grants negotiation
Persistent grants feature can be used only when both backend and the
frontend supports the feature. The feature was always supported by
'blkback', but commit aac8a70db24b ("xen-blkback: add a parameter for
disabling of persistent grants") has introduced a parameter for
disabling it runtime.
To avoid the parameter be updated while being used by 'blkback', the
commit caches the parameter into 'vbd->feature_gnt_persistent' in
'xen_vbd_create()', and then check if the guest also supports the
feature and finally updates the field in 'connect_ring()'.
However, 'connect_ring()' could be called before 'xen_vbd_create()', so
later execution of 'xen_vbd_create()' can wrongly overwrite 'true' to
'vbd->feature_gnt_persistent'. As a result, 'blkback' could try to use
'persistent grants' feature even if the guest doesn't support the
feature.
This commit fixes the issue by moving the parameter value caching to
'xen_blkif_alloc()', which allocates the 'blkif'. Because the struct
embeds 'vbd' object, which will be used by 'connect_ring()' later, this
should be called before 'connect_ring()' and therefore this should be
the right and safe place to do the caching.
Fixes: aac8a70db24b ("xen-blkback: add a parameter for disabling of persistent grants")
Cc: <stable@vger.kernel.org> # 5.10.x
Signed-off-by: Maximilian Heyne <mheyne@amazon.de>
Signed-off-by: SeongJae Park <sj@kernel.org>
Reviewed-by: Maximilian Heyne <mheyne@amazon.de>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/20220715225108.193398-2-sj@kernel.org
Signed-off-by: Juergen Gross <jgross@suse.com>
Diffstat (limited to 'mm/percpu-stats.c')
0 files changed, 0 insertions, 0 deletions