[PATCH] stm32: stm32-hash: Add kmalloc_array allocation check
Linus Walleij
linus.walleij at linaro.org
Thu Feb 23 01:52:17 PST 2023
On Thu, Feb 23, 2023 at 10:33 AM Herbert Xu <herbert at gondor.apana.org.au> wrote:
> On Sat, Feb 25, 2023 at 07:14:29AM +0800, Li kunyu wrote:
> >
> > hello senior:
> > 'rctx->hw_context' is a member of the rctx pointer array object and will pass 'memcpy(out, rctx, sizeof(*rctx)) at the end of the function; ', copied to the out pointer memory, it cannot be released, I think this patch does an allocation check on the 'rctx->hw_context' pointer should help a bit.
>
> Ugh that's completely broken. You can't export pointers.
>
> I guess this driver needs to be disabled.
Added Lionel to the To: line so he can look at this, I guess we should
also add an entry to MAINTAINERS so that the reports come to the right
address.
Can we fix the actual problem? It seems to have been there since the
initial submission in 2017.
I guess the right fix is to export the *actual* hardware state into "out"
and read it back from there instead of copying out the rctx struct.
Also .statesize needs to be fixed to correspond to that.
I can just use a roof:ed constant size for this.
If Lionel does not have time to look at it I can try to come up with a
quick fix.
Yours,
Linus Walleij
More information about the linux-arm-kernel
mailing list