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: <Pine.LNX.4.44L0.1003131635170.19476-100000@netrider.rowland.org>
Date:	Sat, 13 Mar 2010 16:35:59 -0500 (EST)
From:	Alan Stern <stern@...land.harvard.edu>
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-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

On Sat, 13 Mar 2010, Bruno [UTF-8] Prémont wrote:

> Is something like below acceptable? (from error handling point of view
> it makes no difference...)
> 
> Thanks,
> Bruno
> 
> file: drivers/hid/hid-core.c
> 
>  int hid_add_device(struct hid_device *hdev)
>  {
>          static atomic_t id = ATOMIC_INIT(0);
>          int ret;
>  
>          if (WARN_ON(hdev->status & HID_STAT_ADDED))
>                  return -EBUSY;
>  
>          /* we need to kill them here, otherwise they will stay allocated to
>           * wait for coming driver */
>          if (hid_ignore(hdev))
>                  return -ENODEV;
>  
>          /* XXX hack, any other cleaner solution after the driver core
>           * is converted to allow more than 20 bytes as the device name? */
>          dev_set_name(&hdev->dev, "%04X:%04X:%04X.%04X", hdev->bus,
>                       hdev->vendor, hdev->product, atomic_inc_return(&id));
>  
> +        hid_debug_register(hdev, dev_name(&hdev->dev));
>          ret = device_add(&hdev->dev);
>          if (!ret)
>                  hdev->status |= HID_STAT_ADDED;
>  
> -        hid_debug_register(hdev, dev_name(&hdev->dev));
>  
>          return ret;
>  }

If the device_add() fails, you should undo the hid_debug_register() 
call.

Alan Stern

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