Skip to content

block: genhd: Add NULL check for kobject_create_and_add in genhd_device_init#964

Open
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1111616=>linus-master
Open

block: genhd: Add NULL check for kobject_create_and_add in genhd_device_init#964
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1111616=>linus-master

Conversation

@blktests-ci

@blktests-ci blktests-ci Bot commented Jun 15, 2026

Copy link
Copy Markdown

Pull request for series with
subject: block: genhd: Add NULL check for kobject_create_and_add in genhd_device_init
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1111616

…ce_init

The kobject_create_and_add() call in genhd_device_init() may return NULL
if memory allocation fails, but the return value was not being checked.
This could lead to NULL pointer dereferences in subsequent calls to
sysfs_create_link() and sysfs_remove_link() which use block_depr.

Add proper error checking and cleanup path to handle the case when
kobject_create_and_add() fails.

Fixes: 721da5c ("driver core: remove CONFIG_SYSFS_DEPRECATED
	and CONFIG_SYSFS_DEPRECATED_V2")
Signed-off-by: Li Jun <lijun01@kylinos.cn>
@blktests-ci

blktests-ci Bot commented Jun 15, 2026

Copy link
Copy Markdown
Author

Upstream branch: 062871f
series: https://patchwork.kernel.org/project/linux-block/list/?series=1111616
version: 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant