Skip to content

device: unimplemented ioctls may return error code other than ENOTTY if passed invalid input #5

@Gnurou

Description

@Gnurou

Currently virtio_media_dispatch_ioctl tries to validate the passed input and returns EINVAL it is doesn't pass. The problem is that if the ioctl handler does not override the ioctl, it is supposed to return ENOTTY - which won't happen here, making the driver believe that the ioctl is in fact supported.

I cannot find an ideal solution to this, but the less worse is probably to define a bool constant for each ioctl in the VirtioMediaIoctlHandler trait that defaults to false, and which implementers need to flip to true if they are overriding the ioctl. That way the dispatch method can check if the constant is true, return ENOTTY if it isn't, and then proceed with the validation and handler calling otherwise.

If we go that route the default ioctl implementation should probably panic, as it won't be called unless the implementer overriddes the constant of the ioctl without reimplementing the handler as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions