Skip to content

Conversation

@HatsyRei
Copy link
Member

@HatsyRei HatsyRei commented Mar 4, 2025

WI: AB#3024196

Bluefin devices expect to mount mtdblock devices created by gluebi at runtime, but cfd7c9d prevents gluebi from creating these mtdblock devices as a mitigation to a NULL pointer dereference caused by FTL notifier. As a workaround, this commit adds a check for CONFIG_FTL before doing so, keeping the solution intact if CONFIG_FTL is enabled, while allowing the creation of gluebi mtdblock devices if CONFIG_FTL is not enabled.

Testing: Built and deployed kernel with changes on cDAQ-9189, verified that mtdblocks are enumerated for gluebi mtd partitions when CONFIG_FTL is not enabled.

@gratian gratian requested a review from a team March 4, 2025 16:21
Copy link

@chaitu236 chaitu236 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mention that this is a workaround in your PR description. What would the correct fix look like?

@HatsyRei
Copy link
Member Author

HatsyRei commented Mar 5, 2025

You mention that this is a workaround in your PR description. What would the correct fix look like?

The other option would involve leaving the driver code as is, and utilizing a different way to emulate block devices on UBI (such as ubiblock). This would require us to pull in a new driver, make changes to u-boot to ensure that the block devices are correctly configured at boot time, and have the kernel anticipate the new block device labels and mount them. Theoretically all these should just work, but we'll need to look at whether these changes can be delivered to shipped hardware via existing field firmware update infrastructure. My understanding is we don't have an official way to update u-boot on Bluefin devices, so this will be difficult.

The workaround here is hence to just allow enumeration of block devices for gluebi mtd partitions if the ftl driver is not enabled.

Copy link

@gratian gratian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks fine (given the options we have) but can you mention the upstream commit directly in the commit message and not the GitHub PR description.

Somebody looking at this commit in the future (for example when doing a kernel rebase/upgrade) won't be able to easily tie it back to the PR description and understand what is going on.

Originally, NULL pointer dereference can be caused by FTL notifier
accessing 'gluebi->desc' in gluebi_read. The solution was to completely
prevent gluebi from creating mtdblock devices.

See commit: cfd7c9d

This creates a problem as existing systems may expect mtdblocks emulated
on top of UBI to exist. As a workaround, this commit prevents gluebi
mtdblock device creation only if CONFIG_FTL is enabled.

Signed-off-by: HatsyRei <yan.huan.chng@emerson.com>
@HatsyRei
Copy link
Member Author

HatsyRei commented Mar 7, 2025

Edited commit message and rebased fork.

@gratian
Copy link

gratian commented Mar 10, 2025

I've reworded the commit message slightly to match the upstream standard for quoting commits/commit messages.
Merged outside GitHub workflow; closing PR.

@gratian gratian closed this Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants