Re: [PATCH v2] xhci: fix list access before ini

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Looks fine, except for the "ini" in the subject, which I've corrected to
"init".

This is now applied to my for-usb-linus-queue branch, thanks!  You can
see your patch here:

http://git.kernel.org/cgit/linux/kernel/git/sarah/xhci.git/commit/?h=for-usb-linus-queue&id=b3a559901d23b9c391699c23f0d37f205baedb88

It probably won't make it into Linus' tree until a couple weeks from
now when 3.10-rc2 comes out, since the merge window is coming up and
everyone's trees are frozen.

Sarah Sharp

On Tue, Apr 09, 2013 at 10:33:31PM +0400, Vladimir Murzin wrote:
> If for whatever reason we fall into fail path in xhci_mem_init()
> before bw table gets initialized we may access the uninitialized lists
> in xhci_mem_cleanup().
> 
> Check for bw table before traversing lists in cleanup routine.
> 
> Reported-by: Sergey Dyasly <dserrg@xxxxxxxxx>
> Tested-by: Sergey Dyasly <dserrg@xxxxxxxxx>
> Signed-off-by: Vladimir Murzin <murzin.v@xxxxxxxxx>
> ---
> 
> This patch is generated across
> http://git.kernel.org/cgit/linux/kernel/git/sarah/xhci.git/log/?h=for-usb-linus-queue
> 
> Changes since:
> 	v1 - init for cancel_cmd_list and lpm_failed lists
> 	is skipped because Sergio has already been working on
> 	it http://marc.info/?l=linux-usb&m=136509667003716&w=2
> 	- bw table is checked for existence in xhci_mem_cleanup()
> 	 routine instead of moving bw init code at beginning of
> 	 xhci_mem_init() routine (as it was proposed by Sharah}
> 
>  drivers/usb/host/xhci-mem.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
> index ffbdefc..ea44dc9 100644
> --- a/drivers/usb/host/xhci-mem.c
> +++ b/drivers/usb/host/xhci-mem.c
> @@ -1826,6 +1826,9 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
>  	}
>  	spin_unlock_irqrestore(&xhci->lock, flags);
>  
> +	if (!xhci->rh_bw)
> +		goto no_bw;
> +
>  	num_ports = HCS_MAX_PORTS(xhci->hcs_params1);
>  	for (i = 0; i < num_ports; i++) {
>  		struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table;
> @@ -1844,6 +1847,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
>  		}
>  	}
>  
> +no_bw:
>  	xhci->num_usb2_ports = 0;
>  	xhci->num_usb3_ports = 0;
>  	xhci->num_active_eps = 0;
> -- 
> 1.7.10.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux