Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 51feb98d authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (48 commits)
  USB: otg: fix module reinsert issue
  USB: handle zero-length usbfs submissions correctly
  USB: EHCI: report actual_length for iso transfers
  USB: option: remove unnecessary and erroneous code
  USB: cypress_m8: remove invalid Clear-Halt
  USB: musb_host: undo incorrect change in musb_advance_schedule()
  USB: fix LANGID=0 regression
  USB: serial: sierra driver id_table additions
  USB serial: Add ID for Turtelizer, an FT2232L-based JTAG/RS-232 adapter.
  USB: fix race leading to a write after kfree in usbfs
  USB: Sierra: fix oops upon device close
  USB: option.c: add A-Link 3GU device id
  USB: Serial: Add support for Arkham Technology adapters
  USB: Fix option_ms regression in 2.6.31-rc2
  USB: gadget audio: select SND_PCM
  USB: ftdi: support NDI devices
  Revert USB: usbfs: deprecate and hide option for !embedded
  USB: usb.h: fix kernel-doc notation
  USB: RNDIS gadget, fix issues talking from PXA
  USB: serial: FTDI with product code FB80 and vendor id 0403
  ...
parents 8f8f0134 dc7520c1
Loading
Loading
Loading
Loading
+23 −8
Original line number Diff line number Diff line
@@ -387,6 +387,7 @@ static void acm_rx_tasklet(unsigned long _acm)
	struct acm_ru *rcv;
	unsigned long flags;
	unsigned char throttled;
	struct usb_host_endpoint *ep;

	dbg("Entering acm_rx_tasklet");

@@ -462,6 +463,15 @@ static void acm_rx_tasklet(unsigned long _acm)

		rcv->buffer = buf;

		ep = (usb_pipein(acm->rx_endpoint) ? acm->dev->ep_in : acm->dev->ep_out)
				[usb_pipeendpoint(acm->rx_endpoint)];
		if (usb_endpoint_xfer_int(&ep->desc))
			usb_fill_int_urb(rcv->urb, acm->dev,
					 acm->rx_endpoint,
					 buf->base,
					 acm->readsize,
					 acm_read_bulk, rcv, ep->desc.bInterval);
		else
			usb_fill_bulk_urb(rcv->urb, acm->dev,
					  acm->rx_endpoint,
					  buf->base,
@@ -1227,6 +1237,11 @@ static int acm_probe(struct usb_interface *intf,
			goto alloc_fail7;
		}

		if (usb_endpoint_xfer_int(epwrite))
			usb_fill_int_urb(snd->urb, usb_dev,
				usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress),
				NULL, acm->writesize, acm_write_bulk, snd, epwrite->bInterval);
		else
			usb_fill_bulk_urb(snd->urb, usb_dev,
				usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress),
				NULL, acm->writesize, acm_write_bulk, snd);
+6 −4
Original line number Diff line number Diff line
@@ -751,7 +751,7 @@ static int get_capabilities(struct usbtmc_device_data *data)
{
	struct device *dev = &data->usb_dev->dev;
	char *buffer;
	int rv;
	int rv = 0;

	buffer = kmalloc(0x18, GFP_KERNEL);
	if (!buffer)
@@ -763,7 +763,7 @@ static int get_capabilities(struct usbtmc_device_data *data)
			     0, 0, buffer, 0x18, USBTMC_TIMEOUT);
	if (rv < 0) {
		dev_err(dev, "usb_control_msg returned %d\n", rv);
		return rv;
		goto err_out;
	}

	dev_dbg(dev, "GET_CAPABILITIES returned %x\n", buffer[0]);
@@ -773,7 +773,8 @@ static int get_capabilities(struct usbtmc_device_data *data)
	dev_dbg(dev, "USB488 device capabilities are %x\n", buffer[15]);
	if (buffer[0] != USBTMC_STATUS_SUCCESS) {
		dev_err(dev, "GET_CAPABILITIES returned %x\n", buffer[0]);
		return -EPERM;
		rv = -EPERM;
		goto err_out;
	}

	data->capabilities.interface_capabilities = buffer[4];
@@ -781,8 +782,9 @@ static int get_capabilities(struct usbtmc_device_data *data)
	data->capabilities.usb488_interface_capabilities = buffer[14];
	data->capabilities.usb488_device_capabilities = buffer[15];

err_out:
	kfree(buffer);
	return 0;
	return rv;
}

#define capability_attribute(name)					\
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ comment "Miscellaneous USB options"
	depends on USB

config USB_DEVICEFS
	bool "USB device filesystem (DEPRECATED)" if EMBEDDED
	bool "USB device filesystem (DEPRECATED)"
	depends on USB
	---help---
	  If you say Y here (and to "/proc file system support" in the "File
+6 −4
Original line number Diff line number Diff line
@@ -136,17 +136,19 @@ static const struct class_info clas_info[] =
	{USB_CLASS_AUDIO,		"audio"},
	{USB_CLASS_COMM,		"comm."},
	{USB_CLASS_HID,			"HID"},
	{USB_CLASS_HUB,			"hub"},
	{USB_CLASS_PHYSICAL,		"PID"},
	{USB_CLASS_STILL_IMAGE,		"still"},
	{USB_CLASS_PRINTER,		"print"},
	{USB_CLASS_MASS_STORAGE,	"stor."},
	{USB_CLASS_HUB,			"hub"},
	{USB_CLASS_CDC_DATA,		"data"},
	{USB_CLASS_APP_SPEC,		"app."},
	{USB_CLASS_VENDOR_SPEC,		"vend."},
	{USB_CLASS_STILL_IMAGE,		"still"},
	{USB_CLASS_CSCID,		"scard"},
	{USB_CLASS_CONTENT_SEC,		"c-sec"},
	{USB_CLASS_VIDEO,		"video"},
	{USB_CLASS_WIRELESS_CONTROLLER,	"wlcon"},
	{USB_CLASS_MISC,		"misc"},
	{USB_CLASS_APP_SPEC,		"app."},
	{USB_CLASS_VENDOR_SPEC,		"vend."},
	{-1,				"unk."}		/* leave as last */
};

+47 −31
Original line number Diff line number Diff line
@@ -325,21 +325,34 @@ static void async_completed(struct urb *urb)
	struct async *as = urb->context;
	struct dev_state *ps = as->ps;
	struct siginfo sinfo;
	struct pid *pid = NULL;
	uid_t uid = 0;
	uid_t euid = 0;
	u32 secid = 0;
	int signr;

	spin_lock(&ps->lock);
	list_move_tail(&as->asynclist, &ps->async_completed);
	spin_unlock(&ps->lock);
	as->status = urb->status;
	if (as->signr) {
	signr = as->signr;
	if (signr) {
		sinfo.si_signo = as->signr;
		sinfo.si_errno = as->status;
		sinfo.si_code = SI_ASYNCIO;
		sinfo.si_addr = as->userurb;
		kill_pid_info_as_uid(as->signr, &sinfo, as->pid, as->uid,
				      as->euid, as->secid);
		pid = as->pid;
		uid = as->uid;
		euid = as->euid;
		secid = as->secid;
	}
	snoop(&urb->dev->dev, "urb complete\n");
	snoop_urb(urb, as->userurb);
	spin_unlock(&ps->lock);

	if (signr)
		kill_pid_info_as_uid(sinfo.si_signo, &sinfo, pid, uid,
				      euid, secid);

	wake_up(&ps->wait);
}

@@ -982,7 +995,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
				USBDEVFS_URB_ZERO_PACKET |
				USBDEVFS_URB_NO_INTERRUPT))
		return -EINVAL;
	if (!uurb->buffer)
	if (uurb->buffer_length > 0 && !uurb->buffer)
		return -EINVAL;
	if (!(uurb->type == USBDEVFS_URB_TYPE_CONTROL &&
	    (uurb->endpoint & ~USB_ENDPOINT_DIR_MASK) == 0)) {
@@ -1038,11 +1051,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
			is_in = 0;
			uurb->endpoint &= ~USB_DIR_IN;
		}
		if (!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ,
				uurb->buffer, uurb->buffer_length)) {
			kfree(dr);
			return -EFAULT;
		}
		snoop(&ps->dev->dev, "control urb: bRequest=%02x "
			"bRrequestType=%02x wValue=%04x "
			"wIndex=%04x wLength=%04x\n",
@@ -1062,9 +1070,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
		uurb->number_of_packets = 0;
		if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE)
			return -EINVAL;
		if (!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ,
				uurb->buffer, uurb->buffer_length))
			return -EFAULT;
		snoop(&ps->dev->dev, "bulk urb\n");
		break;

@@ -1106,28 +1111,35 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
			return -EINVAL;
		if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE)
			return -EINVAL;
		if (!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ,
				uurb->buffer, uurb->buffer_length))
			return -EFAULT;
		snoop(&ps->dev->dev, "interrupt urb\n");
		break;

	default:
		return -EINVAL;
	}
	if (uurb->buffer_length > 0 &&
			!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ,
				uurb->buffer, uurb->buffer_length)) {
		kfree(isopkt);
		kfree(dr);
		return -EFAULT;
	}
	as = alloc_async(uurb->number_of_packets);
	if (!as) {
		kfree(isopkt);
		kfree(dr);
		return -ENOMEM;
	}
	as->urb->transfer_buffer = kmalloc(uurb->buffer_length, GFP_KERNEL);
	if (uurb->buffer_length > 0) {
		as->urb->transfer_buffer = kmalloc(uurb->buffer_length,
				GFP_KERNEL);
		if (!as->urb->transfer_buffer) {
			kfree(isopkt);
			kfree(dr);
			free_async(as);
			return -ENOMEM;
		}
	}
	as->urb->dev = ps->dev;
	as->urb->pipe = (uurb->type << 30) |
			__create_pipe(ps->dev, uurb->endpoint & 0xf) |
@@ -1169,7 +1181,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
	kfree(isopkt);
	as->ps = ps;
	as->userurb = arg;
	if (uurb->endpoint & USB_DIR_IN)
	if (is_in && uurb->buffer_length > 0)
		as->userbuffer = uurb->buffer;
	else
		as->userbuffer = NULL;
@@ -1179,9 +1191,9 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
	as->uid = cred->uid;
	as->euid = cred->euid;
	security_task_getsecid(current, &as->secid);
	if (!is_in) {
	if (!is_in && uurb->buffer_length > 0) {
		if (copy_from_user(as->urb->transfer_buffer, uurb->buffer,
				as->urb->transfer_buffer_length)) {
				uurb->buffer_length)) {
			free_async(as);
			return -EFAULT;
		}
@@ -1231,22 +1243,22 @@ static int processcompl(struct async *as, void __user * __user *arg)
	if (as->userbuffer)
		if (copy_to_user(as->userbuffer, urb->transfer_buffer,
				 urb->transfer_buffer_length))
			return -EFAULT;
			goto err_out;
	if (put_user(as->status, &userurb->status))
		return -EFAULT;
		goto err_out;
	if (put_user(urb->actual_length, &userurb->actual_length))
		return -EFAULT;
		goto err_out;
	if (put_user(urb->error_count, &userurb->error_count))
		return -EFAULT;
		goto err_out;

	if (usb_endpoint_xfer_isoc(&urb->ep->desc)) {
		for (i = 0; i < urb->number_of_packets; i++) {
			if (put_user(urb->iso_frame_desc[i].actual_length,
				     &userurb->iso_frame_desc[i].actual_length))
				return -EFAULT;
				goto err_out;
			if (put_user(urb->iso_frame_desc[i].status,
				     &userurb->iso_frame_desc[i].status))
				return -EFAULT;
				goto err_out;
		}
	}

@@ -1255,6 +1267,10 @@ static int processcompl(struct async *as, void __user * __user *arg)
	if (put_user(addr, (void __user * __user *)arg))
		return -EFAULT;
	return 0;

err_out:
	free_async(as);
	return -EFAULT;
}

static struct async *reap_as(struct dev_state *ps)
Loading