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] [day] [month] [year] [list]
Date:   Tue, 22 Jun 2021 14:32:36 +0300
From:   Mathias Nyman <mathias.nyman@...ux.intel.com>
To:     Lee Jones <lee.jones@...aro.org>
Cc:     Sergei Shtylyov <sergei.shtylyov@...il.com>,
        linux-kernel@...r.kernel.org,
        Mathias Nyman <mathias.nyman@...el.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-usb@...r.kernel.org
Subject: Re: [PATCH 21/24] usb: host: xhci: Move array of structs from the
 stack onto the heap

On 22.6.2021 13.47, Lee Jones wrote:
> On Tue, 01 Jun 2021, Lee Jones wrote:
> 
>> On Thu, 27 May 2021, Mathias Nyman wrote:
>>
>>> On 26.5.2021 18.28, Lee Jones wrote:
>>>> On Wed, 26 May 2021, Sergei Shtylyov wrote:
>>>>
>>>>> On 5/26/21 5:44 PM, Lee Jones wrote:
>>>>>
>>>>> [...]
>>>>>>>> Fixes the following W=1 kernel build warning(s):
>>>>>>>>
>>>>>>>>  drivers/usb/host/xhci.c: In function ‘xhci_reserve_bandwidth’:
>>>>>>>>  drivers/usb/host/xhci.c:2859:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>>>>>>>>
>>>>>>>> Cc: Mathias Nyman <mathias.nyman@...el.com>
>>>>>>>> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
>>>>>>>> Cc: linux-usb@...r.kernel.org
>>>>>>>> Signed-off-by: Lee Jones <lee.jones@...aro.org>
>>>>>>>> ---
>>>>>>>>  drivers/usb/host/xhci.c | 8 +++++++-
>>>>>>>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>>>>>>>
>>>>>>>> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
>>>>>>>> index ac2a7d4288883..40ce4b4eb12ad 100644
>>>>>>>> --- a/drivers/usb/host/xhci.c
>>>>>>>> +++ b/drivers/usb/host/xhci.c
>>>>>>> [...]
>>>>>>>> @@ -2788,6 +2788,10 @@ static int xhci_reserve_bandwidth(struct xhci_hcd *xhci,
>>>>>>>>  		return -ENOMEM;
>>>>>>>>  	}
>>>>>>>>  
>>>>>>>> +	ep_bw_info = kzalloc(sizeof(*ep_bw_info) * 31, GFP_KERNEL);
>>>
>>> GFP_KERNEL might not be suitable for all cases.
>>>
>>> xhci_reserve_bandwidth() is called from xhci_configure_endpoint(), which again
>>> is called from a lot of places.
>>> For example from xhci_update_hub_device() which can be called with GFP_NOIO mem_flags.
>>
>> What do you suggest as an alternative?
> 
> Just working on rectifying this now.
> 
> Which Get Free Page flag do you suggest here please?
> 

xhci_reserve_bandwidth() is called with spin lock held, so probably GFP_ATOMIC

But that whole function would need more attention.
It's always consuming  31 * sizeof(*ep_bw_info) bytes to store fallback values.
Normal use case is that just one, or a couple endpoints are changing, and we know which ones do.

-Mathias


just one enpoint changing. 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ