Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve module version type positions #66

Merged
merged 1 commit into from
Nov 10, 2018

Commits on Nov 10, 2018

  1. Preserve module version type positions

    Initialize the "res" array of get_module_verinfo() to three empty elements to
    preserve relative positions of different version types stored there, when the
    "res" array is expanded in check_version_sanity(), and to allow comparison
    between compatible version types only.
    
    Without that, if the module in question only had "srcversion", which is
    assigned to "res[1]", then after e.g. this assignment in
    check_version_sanity():
    
        kernels_info=("${res[@]}")
    
    The value will end up in "kernels_info[0]", the position that is
    supposed to be occupied by the regular "version".
    
    In the case of the stock kernel's module having only "srcversion", but
    the installed module having a regular "version", this could lead to a
    comparison between them, in check_version_sanity(), and an incorrect
    conclusion about the module being (not) newer in the kernel.
    
    E.g. when the stock kernel's module only has this field in modinfo:
    
        filename: /lib/modules/3.10.0-862.14.4.el7.x86_64/kernel/drivers/hid/hid-uclogic.ko.xz
        srcversion: 27A2028780DCB320780F53D
    
    but the module being installed has these fields:
    
        filename: /var/lib/dkms/digimend/9/3.10.0-862.14.4.el7.x86_64/x86_64/module//hid-uclogic.ko.xz
        version: 9
        srcversion: 0485A47017CB313B2F84B27
    
    DKMS would incorrectly conclude:
    
        Error! Module version 9 for hid-uclogic.ko.xz
        is not newer than what is already found in kernel 3.10.0-862.14.4.el7.x86_64 (27A2028780DCB320780F53D).
    spbnick committed Nov 10, 2018
    Configuration menu
    Copy the full SHA
    6ef1a48 View commit details
    Browse the repository at this point in the history