mirror of https://gitee.com/openkylin/linux.git
net: usbnet: fix SG initialisation
Commit60e453a940
("USBNET: fix handling padding packet") added an extra SG entry in case padding is necessary, but failed to update the initialisation of the list. This can cause list traversal to fall off the end of the list, resulting in an oops. Fixes:60e453a940
("USBNET: fix handling padding packet") Reported-by: Thomas Kear <thomas@kear.co.nz> Cc: Ming Lei <ming.lei@canonical.com> Signed-off-by: Bjørn Mork <bjorn@mork.no> Tested-by: Ming Lei <ming.lei@canonical.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
70315d22d3
commit
fdc3452cd2
|
@ -1245,7 +1245,7 @@ static int build_dma_sg(const struct sk_buff *skb, struct urb *urb)
|
|||
return -ENOMEM;
|
||||
|
||||
urb->num_sgs = num_sgs;
|
||||
sg_init_table(urb->sg, urb->num_sgs);
|
||||
sg_init_table(urb->sg, urb->num_sgs + 1);
|
||||
|
||||
sg_set_buf(&urb->sg[s++], skb->data, skb_headlen(skb));
|
||||
total_len += skb_headlen(skb);
|
||||
|
|
Loading…
Reference in New Issue