lkml.org 
[lkml]   [2011]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    SubjectRe: [PATCH] uio: fix allocating minor id for uio device
    From
    The number of uio devices that could be used should be less than
    UIO_MAX_DEVICES by design, and this work guards any cases in which id
    more than UIO_MAX_DEVICES is utilized.

    Signed-off-by: Hillf Danton <dhillf@gmail.com>
    ---

    --- a/drivers/uio/uio.c 2011-01-05 08:50:20.000000000 +0800
    +++ b/drivers/uio/uio.c 2011-03-31 20:43:44.000000000 +0800
    @@ -381,7 +381,13 @@ static int uio_get_minor(struct uio_devi
    retval = -ENOMEM;
    goto exit;
    }
    - idev->minor = id & MAX_ID_MASK;
    + if (id < UIO_MAX_DEVICES) {
    + idev->minor = id;
    + } else {
    + dev_err(idev->dev, "too many uio devices\n");
    + retval = -EINVAL;
    + idr_remove(&uio_idr, id);
    + }
    exit:
    mutex_unlock(&minor_lock);
    return retval;

    \
     
     \ /
      Last update: 2011-03-31 14:41    [W:0.024 / U:89.644 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site