aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/uio/uio.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 10a029b24159..d2efe823c20d 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -381,7 +381,13 @@ static int uio_get_minor(struct uio_device *idev)
381 retval = -ENOMEM; 381 retval = -ENOMEM;
382 goto exit; 382 goto exit;
383 } 383 }
384 idev->minor = id & MAX_ID_MASK; 384 if (id < UIO_MAX_DEVICES) {
385 idev->minor = id;
386 } else {
387 dev_err(idev->dev, "too many uio devices\n");
388 retval = -EINVAL;
389 idr_remove(&uio_idr, id);
390 }
385exit: 391exit:
386 mutex_unlock(&minor_lock); 392 mutex_unlock(&minor_lock);
387 return retval; 393 return retval;