b33975b3060d91274cb90f9c05d3c85520f81ae8
[openwrt/staging/ldir.git] /
1 From 3661172f5786a3d2ebe1d2244f1f08a95e1cfd09 Mon Sep 17 00:00:00 2001
2 From: Henning Schild <henning.schild@siemens.com>
3 Date: Mon, 18 Sep 2017 18:02:11 +0200
4 Subject: [PATCH] ivshmem-net: set and check descriptor flags
5
6 We do not support the use of any flags. Make sure the remote does not
7 confuse us using flags.
8
9 Signed-off-by: Henning Schild <henning.schild@siemens.com>
10 [Jan: Remove wrong removal of next field initialization]
11 Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 (cherry picked from commit 986d58d84245e023a1a66ab6495b354b6b8cd2f0)
13 ---
14 drivers/net/ivshmem-net.c | 5 +++++
15 1 file changed, 5 insertions(+)
16
17 --- a/drivers/net/ivshmem-net.c
18 +++ b/drivers/net/ivshmem-net.c
19 @@ -123,8 +123,12 @@ static void *ivshm_net_desc_data(struct
20 {
21 u64 offs = READ_ONCE(desc->addr);
22 u32 dlen = READ_ONCE(desc->len);
23 + u16 flags = READ_ONCE(desc->flags);
24 void *data;
25
26 + if (flags)
27 + return NULL;
28 +
29 if (offs >= in->shmlen)
30 return NULL;
31
32 @@ -317,6 +321,7 @@ static int ivshm_net_tx_frame(struct net
33
34 desc->addr = buf - in->shm;
35 desc->len = skb->len;
36 + desc->flags = 0;
37
38 avail = tx->last_avail_idx++ & (vr->num - 1);
39 vr->avail->ring[avail] = desc_idx;