Skip to content

Crash on module load when /sys/class/chardrv already exists: sysfs: cannot create duplicate filename '/class/chardrv' (Linux 6.10.x). #12

Description

@dreirund

Ahoj,

there is a project "dev_scream" that is based on your project but changed the character device name and output such that cat /dev/scream produces a flow of aHAAhhaHHAAHaAaAAAAhhHhhAAaAA[...].

When both modules get loaded, the kernel prints a call trace (and hangs on unload): Regardless of the order, when the second module is loaded an error message

sysfs: cannot create duplicate filename '/class/chardrv'

is printed to the kernel log, followed by a call trace.

Upon unload, the system hard-freezes (also SysRq does no longer work).

Attached kernel log: dmesg.log.

Maybe the code needs to have some work to more "dynamically" create some names, or maybe it is totally "dev_scream"'s fault?

("/class/chardrv" is a pretty generic name; if that is what you create and can only be created once then I think it is generally prone to errors. What is if another driver also comes along and wants to use that generic name? I think you should add some more code here to handle the case when it already exists.)

Kernel: Linux 6.10.7.

Regards!

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions