aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorThomas Gleixner2018-04-22 18:23:55 +0200
committerKees Cook2018-04-24 19:50:10 -0700
commit45888b40d2a6221d46bb69959e2600ddba71cc1f (patch)
tree58422ab63f1bcc01b810cb2c7d2a8c7be0fd2bb0 /include
parent964dfce9c2b323a9a9d0bd6764e0f530b40104e4 (diff)
rslib: Allocate decoder buffers to avoid VLAs
To get rid of the variable length arrays on stack in the RS decoder it's necessary to allocate the decoder buffers per control structure instance. All usage sites have been checked for potential parallel decoder usage and fixed where necessary. Kees confirmed that the pstore decoding is strictly single threaded so there should be no surprises. Allocate them in the rs control structure sized depending on the number of roots for the chosen codec and adapt the decoder code to make use of them. Document the fact that decode operations based on a particular rs control instance cannot run in parallel and the caller has to ensure that as it's not possible to provide a proper locking construct which fits all use cases. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Kees Cook <keescook@chromium.org> Cc: Boris Brezillon <boris.brezillon@free-electrons.com> Cc: Tony Luck <tony.luck@intel.com> Cc: Segher Boessenkool <segher@kernel.crashing.org> Cc: Kernel Hardening <kernel-hardening@lists.openwall.com> Cc: Richard Weinberger <richard@nod.at> Cc: Mike Snitzer <snitzer@redhat.com> Cc: Anton Vorontsov <anton@enomsg.org> Cc: Colin Cross <ccross@android.com> Cc: Andrew Morton <akpm@linuxfoundation.org> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Alasdair Kergon <agk@redhat.com> Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/rslib.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/rslib.h b/include/linux/rslib.h
index 6703311beea3..5974cedd008c 100644
--- a/include/linux/rslib.h
+++ b/include/linux/rslib.h
@@ -50,9 +50,11 @@ struct rs_codec {
/**
* struct rs_control - rs control structure per instance
* @codec: The codec used for this instance
+ * @buffers: Internal scratch buffers used in calls to decode_rs()
*/
struct rs_control {
struct rs_codec *codec;
+ uint16_t buffers[0];
};
/* General purpose RS codec, 8-bit data width, symbol width 1-15 bit */