How to replace set_fs(KERNEL_DS) for a kernel 5.10.x module driver version

Jorge Fernandez Monteagudo jorgefm at cirsa.com
Tue Jan 12 02:39:37 EST 2021


>> Hi all, this is my first post in this mailing list... I hope to find an answer. I've post the question in stackoverflow with the same tittle with no answers yet. Since then, I've been able to reduce the demo kernel module to minimum in order to show but I see. The minimum kernel module code is attached at the end.
>> 
>> My kernel module was working ok up to kernel 5.10.x. My kernel module adds a layer above the cdc-acm class driver to use all the infrastructure this driver because the hardware it controls has a ttyACMx device. The minimum kernel module code attached shows how I open the ttyACMx device and try to set the baudrate. Once the device is opened I use the unlocked_ioctl function with TCSETS to set the new device properties. 
>> 
>>                ret = fd->f_op->unlocked_ioctl(fd, TCSETS, (unsigned long int) &newtio);

>Ick, why do all of this from the kernel and not just do it from
>userspace?
>
>Do you have a pointer to the source of your whole module so we can help
>with solving the root problem and not mess with this specific
>implementation which is not the correct thing to do at all.

Hi Greg!

Well, I can summarize as technological debt :( 
I have to maintain an old code and I've been succesful until now with minimal changes... Is there no way to overcome this?

Thanks!
Jorge


More information about the Kernelnewbies mailing list