• Paul Wagland's avatar
    [PATCH] bug fix for megaraid memory leak · 4c76a6b2
    Paul Wagland authored
    I was going through the code looking for bits and pieces to pull across
    into the new LSI Logic beta megaraid driver /sys fs code and came across
    this one.
    
    LSI Logic have already fixed this issue for the 2.4 driver, and the new
    beta driver does not use the /proc filesystem at all, so no problem
    there.
    
    The problem is that resources are not freed upon certain error
    conditions in the in-kernel megaraid driver, to quote from Lester
    Hightower (who originally found the issue):
    
       "The problem occurs only in the circumstance where one reads one of
        the /proc/megaraid/hba<X>/diskdrives-ch<N> files where the card <X>
        does not have channel <N> on it.  Most people would likely not
        notice this leak in normal operation, but due to the way that we
        monitor our MegaRaid cards in our company (we read these /proc
        entries every 180s) so we found the leak rather quickly, and
        unpleasantly (when your kernel eats all your RAM)."
    
    Anyway, here is the fix, compiled and tested OK for me.
    4c76a6b2
megaraid.c 115 KB