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

Commit c6069233 authored by Jack Pham's avatar Jack Pham
Browse files

usb: gadget: u_bam: Fix incorrect nested spinlock



commit 555513e8 ("usb: gadget: u_bam: Remove support for
BAM-DMUX") removed the additional port_lock_ul/dl spinlocks and
consolidated their usage to the single port_lock wherever possible.
However, gbam_free_rx_buffers() is called with that lock already
held, so remove the extra lock acquisition to fix a recursion bug.

Change-Id: I29aefdb4f80c3b033bda56fbcdcacaa322d2763b
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent fd854d74
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
/* Copyright (c) 2011-2014, Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2015, Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -850,13 +850,10 @@ static int _gbam_start_io(struct gbam_port *port)
static void gbam_free_rx_buffers(struct gbam_port *port)
{
	struct sk_buff		*skb;
	unsigned long		flags;
	struct bam_ch_info	*d;

	spin_lock_irqsave(&port->port_lock, flags);

	if (!port || !port->port_usb)
		goto free_rx_buf_out;
		return;

	d = &port->data_ch;
	gbam_free_requests(port->port_usb->out, &d->rx_idle);
@@ -865,9 +862,6 @@ static void gbam_free_rx_buffers(struct gbam_port *port)
		dev_kfree_skb_any(skb);

	gbam_free_rx_skb_idle_list(port);

free_rx_buf_out:
	spin_unlock_irqrestore(&port->port_lock, flags);
}

static void gbam2bam_disconnect_work(struct work_struct *w)