1
0
Fork 0

ivshmem-net: set and check descriptor flags

We do not support the use of any flags. Make sure the remote does not
confuse us using flags.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
[Jan: Remove wrong removal of next field initialization]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit 986d58d84245e023a1a66ab6495b354b6b8cd2f0)
5.4-rM2-2.2.x-imx-squashed
Henning Schild 2017-09-18 18:02:11 +02:00 committed by Dong Aisheng
parent 1ef8d65261
commit 1a300871de
1 changed files with 5 additions and 0 deletions

View File

@ -123,8 +123,12 @@ static void *ivshm_net_desc_data(struct ivshm_net *in,
{
u64 offs = READ_ONCE(desc->addr);
u32 dlen = READ_ONCE(desc->len);
u16 flags = READ_ONCE(desc->flags);
void *data;
if (flags)
return NULL;
if (offs >= in->shmlen)
return NULL;
@ -317,6 +321,7 @@ static int ivshm_net_tx_frame(struct net_device *ndev, struct sk_buff *skb)
desc->addr = buf - in->shm;
desc->len = skb->len;
desc->flags = 0;
avail = tx->last_avail_idx++ & (vr->num - 1);
vr->avail->ring[avail] = desc_idx;