提交 d93acbca 编写于 作者: G Greg Kroah-Hartman

Merge tag 'fixes-for-v3.9-rc4' of...

Merge tag 'fixes-for-v3.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus

Felipe writes:

	usb: fixes for v3.9-rc4

	udc-core learned that it shouldn't use invalid pointers
	when unloading a gadget driver.

	net2272 and net2280 got a fix for a regression caused by
	the udc_start/udc_stop conversion.

	We're defining a static inline no-op for otg_ulpi_create()
	to prevent build errors when that driver isn't enabled.

	FunctionFS got a fix for an off-by-one error when binding
	and unbinding instances of FunctionFS.

	MUSB learned that it shouldn't try to unmap buffers which
	weren't previously mapped.

	f_rndis got a fix for a possible NULL pointer dereference
	in a debugging message code.

	MUSB's DA8xx glue layer got a build fix due to a typo.
...@@ -447,14 +447,13 @@ static void rndis_response_complete(struct usb_ep *ep, struct usb_request *req) ...@@ -447,14 +447,13 @@ static void rndis_response_complete(struct usb_ep *ep, struct usb_request *req)
static void rndis_command_complete(struct usb_ep *ep, struct usb_request *req) static void rndis_command_complete(struct usb_ep *ep, struct usb_request *req)
{ {
struct f_rndis *rndis = req->context; struct f_rndis *rndis = req->context;
struct usb_composite_dev *cdev = rndis->port.func.config->cdev;
int status; int status;
/* received RNDIS command from USB_CDC_SEND_ENCAPSULATED_COMMAND */ /* received RNDIS command from USB_CDC_SEND_ENCAPSULATED_COMMAND */
// spin_lock(&dev->lock); // spin_lock(&dev->lock);
status = rndis_msg_parser(rndis->config, (u8 *) req->buf); status = rndis_msg_parser(rndis->config, (u8 *) req->buf);
if (status < 0) if (status < 0)
ERROR(cdev, "RNDIS command error %d, %d/%d\n", pr_err("RNDIS command error %d, %d/%d\n",
status, req->actual, req->length); status, req->actual, req->length);
// spin_unlock(&dev->lock); // spin_unlock(&dev->lock);
} }
......
...@@ -357,7 +357,7 @@ static int gfs_bind(struct usb_composite_dev *cdev) ...@@ -357,7 +357,7 @@ static int gfs_bind(struct usb_composite_dev *cdev)
goto error; goto error;
gfs_dev_desc.iProduct = gfs_strings[USB_GADGET_PRODUCT_IDX].id; gfs_dev_desc.iProduct = gfs_strings[USB_GADGET_PRODUCT_IDX].id;
for (i = func_num; --i; ) { for (i = func_num; i--; ) {
ret = functionfs_bind(ffs_tab[i].ffs_data, cdev); ret = functionfs_bind(ffs_tab[i].ffs_data, cdev);
if (unlikely(ret < 0)) { if (unlikely(ret < 0)) {
while (++i < func_num) while (++i < func_num)
...@@ -413,7 +413,7 @@ static int gfs_unbind(struct usb_composite_dev *cdev) ...@@ -413,7 +413,7 @@ static int gfs_unbind(struct usb_composite_dev *cdev)
gether_cleanup(); gether_cleanup();
gfs_ether_setup = false; gfs_ether_setup = false;
for (i = func_num; --i; ) for (i = func_num; i--; )
if (ffs_tab[i].ffs_data) if (ffs_tab[i].ffs_data)
functionfs_unbind(ffs_tab[i].ffs_data); functionfs_unbind(ffs_tab[i].ffs_data);
......
...@@ -59,7 +59,7 @@ static const char * const ep_name[] = { ...@@ -59,7 +59,7 @@ static const char * const ep_name[] = {
}; };
#define DMA_ADDR_INVALID (~(dma_addr_t)0) #define DMA_ADDR_INVALID (~(dma_addr_t)0)
#ifdef CONFIG_USB_GADGET_NET2272_DMA #ifdef CONFIG_USB_NET2272_DMA
/* /*
* use_dma: the NET2272 can use an external DMA controller. * use_dma: the NET2272 can use an external DMA controller.
* Note that since there is no generic DMA api, some functions, * Note that since there is no generic DMA api, some functions,
...@@ -1495,6 +1495,13 @@ stop_activity(struct net2272 *dev, struct usb_gadget_driver *driver) ...@@ -1495,6 +1495,13 @@ stop_activity(struct net2272 *dev, struct usb_gadget_driver *driver)
for (i = 0; i < 4; ++i) for (i = 0; i < 4; ++i)
net2272_dequeue_all(&dev->ep[i]); net2272_dequeue_all(&dev->ep[i]);
/* report disconnect; the driver is already quiesced */
if (driver) {
spin_unlock(&dev->lock);
driver->disconnect(&dev->gadget);
spin_lock(&dev->lock);
}
net2272_usb_reinit(dev); net2272_usb_reinit(dev);
} }
......
...@@ -1924,7 +1924,6 @@ static int net2280_start(struct usb_gadget *_gadget, ...@@ -1924,7 +1924,6 @@ static int net2280_start(struct usb_gadget *_gadget,
err_func: err_func:
device_remove_file (&dev->pdev->dev, &dev_attr_function); device_remove_file (&dev->pdev->dev, &dev_attr_function);
err_unbind: err_unbind:
driver->unbind (&dev->gadget);
dev->gadget.dev.driver = NULL; dev->gadget.dev.driver = NULL;
dev->driver = NULL; dev->driver = NULL;
return retval; return retval;
...@@ -1946,6 +1945,13 @@ stop_activity (struct net2280 *dev, struct usb_gadget_driver *driver) ...@@ -1946,6 +1945,13 @@ stop_activity (struct net2280 *dev, struct usb_gadget_driver *driver)
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
nuke (&dev->ep [i]); nuke (&dev->ep [i]);
/* report disconnect; the driver is already quiesced */
if (driver) {
spin_unlock(&dev->lock);
driver->disconnect(&dev->gadget);
spin_lock(&dev->lock);
}
usb_reinit (dev); usb_reinit (dev);
} }
......
...@@ -136,7 +136,7 @@ static struct portmaster { ...@@ -136,7 +136,7 @@ static struct portmaster {
pr_debug(fmt, ##arg) pr_debug(fmt, ##arg)
#endif /* pr_vdebug */ #endif /* pr_vdebug */
#else #else
#ifndef pr_vdebig #ifndef pr_vdebug
#define pr_vdebug(fmt, arg...) \ #define pr_vdebug(fmt, arg...) \
({ if (0) pr_debug(fmt, ##arg); }) ({ if (0) pr_debug(fmt, ##arg); })
#endif /* pr_vdebug */ #endif /* pr_vdebug */
......
...@@ -216,7 +216,7 @@ static void usb_gadget_remove_driver(struct usb_udc *udc) ...@@ -216,7 +216,7 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
usb_gadget_disconnect(udc->gadget); usb_gadget_disconnect(udc->gadget);
udc->driver->disconnect(udc->gadget); udc->driver->disconnect(udc->gadget);
udc->driver->unbind(udc->gadget); udc->driver->unbind(udc->gadget);
usb_gadget_udc_stop(udc->gadget, udc->driver); usb_gadget_udc_stop(udc->gadget, NULL);
udc->driver = NULL; udc->driver = NULL;
udc->dev.driver = NULL; udc->dev.driver = NULL;
......
...@@ -327,7 +327,7 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci) ...@@ -327,7 +327,7 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci)
u8 devctl = musb_readb(mregs, MUSB_DEVCTL); u8 devctl = musb_readb(mregs, MUSB_DEVCTL);
int err; int err;
err = musb->int_usb & USB_INTR_VBUSERROR; err = musb->int_usb & MUSB_INTR_VBUSERROR;
if (err) { if (err) {
/* /*
* The Mentor core doesn't debounce VBUS as needed * The Mentor core doesn't debounce VBUS as needed
......
...@@ -141,7 +141,9 @@ static inline void map_dma_buffer(struct musb_request *request, ...@@ -141,7 +141,9 @@ static inline void map_dma_buffer(struct musb_request *request,
static inline void unmap_dma_buffer(struct musb_request *request, static inline void unmap_dma_buffer(struct musb_request *request,
struct musb *musb) struct musb *musb)
{ {
if (!is_buffer_mapped(request)) struct musb_ep *musb_ep = request->ep;
if (!is_buffer_mapped(request) || !musb_ep->dma)
return; return;
if (request->request.dma == DMA_ADDR_INVALID) { if (request->request.dma == DMA_ADDR_INVALID) {
...@@ -195,7 +197,10 @@ __acquires(ep->musb->lock) ...@@ -195,7 +197,10 @@ __acquires(ep->musb->lock)
ep->busy = 1; ep->busy = 1;
spin_unlock(&musb->lock); spin_unlock(&musb->lock);
if (!dma_mapping_error(&musb->g.dev, request->dma))
unmap_dma_buffer(req, musb); unmap_dma_buffer(req, musb);
if (request->status == 0) if (request->status == 0)
dev_dbg(musb->controller, "%s done request %p, %d/%d\n", dev_dbg(musb->controller, "%s done request %p, %d/%d\n",
ep->end_point.name, request, ep->end_point.name, request,
......
...@@ -181,8 +181,16 @@ ...@@ -181,8 +181,16 @@
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
#if IS_ENABLED(CONFIG_USB_ULPI)
struct usb_phy *otg_ulpi_create(struct usb_phy_io_ops *ops, struct usb_phy *otg_ulpi_create(struct usb_phy_io_ops *ops,
unsigned int flags); unsigned int flags);
#else
static inline struct usb_phy *otg_ulpi_create(struct usb_phy_io_ops *ops,
unsigned int flags)
{
return NULL;
}
#endif
#ifdef CONFIG_USB_ULPI_VIEWPORT #ifdef CONFIG_USB_ULPI_VIEWPORT
/* access ops for controllers with a viewport register */ /* access ops for controllers with a viewport register */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册