Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-14609

potential memory leak in osp_it_fetch()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Minor
    • None
    • None
    • None
    • 3
    • 9223372036854775807

    Description

      It appears there may be a memory leak in the error handling in osp_it_fetch():

              OBD_ALLOC(pages, npages * sizeof(*pages));
              if (pages == NULL)
                      RETURN(-ENOMEM);
      
              it->ooi_pages = pages;
              it->ooi_total_npages = npages;
              for (i = 0; i < npages; i++) {
                      pages[i] = alloc_page(GFP_NOFS);
                      if (pages[i] == NULL)
                              RETURN(-ENOMEM);
              }
              req = ptlrpc_request_alloc(osp->opd_obd->u.cli.cl_import,
                                         &RQF_OBD_IDX_READ);
              if (req == NULL)
                      RETURN(-ENOMEM);
      

      This looks like it will leak the pages array in the first case (up to 2KB), and the allocated pages themselves (up to 1MB) if the req allocation fails. I'm not 100% sure in this is an actual leak, because the pages array is saved to ooi_pages, and that is freed in osp_it_fini(), but I'm not yet convinced that is always called in the error case.

      This was found by code inspection while looking for large page array allocations (of which this is not currently a case).

      Code was added in commit v2_5_56_0-4-g77eea1985b patch http://review.whamcloud.com/8303 "LU-3336 lfsck: orphan OST-objects iteration".

      Attachments

        Activity

          People

            wc-triage WC Triage
            adilger Andreas Dilger
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: