aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/idr.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/idr.c b/lib/idr.c
index 4df67928816e..c4afd94bdf69 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -562,6 +562,11 @@ void idr_remove(struct idr *idp, int id)
562 if (id < 0) 562 if (id < 0)
563 return; 563 return;
564 564
565 if (id > idr_max(idp->layers)) {
566 idr_remove_warning(id);
567 return;
568 }
569
565 sub_remove(idp, (idp->layers - 1) * IDR_BITS, id); 570 sub_remove(idp, (idp->layers - 1) * IDR_BITS, id);
566 if (idp->top && idp->top->count == 1 && (idp->layers > 1) && 571 if (idp->top && idp->top->count == 1 && (idp->layers > 1) &&
567 idp->top->ary[0]) { 572 idp->top->ary[0]) {
@@ -1025,6 +1030,9 @@ void ida_remove(struct ida *ida, int id)
1025 int n; 1030 int n;
1026 struct ida_bitmap *bitmap; 1031 struct ida_bitmap *bitmap;
1027 1032
1033 if (idr_id > idr_max(ida->idr.layers))
1034 goto err;
1035
1028 /* clear full bits while looking up the leaf idr_layer */ 1036 /* clear full bits while looking up the leaf idr_layer */
1029 while ((shift > 0) && p) { 1037 while ((shift > 0) && p) {
1030 n = (idr_id >> shift) & IDR_MASK; 1038 n = (idr_id >> shift) & IDR_MASK;