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

Check result of dma_map_sgtable before dereferencing transaction

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Medium
    • Lustre 2.17.0
    • None
    • None
    • 3
    • 9223372036854775807

    Description

      	if (tn->tn_gpu) {
      		rc = lnet_rdma_map_sg_attrs(dev->device, tn->tn_sgt.sgl,
      					    sg_count, tn->tn_dmadir);
      		if (rc > 0)
      			tn->tn_sgt.nents = rc;
      	} else {
      		rc = dma_map_sgtable(dev->device, &tn->tn_sgt, tn->tn_dmadir,
      				     0);
      	}
      
      	tn->tn_sgt_mapped = true;
      
      	/* tn_num_iovec used for convenience in some debug messages */
      	tn->tn_num_iovec = tn->tn_sgt.nents;
      

      The return value of dma_map_sgtable() is not checked for errors. If this call fails, tn->tn_sgt_mapped will still be set to true, which may cause resource leaks or undefined behavior later.

      Attachments

        Activity

          People

            hornc Chris Horn
            hornc Chris Horn
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: