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] [day] [month] [year] [list]
Date:   Fri, 5 May 2023 09:27:52 +0000
From:   Fabio Baltieri <fabiobaltieri@...omium.org>
To:     Benjamin Tissoires <benjamin.tissoires@...hat.com>
Cc:     Jiri Kosina <jikos@...nel.org>, linux-input@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] HID: hid-stadiaff: add support for Stadia force feedback

Hi,

On Thu, Apr 13, 2023 at 06:00:33PM +0200, Benjamin Tissoires wrote:
> >  drivers/hid/Kconfig        |   7 ++
> >  drivers/hid/Makefile       |   1 +
> >  drivers/hid/hid-ids.h      |   1 +
> >  drivers/hid/hid-stadiaff.c | 132 +++++++++++++++++++++++++++++++++++++
> 
> Mind renaming this hid-google-stadiaff.c?
> It's hard to know that stadia is from Google otherwise.

Sure thing.

> > +static int stadiaff_play(struct input_dev *dev, void *data,
> > +			 struct ff_effect *effect)
> > +{
> > +	struct hid_device *hid = input_get_drvdata(dev);
> > +	struct stadiaff_device *stadiaff = hid_get_drvdata(hid);
> > +	struct hid_field *rumble_field = stadiaff->report->field[0];
> > +
> > +	rumble_field->value[0] = effect->u.rumble.strong_magnitude;
> > +	rumble_field->value[1] = effect->u.rumble.weak_magnitude;
> > +
> > +	schedule_work(&stadiaff->work);
> 
> It seems weird that you don't have any locking in place here.
> What if you are sending a report (in stadiaff_work) while having your
> _play() function called at the same time?

Yeah you are right, I somehow missed the whole locking story, sending a
v2 with that added.

> > +static void stadia_remove(struct hid_device *hid)
> > +{
> > +	struct stadiaff_device *stadiaff = hid_get_drvdata(hid);
> > +
> > +	cancel_work_sync(&stadiaff->work);
> 
> What if you have a ff play event scheduled right here? Don't you need
> some way of forcing the work to not be scheduled once again?

Good point, adding that as well for v2, took the pattern from other
existing drivers.

Thanks for the review,
Fabio

-- 
Fabio Baltieri

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ