Skip to content

Commit 9474580

Browse files
tohojokvalo
authored andcommitted
wifi: ath9k_htc: Use __skb_set_length() for resetting urb before resubmit
Syzbot points out that skb_trim() has a sanity check on the existing length of the skb, which can be uninitialised in some error paths. The intent here is clearly just to reset the length to zero before resubmitting, so switch to calling __skb_set_length(skb, 0) directly. In addition, __skb_set_length() already contains a call to skb_reset_tail_pointer(), so remove the redundant call. The syzbot report came from ath9k_hif_usb_reg_in_cb(), but there's a similar usage of skb_trim() in ath9k_hif_usb_rx_cb(), change both while we're at it. Reported-by: [email protected] Signed-off-by: Toke Høiland-Jørgensen <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 6274df2 commit 9474580

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/net/wireless/ath/ath9k/hif_usb.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -716,8 +716,7 @@ static void ath9k_hif_usb_rx_cb(struct urb *urb)
716716
}
717717

718718
resubmit:
719-
skb_reset_tail_pointer(skb);
720-
skb_trim(skb, 0);
719+
__skb_set_length(skb, 0);
721720

722721
usb_anchor_urb(urb, &hif_dev->rx_submitted);
723722
ret = usb_submit_urb(urb, GFP_ATOMIC);
@@ -754,8 +753,7 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
754753
case -ESHUTDOWN:
755754
goto free_skb;
756755
default:
757-
skb_reset_tail_pointer(skb);
758-
skb_trim(skb, 0);
756+
__skb_set_length(skb, 0);
759757

760758
goto resubmit;
761759
}

0 commit comments

Comments
 (0)