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: <201002241927.53532.oliver@neukum.org>
Date:	Wed, 24 Feb 2010 19:27:53 +0100
From:	Oliver Neukum <oliver@...kum.org>
To:	Bruno Prémont <bonbons@...ux-vserver.org>
Cc:	Jiri Kosina <jkosina@...e.cz>, linux-input@...r.kernel.org,
	linux-usb@...r.kernel.org, linux-fbdev@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	"Rick L. Vinyard Jr." <rvinyard@...nmsu.edu>,
	Nicu Pavel <npavel@...ner.com>
Subject: Re: [PATCH 1/3] picolcd: driver for PicoLCD HID device

Am Mittwoch, 24. Februar 2010 17:00:49 schrieb Bruno Prémont:
> +static int picolcd_raw_event(struct hid_device *hdev,
> +               struct hid_report *report, u8 *raw_data, int size)
> +{
> +       struct picolcd_data *data = hid_get_drvdata(hdev);
> +       char hexdata[25];
> +       int i;
> +
> +       if (data == NULL)
> +               return 1;
> +
> +       for (i = 0; i < sizeof(hexdata) / 2; i++)
> +               sprintf(hexdata+2*i, "%02hhx", raw_data[i]);
> +       if (size >= sizeof(hexdata)/2) {
> +               hexdata[sizeof(hexdata)-4] = '.';
> +               hexdata[sizeof(hexdata)-3] = '.';
> +               hexdata[sizeof(hexdata)-2] = '.';
> +               hexdata[sizeof(hexdata)-1] = '\0';
> +       } else
> +               hexdata[size*2] = '\0';
> +
> +       switch (report->id) {
> +       case REPORT_KEYPAD:
> +               if (size == 3 && raw_data[0] == 0x11 && data->input_keys) {
> +                       return picolcd_raw_keypad(hdev, report, raw_data+1, size-1);
> +               } else {
> +                       dbg_hid(PICOLCD_NAME " unsupported key event (%d bytes): 0x%s\n", size, hexdata);
> +                       break;
> +               }
> +               break;
> +       case REPORT_VERSION:
> +               if (size == 3)
> +                       dev_info(&hdev->dev, "Firmware version is %hd.%hd\n", raw_data[1], raw_data[2]);
> +
> +               spin_lock(&data->lock);

If I recall correctly raw_event is called in interrupt. As you take a spinlock here,
the lock in code not called in interrupt must disable interrupts, or you may
deadlock.

	Regards
		Oliver
--
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