提交 437b8a26 编写于 作者: M Michael Chan 提交者: David S. Miller

cnic: Don't take cnic_dev_lock in cnic_alloc_uio_rings()

We are allocating memory with GFP_KERNEL under spinlock.  Since this is
the only call manipulating the cnic_udev_list and it is always under
rtnl_lock, cnic_dev_lock can be safely removed.
Signed-off-by: NMichael Chan <mchan@broadcom.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 20f30c2d
...@@ -1039,21 +1039,17 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages) ...@@ -1039,21 +1039,17 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
struct cnic_local *cp = dev->cnic_priv; struct cnic_local *cp = dev->cnic_priv;
struct cnic_uio_dev *udev; struct cnic_uio_dev *udev;
read_lock(&cnic_dev_lock);
list_for_each_entry(udev, &cnic_udev_list, list) { list_for_each_entry(udev, &cnic_udev_list, list) {
if (udev->pdev == dev->pcidev) { if (udev->pdev == dev->pcidev) {
udev->dev = dev; udev->dev = dev;
if (__cnic_alloc_uio_rings(udev, pages)) { if (__cnic_alloc_uio_rings(udev, pages)) {
udev->dev = NULL; udev->dev = NULL;
read_unlock(&cnic_dev_lock);
return -ENOMEM; return -ENOMEM;
} }
cp->udev = udev; cp->udev = udev;
read_unlock(&cnic_dev_lock);
return 0; return 0;
} }
} }
read_unlock(&cnic_dev_lock);
udev = kzalloc(sizeof(struct cnic_uio_dev), GFP_ATOMIC); udev = kzalloc(sizeof(struct cnic_uio_dev), GFP_ATOMIC);
if (!udev) if (!udev)
...@@ -1067,9 +1063,7 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages) ...@@ -1067,9 +1063,7 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
if (__cnic_alloc_uio_rings(udev, pages)) if (__cnic_alloc_uio_rings(udev, pages))
goto err_udev; goto err_udev;
write_lock(&cnic_dev_lock);
list_add(&udev->list, &cnic_udev_list); list_add(&udev->list, &cnic_udev_list);
write_unlock(&cnic_dev_lock);
pci_dev_get(udev->pdev); pci_dev_get(udev->pdev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册