• Alessandro Rubini's avatar
    wishbone.c: change read/write_iter() for post-5.19 kernels · 0434a533
    Alessandro Rubini authored
    If user spaces calls read(2), the vfs_read() in fs/read_write.c
    does not create an iov array any more since v5.19-10288-g3e20a751aff0.
    
    That commit does as follows:
    
       -       struct iovec iov = { .iov_base = buf, .iov_len = len };
       -       iov_iter_init(&iter, READ, &iov, 1, len);
       +       iov_iter_ubuf(&iter, READ, buf, len);
    
    as a resuly, our code that checks iter->iov->nr_segs sees 0 segments,
    understands we have no buffer, and returns 0. Same for write(2).
    
    This is a hack, as I don'w know what happens if the user space uses readv/writev.
    Actually, I'd better have a simple fops->read() and fops->write() in the driver,
    but I'm sure I lack a lot of background knowledge here.
    Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
    0434a533
wishbone.c 23.1 KB