fast-get: fix a recent regression: write before mapping RO#10731
fast-get: fix a recent regression: write before mapping RO#10731kv2019i merged 1 commit intothesofproject:mainfrom
Conversation
A recent commit introduced a regression: it moved writing data to a buffer after the call, mapping the target buffer as read-only. Fix it by moving the copy operation back up. Fixes commit cfa5f02 ("fast-get: don't corrupt entries when failing") Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
kv2019i
left a comment
There was a problem hiding this comment.
It is not very obvious that fast_get_access_grant() actually limits the access here, but alas, fixes the regression...
|
@lyakh wrote:
You have to look inside the grant function implementation to see that. And even then, the function name is surprising. Usually when you grant something, you allow something more, not remove something you already had. |
it grants it to userspace. As for the kernel - well, the kernel mode might not need that access at all (after having written to it once). But yes, it isn't immediately obvious without reading the code :-) |
There was a problem hiding this comment.
Pull request overview
Fixes a regression in fast_get() where the newly allocated SRAM buffer could be mapped read-only before the data copy occurred, causing the subsequent write to fail.
Changes:
- Move the
memcpy_s()into the newly allocated SRAM buffer earlier infast_get(). - Perform
dcache_writeback_region()before any read-only memory-domain mapping occurs.
A recent commit introduced a regression: it moved writing data to a buffer after the call, mapping the target buffer as read-only. Fix it by moving the copy operation back up.
Fixes commit cfa5f02 ("fast-get: don't corrupt entries when failing")