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

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

usb: gadget: u_bam: Release spinlock in case of skb_copy error



gbam_write_data_tohost() was failing to release port_lock_dl
in case skb_copy_expand() failed. Instead of returning, break
out of the loop so the spinlock can be released. Bug was found
with static analysis checker.

Change-Id: Ia4f00ee2f565b03a90b1073ef630f2780e4207e3
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 153cc9a3
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -413,10 +413,8 @@ static void gbam_write_data_tohost(struct gbam_port *port)

	while (!list_empty(&d->tx_idle)) {
		skb = __skb_dequeue(&d->tx_skb_q);
		if (!skb) {
			spin_unlock_irqrestore(&port->port_lock_dl, flags);
			return;
		}
		if (!skb)
			break;

		/*
		 * Some UDC requires allocation of some extra bytes for
@@ -434,7 +432,7 @@ static void gbam_write_data_tohost(struct gbam_port *port)
					tail_room, GFP_ATOMIC);
			if (!new_skb) {
				pr_err("skb_copy_expand failed\n");
				return;
				break;
			}
			dev_kfree_skb_any(skb);
			skb = new_skb;