[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200422095032.073200981@linuxfoundation.org>
Date: Wed, 22 Apr 2020 11:56:04 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Li RongQing <lirongqing@...du.com>,
Daniel Borkmann <daniel@...earbox.net>,
Jonathan Lemon <jonathan.lemon@...il.com>,
Björn Töpel <bjorn.topel@...el.com>
Subject: [PATCH 5.4 003/118] xsk: Fix out of boundary write in __xsk_rcv_memcpy
From: Li RongQing <lirongqing@...du.com>
commit db5c97f02373917efe2c218ebf8e3d8b19e343b6 upstream.
first_len is the remainder of the first page we're copying.
If this size is larger, then out of page boundary write will
otherwise happen.
Fixes: c05cd3645814 ("xsk: add support to allow unaligned chunk placement")
Signed-off-by: Li RongQing <lirongqing@...du.com>
Signed-off-by: Daniel Borkmann <daniel@...earbox.net>
Acked-by: Jonathan Lemon <jonathan.lemon@...il.com>
Acked-by: Björn Töpel <bjorn.topel@...el.com>
Link: https://lore.kernel.org/bpf/1585813930-19712-1-git-send-email-lirongqing@baidu.com
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
net/xdp/xsk.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/net/xdp/xsk.c
+++ b/net/xdp/xsk.c
@@ -129,8 +129,9 @@ static void __xsk_rcv_memcpy(struct xdp_
u64 page_start = addr & ~(PAGE_SIZE - 1);
u64 first_len = PAGE_SIZE - (addr - page_start);
- memcpy(to_buf, from_buf, first_len + metalen);
- memcpy(next_pg_addr, from_buf + first_len, len - first_len);
+ memcpy(to_buf, from_buf, first_len);
+ memcpy(next_pg_addr, from_buf + first_len,
+ len + metalen - first_len);
return;
}
Powered by blists - more mailing lists