lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHQjnOM9N8zJmiNnHfrN00jbF8Wk5WwtsBsuPsC2Xv0g_O1tdA@mail.gmail.com>
Date:	Tue, 6 Dec 2011 21:20:31 +0900
From:	KyongHo Cho <pullip.cho@...sung.com>
To:	Marek Szyprowski <m.szyprowski@...sung.com>
Cc:	linux-arm-kernel@...ts.infradead.org,
	linux-samsung-soc@...r.kernel.org,
	iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
	Younglak Kim <younglak1004.kim@...sung.com>,
	Ohad Ben-Cohen <ohad@...ery.com>,
	Kukjin Kim <kgene.kim@...sung.com>,
	Russell King <linux@....linux.org.uk>,
	Sylwester Nawrocki <s.nawrocki@...sung.com>,
	Sanghyun Lee <sanghyun75.lee@...sung.com>
Subject: Re: [PATCH v7 2/2] iommu/exynos: Add iommu driver for Exynos Platforms

On Tue, Dec 6, 2011 at 8:48 PM, Marek Szyprowski
<m.szyprowski@...sung.com> wrote:
> Hello,
>
> I'm trying to integrate your SYSMMU driver with my DMA-mapping & IOMMU
> API integration patches. I've noticed some issues, please see my comments below.
>
Thank you!

> On Friday, November 18, 2011 10:48 AM KyongHo Cho wrote:
>
>> +
>> +static int exynos_sysmmu_probe(struct platform_device *pdev)
>> +{
>> +     struct resource *res, *ioarea;
>> +     int ret;
>> +     int irq;
>> +     struct device *dev;
>> +     void *sfr;
>> +     struct sysmmu_drvdata *data;
>> +     char *emsg;
>> +
>> +     dev = &pdev->dev;
>> +
>> +     if (dev_get_platdata(dev) == NULL) {
>> +             pr_debug("%s: No System MMU is assigned for %s.%d.\n", __func__,
>> +                             pdev->name, pdev->id);
>> +             return -ENODEV;
>> +     }
>> +
>> +     data = kzalloc(sizeof(*data), GFP_KERNEL);
>> +     if (!data) {
>> +             emsg = "Not enough memory";
>> +             ret = -ENOMEM;
>> +             goto err_alloc;
>> +     }
>> +
>> +     data->owner = dev_get_platdata(dev);
>> +
>> +     ret = dev_set_drvdata(dev, data);
>> +     if (ret) {
>> +             emsg = "Unable to set driver data.";
>> +             goto err_init;
>> +     }
>> +
>> +     res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> +     if (!res) {
>> +             emsg = "Failed probing system MMU: failed to get resource.";
>> +             goto err_init;
>> +     }
>> +
>> +     ioarea = request_mem_region(res->start, resource_size(res),
>> +                                                             dev_name(dev));
>> +     if (ioarea == NULL) {
>> +             emsg = "failed to request memory region.";
>> +             ret = -ENOMEM;
>> +             goto err_init;
>> +     }
>> +
>> +     sfr = ioremap(res->start, resource_size(res));
>> +     if (!sfr) {
>> +             emsg = "failed to call ioremap().";
>> +             ret = -ENOENT;
>> +             goto err_ioremap;
>> +     }
>> +
>> +     irq = platform_get_irq(pdev, 0);
>> +     if (irq <= 0) {
>> +             emsg = "failed to get irq resource.";
>> +             ret = irq;
>> +             goto err_irq;
>> +     }
>> +
>> +     ret = request_irq(irq, exynos_sysmmu_irq, 0, dev_name(dev), data);
>> +     if (ret) {
>> +             emsg = "failed to request irq.";
>> +             goto err_irq;
>> +     }
>> +
>> +     data->clk = clk_get(dev, "sysmmu");
>> +     if (IS_ERR(data->clk)) {
>> +             emsg = "failed to get clock descriptor";
>> +             ret = PTR_ERR(data->clk);
>> +             goto err_clk;
>> +     }
>> +
>> +     data->dev = dev;
>> +     data->sfrbase = sfr;
>> +     __set_fault_handler(data, &default_fault_handler);
>> +     rwlock_init(&data->lock);
>
> Here is a serious problem: __set_fault_handler takes data->lock which is initialized after calling
> this function.
>

Yeah, you're right. Thank you. I didn't notice it.
I will fix it.

>> +
>> +static unsigned long *alloc_lv2entry(unsigned long *sent, unsigned long iova,
>> +                                     short *pgcounter)
>> +{
>> +     if (lv1ent_fault(sent)) {
>> +             unsigned long *pent;
>> +
>> +             pent = kzalloc(1024, GFP_KERNEL);
>
> I would use GFP_ATOMIC here. iommu_map() function might be called in atomic context, and
> GFP_KERNEL here causes kernel ops/warning.
>

I wanted to avoid to allocate memory from emergency pool.
Do you think that it needs to allocate memory with GFP_ATOMIC flag?

Thanks.

KyongHo.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ