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: <20241025-sexy-fanatic-snail-a1d2e7-mkl@pengutronix.de>
Date: Fri, 25 Oct 2024 10:35:35 +0200
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Ming Yu <a0282524688@...il.com>
Cc: tmyu0@...oton.com, lee@...nel.org, linus.walleij@...aro.org, 
	brgl@...ev.pl, andi.shyti@...nel.org, mailhol.vincent@...adoo.fr, 
	andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org, 
	pabeni@...hat.com, wim@...ux-watchdog.org, linux@...ck-us.net, jdelvare@...e.com, 
	jic23@...nel.org, lars@...afoo.de, ukleinek@...nel.org, 
	alexandre.belloni@...tlin.com, linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org, 
	linux-i2c@...r.kernel.org, linux-can@...r.kernel.org, netdev@...r.kernel.org, 
	linux-watchdog@...r.kernel.org, linux-hwmon@...r.kernel.org, linux-iio@...r.kernel.org, 
	linux-pwm@...r.kernel.org, linux-rtc@...r.kernel.org
Subject: Re: [PATCH v1 1/9] mfd: Add core driver for Nuvoton NCT6694

On 25.10.2024 16:14:03, Ming Yu wrote:
> Marc Kleine-Budde <mkl@...gutronix.de> 於 2024年10月24日 週四 下午11:34寫道:
> >
> > On 24.10.2024 17:20:57, Marc Kleine-Budde wrote:
> >
> > [...]
> >
> > > > +   nct6694->cmd_buffer = devm_kcalloc(dev, CMD_PACKET_SZ,
> > > > +                                      sizeof(unsigned char), GFP_KERNEL);
> > > > +   if (!nct6694->cmd_buffer)
> > > > +           return -ENOMEM;
> > > > +   nct6694->rx_buffer = devm_kcalloc(dev, MAX_PACKET_SZ,
> > > > +                                     sizeof(unsigned char), GFP_KERNEL);
> > > > +   if (!nct6694->rx_buffer)
> > > > +           return -ENOMEM;
> > > > +   nct6694->tx_buffer = devm_kcalloc(dev, MAX_PACKET_SZ,
> > > > +                                     sizeof(unsigned char), GFP_KERNEL);
> > > > +   if (!nct6694->tx_buffer)
> > > > +           return -ENOMEM;
> > > > +   nct6694->int_buffer = devm_kcalloc(dev, MAX_PACKET_SZ,
> > > > +                                      sizeof(unsigned char), GFP_KERNEL);
> > > > +   if (!nct6694->int_buffer)
> > > > +           return -ENOMEM;
> > > > +
> > > > +   nct6694->int_in_urb = usb_alloc_urb(0, GFP_KERNEL);
> > > > +   if (!nct6694->int_in_urb) {
> > > > +           dev_err(&udev->dev, "Failed to allocate INT-in urb!\n");
> > > > +           return -ENOMEM;
> > > > +   }
> > > > +
> > > > +   /* Bulk pipe maximum packet for each transaction */
> > > > +   bulk_pipe = usb_sndbulkpipe(udev, BULK_OUT_ENDPOINT);
> > > > +   nct6694->maxp = usb_maxpacket(udev, bulk_pipe);
> > > > +
> > > > +   mutex_init(&nct6694->access_lock);
> > > > +   nct6694->udev = udev;
> > > > +   nct6694->timeout = URB_TIMEOUT; /* Wait until urb complete */
> > > > +
> > > > +   INIT_LIST_HEAD(&nct6694->handler_list);
> > > > +   spin_lock_init(&nct6694->lock);
> > > > +
> > > > +   usb_fill_int_urb(nct6694->int_in_urb, udev, pipe,
> > > > +                    nct6694->int_buffer, maxp, usb_int_callback,
> > > > +                    nct6694, int_endpoint->bInterval);
> > > > +   ret = usb_submit_urb(nct6694->int_in_urb, GFP_KERNEL);
> > > > +   if (ret)
> > > > +           goto err_urb;
> > > > +
> > > > +   dev_set_drvdata(&udev->dev, nct6694);
> > > > +   usb_set_intfdata(iface, nct6694);
> > > > +
> > > > +   ret = mfd_add_hotplug_devices(&udev->dev, nct6694_dev,
> > > > +                                 ARRAY_SIZE(nct6694_dev));
> > > > +   if (ret) {
> > > > +           dev_err(&udev->dev, "Failed to add mfd's child device\n");
> > > > +           goto err_mfd;
> > > > +   }
> > > > +
> > > > +   nct6694->async_workqueue = alloc_ordered_workqueue("asyn_workqueue", 0);
> > >
> > > Where is the async_workqueue used?
> >
> > Sorry - it's used in the driver, which live in separate directories -
> > you can ignore this comment.
> >
> > But then the question comes up, it looks racy to _first_ add the devices
> > and _then_ the workqueue.

> Excuse me, I'm a bit confused. Is there anything I need to
> improve on?

It looks racy to _first_ add the devices and _then_ the workqueue.

So the obvious solution is to allocate the worklist first and then add
the devices.

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ