Skip to content

Commit 92ec089

Browse files
MilanDadokgregkh
authored andcommitted
Staging: hv: fix oops in vmbus - netvsc list_head
Remove incorrect list_head usage. Variable of type list_head was used in some function's arguments as list item. Signed-off-by: Milan Dadok <milan@dadok.name> Cc: Hank Janssen <hjanssen@microsoft.com> Cc: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 9fb5cce commit 92ec089

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

‎drivers/staging/hv/NetVsc.c‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ static void NetVscOnReceive(struct hv_device *Device,
10521052
*/
10531053
spin_lock_irqsave(&netDevice->receive_packet_list_lock, flags);
10541054
while (!list_empty(&netDevice->ReceivePacketList)) {
1055-
list_move_tail(&netDevice->ReceivePacketList, &listHead);
1055+
list_move_tail(netDevice->ReceivePacketList.next, &listHead);
10561056
if (++count == vmxferpagePacket->RangeCount + 1)
10571057
break;
10581058
}
@@ -1071,7 +1071,7 @@ static void NetVscOnReceive(struct hv_device *Device,
10711071
/* Return it to the freelist */
10721072
spin_lock_irqsave(&netDevice->receive_packet_list_lock, flags);
10731073
for (i = count; i != 0; i--) {
1074-
list_move_tail(&listHead,
1074+
list_move_tail(listHead.next,
10751075
&netDevice->ReceivePacketList);
10761076
}
10771077
spin_unlock_irqrestore(&netDevice->receive_packet_list_lock,
@@ -1085,8 +1085,7 @@ static void NetVscOnReceive(struct hv_device *Device,
10851085
}
10861086

10871087
/* Remove the 1st packet to represent the xfer page packet itself */
1088-
xferpagePacket = list_entry(&listHead, struct xferpage_packet,
1089-
ListEntry);
1088+
xferpagePacket = (struct xferpage_packet*)listHead.next;
10901089
list_del(&xferpagePacket->ListEntry);
10911090

10921091
/* This is how much we can satisfy */
@@ -1102,8 +1101,7 @@ static void NetVscOnReceive(struct hv_device *Device,
11021101

11031102
/* Each range represents 1 RNDIS pkt that contains 1 ethernet frame */
11041103
for (i = 0; i < (count - 1); i++) {
1105-
netvscPacket = list_entry(&listHead, struct hv_netvsc_packet,
1106-
ListEntry);
1104+
netvscPacket = (struct hv_netvsc_packet*)listHead.next;
11071105
list_del(&netvscPacket->ListEntry);
11081106

11091107
/* Initialize the netvsc packet */

0 commit comments

Comments
 (0)