Re: [PATCH net] netdevsim: avoid NULL dereference after failed probe

From: Jakub Kicinski

Date: Mon Oct 19 2026 - 22:25:25 EST


On Thu, 15 Oct 2026 10:01:33 +0200 Daniel Machon wrote:
> There might be another approach though. Did you explore nsim_driver.dev_groups?
> Adding nsim_bus_dev_new_port_attr/nsim_bus_dev_del_port_attr there might work,
> and the fix will be simpler. I cant claim to be an expert in this area, but it
> might be wort investigating.

I had a similar feeling, but looks like nsim_bus_dev_numvfs_store()
already checks drvdata :\ Let's stick to this approach, but please
fix the flow to look identical to the check in numvfs_store:

device_lock(dev);
ret = -ENOENT;
if (dev_get_drvdata(dev))
ret = nsim_XXX(nsim_bus_dev, num_vfs);
device_unlock(dev);

Please make sure to include the info requested by the bot in next
version, namely:

- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.

- Whether the issue was actually triggered, or is only theoretical
(e.g. found by code inspection). If it was triggered please include
the symptoms, like the stack trace or error messages.
--
pw-bot: cr