Re: [PATCH -next] firmware: imx: Add missing return in error path to prevent use-after-free.
From: Dan Carpenter
Date: Thu May 28 2026 - 06:15:52 EST
On Thu, May 28, 2026 at 02:44:46PM +0530, Pankaj Gupta wrote:
> After freeing dev_ctx and setting *new_dev_ctx to NULL, the function
> continues execution and dereferences dev_ctx, leading to a potential
> use-after-free. Return immediately to avoid accessing freed memory.
>
> This appears to have been lost during merge of the original fix.
>
> Fixes: 3ae9dcce8400 ("firmware: drivers: imx: adds miscdev")
> Signed-off-by: Dan Carpenter <error27@xxxxxxxxx>
> Signed-off-by: Pankaj Gupta <pankaj.gupta@xxxxxxx>
I try not to be a whiner about patch attibution to me because I feel
like I get enough credit for stuff and don't need to complain about
small things. But it's puzzling to see my Signed-off-by here and
normally someone would ask about it.
I did write a patch for this but you have modified the commit message
and added a blank line.
https://lore.kernel.org/all/agv_jhP-2CNTfQXk@stanley.mountain/
Potentially, you already had written this patch by the time I sent
mine because it was a static checker fix and a lot of people run static
checkers.
Normally these tags are in chronoligical order and a Signed-off-by would
mean I handled the patch. It doesn't make sense for me to be the first
person to handle the patch if I didn't write it.
I suspect what happened is that actually I should get authorship credit
but when you modified the patch, the authorship was lost. (I have
done this mistake unintentionally before. More than once). To give
authorship credit, the first line in the body of the email would be:
From: Dan Carpenter <error27@xxxxxxxxx>
But if you already had a patch written then just give me a
Reported-by tag instead. Either way is fine.
Sorry again, for being a bit nit picky on this...
regards,
dan carpenter