lkml.org 
[lkml]   [2012]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [PATCH] resource: make sure requested range intersects root range
    On Wed, Jul 11, 2012 at 02:06:10PM +0300, Purdila, Octavian wrote:
    > On Wed, Jul 11, 2012 at 5:09 AM, Ram Pai <linuxram@us.ibm.com> wrote:
    >
    > >
    > > Wait.. I am not sure this will fix the problem entirely. The above check
    > > will handle the case where the range requested is entirey out of the
    > > root's range. But if the requested range overlapps that of the root
    > > range, we will still call __reserve_region_with_split() and end up with
    > > a recursion if there is a overflow. Wont we?
    > >
    >
    > Good catch. I will fix this as well as address Andrew's and Joe's
    > comments in a new patch. The only question is how to handle the
    > overlap case:
    >
    > (a) abort the whole request or
    >
    > (b) try to reserve the part that overlaps (and adjust the request to
    > avoid the overflow)
    >
    > I think (b) is more in line with the current implementation for reservations.


    I prefer (b). following patch should handle that.

    diff --git a/kernel/resource.c b/kernel/resource.c
    index e1d2b8e..dd87fde 100644
    --- a/kernel/resource.c
    +++ b/kernel/resource.c
    @@ -780,6 +780,10 @@ static void __init __reserve_region_with_split(struct resource *root,

    if (conflict->start > start)
    __reserve_region_with_split(root, start, conflict->start-1, name);
    +
    + if (conflict->end == parent->end )
    + return;
    +
    if (conflict->end < end)
    __reserve_region_with_split(root, conflict->end+1, end, name);
    }
    RP



    \
     
     \ /
      Last update: 2012-07-11 17:21    [W:0.045 / U:2.736 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site