diff options
author | NeilBrown <neilb@suse.de> | 2012-08-18 09:51:42 +1000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-02 10:30:33 -0700 |
commit | 956b165f9e89e37aff44d615321d1e3166589701 (patch) | |
tree | eefe7da63af690ee5b1be1f6c799338f6336f94b /kernel/workqueue.c | |
parent | 1f7edfcc0a87e5daf273981135e376ed61d284e4 (diff) | |
download | lwn-956b165f9e89e37aff44d615321d1e3166589701.tar.gz lwn-956b165f9e89e37aff44d615321d1e3166589701.zip |
md/raid10: fix problem with on-stack allocation of r10bio structure.
commit e0ee778528bbaad28a5c69d2e219269a3a096607 upstream.
A 'struct r10bio' has an array of per-copy information at the end.
This array is declared with size [0] and r10bio_pool_alloc allocates
enough extra space to store the per-copy information depending on the
number of copies needed.
So declaring a 'struct r10bio on the stack isn't going to work. It
won't allocate enough space, and memory corruption will ensue.
So in the two places where this is done, declare a sufficiently large
structure and use that instead.
The two call-sites of this bug were introduced in 3.4 and 3.5
so this is suitable for both those kernels. The patch will have to
be modified for 3.4 as it only has one bug.
Reported-by: Ivan Vasilyev <ivan.vasilyev@gmail.com>
Tested-by: Ivan Vasilyev <ivan.vasilyev@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/workqueue.c')
0 files changed, 0 insertions, 0 deletions