Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1719201

Re: [PATCH] iommu/amd: Check if domain is NULL before dereference it

From Dan Carpenter <dan.carpenter@oracle.com>
Newsgroups linux.kernel
Subject Re: [PATCH] iommu/amd: Check if domain is NULL before dereference it
Date 2017-08-24 14:40 +0200
Message-ID <uhZAv-6z1-25@gated-at.bofh.it> (permalink)
References <uhYXL-63x-9@gated-at.bofh.it> <uhZh7-6r5-13@gated-at.bofh.it> <uhZqO-6v9-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Take a look at this code for example.  But all the places which call
get_domain() are the same:

drivers/iommu/amd_iommu.c
  2648          page = virt_to_page(virt_addr);
  2649          size = PAGE_ALIGN(size);
  2650  
  2651          domain = get_domain(dev);
                         ^^^^^^^^^^^^^^
imagined get_domain() returns NULL.

  2652          if (IS_ERR(domain))
  2653                  goto free_mem;
  2654  
  2655          dma_dom = to_dma_ops_domain(domain);
                          ^^^^^^^^^^^^^^^^^^^^^^^^^
This will Oops.

  2656  

regards,
dan carpenter

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] iommu/amd: Check if domain is NULL before dereference it Baoquan He <bhe@redhat.com> - 2017-08-24 14:00 +0200
  Re: [PATCH] iommu/amd: Check if domain is NULL before dereference it Dan Carpenter <dan.carpenter@oracle.com> - 2017-08-24 14:20 +0200
    Re: [PATCH] iommu/amd: Check if domain is NULL before dereference it Baoquan He <bhe@redhat.com> - 2017-08-24 14:30 +0200
      Re: [PATCH] iommu/amd: Check if domain is NULL before dereference it Dan Carpenter <dan.carpenter@oracle.com> - 2017-08-24 14:40 +0200
        Re: [PATCH] iommu/amd: Check if domain is NULL before dereference it Baoquan He <bhe@redhat.com> - 2017-08-24 14:50 +0200
          Re: [PATCH] iommu/amd: Check if domain is NULL before dereference it Dan Carpenter <dan.carpenter@oracle.com> - 2017-08-24 15:00 +0200
            Re: [PATCH] iommu/amd: Check if domain is NULL before dereference it Baoquan He <bhe@redhat.com> - 2017-08-24 15:10 +0200

csiph-web