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]
Date:   Tue, 20 Feb 2018 21:32:08 -0800
From:   Cameron Gutman <aicommander@...il.com>
To:     Rodrigo Rivas Costa <rodrigorivascosta@...il.com>,
        Jiri Kosina <jikos@...nel.org>,
        Benjamin Tissoires <benjamin.tissoires@...hat.com>,
        linux-kernel@...r.kernel.org, linux-input@...r.kernel.org
Subject: Re: [PATCH v2 1/3] HID: add driver for Valve Steam Controller

On 02/20/2018 11:33 AM, Rodrigo Rivas Costa wrote:
> +static void steam_work_connect_cb(struct work_struct *work)
> +{
> +	struct steam_device *steam = container_of(work, struct steam_device,
> +							work_connect);
> +	unsigned long flags;
> +	bool connected;
> +	int ret;
> +
> +	spin_lock_irqsave(&steam->lock, flags);
> +	connected = steam->connected;
> +	spin_unlock_irqrestore(&steam->lock, flags);
> +
> +	if (connected) {
> +		if (steam->input) {
> +			dbg_hid("%s: already connected\n", __func__);
> +			return;
> +		}
> +		ret = steam_register(steam);
> +		if (ret) {
> +			hid_err(steam->hdev,
> +				"%s:steam_register failed with error %d\n",
> +				__func__, ret);
> +			return;
> +		}
> +	} else {
> +		steam_unregister(steam);

I think you need synchronization here. You don't want to be in the middle of
processing a HID event or power supply update and have your device freed out
from underneath you.

xpad uses RCU to avoid this race.

> +	}
> +}
> +

Regards,
Cameron

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ