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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 22 Jul 2021 14:12:28 +1000
From:   Stephen Rothwell <sfr@...b.auug.org.au>
To:     Greg KH <greg@...ah.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux Next Mailing List <linux-next@...r.kernel.org>,
        Linyu Yuan <linyyuan@...eaurora.org>,
        Wesley Cheng <wcheng@...eaurora.org>
Subject: linux-next: manual merge of the usb tree with the usb.current tree

Hi all,

Today's linux-next merge of the usb tree got a conflict in:

  drivers/usb/dwc3/gadget.c

between commit:

  40edb52298df ("usb: dwc3: avoid NULL access of usb_gadget_driver")

from the usb.current tree and commit:

  9f607a309fbe ("usb: dwc3: Resize TX FIFOs to meet EP bursting requirements")

from the usb tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/usb/dwc3/gadget.c
index 45f2bc0807e8,e56f1a6db2de..000000000000
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@@ -2585,16 -2771,51 +2771,61 @@@ static int dwc3_gadget_vbus_draw(struc
  	return ret;
  }
  
 +static void dwc3_gadget_async_callbacks(struct usb_gadget *g, bool enable)
 +{
 +	struct dwc3		*dwc = gadget_to_dwc(g);
 +	unsigned long		flags;
 +
 +	spin_lock_irqsave(&dwc->lock, flags);
 +	dwc->async_callbacks = enable;
 +	spin_unlock_irqrestore(&dwc->lock, flags);
 +}
 +
+ /**
+  * dwc3_gadget_check_config - ensure dwc3 can support the USB configuration
+  * @g: pointer to the USB gadget
+  *
+  * Used to record the maximum number of endpoints being used in a USB composite
+  * device. (across all configurations)  This is to be used in the calculation
+  * of the TXFIFO sizes when resizing internal memory for individual endpoints.
+  * It will help ensured that the resizing logic reserves enough space for at
+  * least one max packet.
+  */
+ static int dwc3_gadget_check_config(struct usb_gadget *g)
+ {
+ 	struct dwc3 *dwc = gadget_to_dwc(g);
+ 	struct usb_ep *ep;
+ 	int fifo_size = 0;
+ 	int ram1_depth;
+ 	int ep_num = 0;
+ 
+ 	if (!dwc->do_fifo_resize)
+ 		return 0;
+ 
+ 	list_for_each_entry(ep, &g->ep_list, ep_list) {
+ 		/* Only interested in the IN endpoints */
+ 		if (ep->claimed && (ep->address & USB_DIR_IN))
+ 			ep_num++;
+ 	}
+ 
+ 	if (ep_num <= dwc->max_cfg_eps)
+ 		return 0;
+ 
+ 	/* Update the max number of eps in the composition */
+ 	dwc->max_cfg_eps = ep_num;
+ 
+ 	fifo_size = dwc3_gadget_calc_tx_fifo_size(dwc, dwc->max_cfg_eps);
+ 	/* Based on the equation, increment by one for every ep */
+ 	fifo_size += dwc->max_cfg_eps;
+ 
+ 	/* Check if we can fit a single fifo per endpoint */
+ 	ram1_depth = DWC3_RAM1_DEPTH(dwc->hwparams.hwparams7);
+ 	if (fifo_size > ram1_depth)
+ 		return -ENOMEM;
+ 
+ 	return 0;
+ }
+ 
  static const struct usb_gadget_ops dwc3_gadget_ops = {
  	.get_frame		= dwc3_gadget_get_frame,
  	.wakeup			= dwc3_gadget_wakeup,
@@@ -2606,7 -2827,7 +2837,8 @@@
  	.udc_set_ssp_rate	= dwc3_gadget_set_ssp_rate,
  	.get_config_params	= dwc3_gadget_config_params,
  	.vbus_draw		= dwc3_gadget_vbus_draw,
 +	.udc_async_callbacks	= dwc3_gadget_async_callbacks,
+ 	.check_config		= dwc3_gadget_check_config,
  };
  
  /* -------------------------------------------------------------------------- */

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists