Re: [PATCH] dmaengine: idxd: Fix dereference on uninitialized pointer conf_dev

From: Colin King (gmail)
Date: Mon Aug 11 2025 - 07:26:02 EST


On 11/08/2025 11:16, Dan Carpenter wrote:
On Mon, Aug 11, 2025 at 10:58:36AM +0100, Colin Ian King wrote:
Currently if the allocation for wq fails on the initial iteration in
the setup loop the error exit path to err will call put_device on
an uninitialized pointer conf_dev. Fix this by initializing conf_dev
to NULL, note that put_device will ignore a NULL device pointer so no
null pointer dereference issues occur on this call.

Fixes: 3fd2f4bc010c ("dmaengine: idxd: fix memory leak in error handling path of idxd_setup_wqs")

Signed-off-by: Colin Ian King <colin.i.king@xxxxxxxxx>
---

No. This isn't the right fix. I basically wrote out the correct fix
in my bug report:
https://lore.kernel.org/all/aDQt3_rZjX-VuHJW@stanley.mountain/
Shuai Xue sent a fix as well but that patch wasn't right either but I
didn't review it until now.

It's easiest if I send the fix and give you Reported-by credit.

regards,
dan carpenter


Thanks Dan, always appreciate your input to these issues.

Colin

Attachment: OpenPGP_0x68C287DFC6A80226.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature