kni: fix possible buffer overflow
PATCH 1/1 kni: fix possible buffer overflow
'kni_net_rx_lo_fifo()' can get segmented buffers, using 'pkt_len' for that case will be wrong and some values can cause buffer overflow in destination mbuf data.
--- kernel/linux/kni/kni_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/linux/kni/kni_net.c +1 -1
@@ -435,7 +435,7 @@ kni_net_rx_lo_fifo(struct kni_dev *kni)/* Copy mbufs */ for (i =0 ; i < num; i++) { kva =pa2kva (kni->pa[i]); - len = kva->pkt_len; + len = kva->data_len; data_kva =kva2data_kva (kva); kni->va[i] =pa2va (kni->pa[i], kva);
Signature · 1 line
2.21.0
Quoted 14 lines · On Thu, 11 Jul 2019 13:35:07 +0100 Ferruh Yigit <[email protected]> wrote:
'
kni_net_rx_lo_fifo()' can get segmented buffers, using 'pkt_len' for that case will be wrong and some values can cause buffer overflow in destination mbuf data.Signed-off-by Ferruh Yigit <[email protected]>--- kernel/linux/kni/kni_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/linux/kni/kni_net.c +0
-0
kernel/linux/kni/kni_net.c kni_net_rx_lo_fifo(struct kni_dev *kni) · line 441
Quoted 8 lines
kernel/linux/kni/kni_net.c +1
-1@@ -435,7 +435,7 @@ kni_net_rx_lo_fifo(struct kni_dev *kni)/* Copy mbufs */ for (i =0 ; i < num; i++) { kva =pa2kva (kni->pa[i]); - len = kva->pkt_len; + len = kva->data_len; data_kva =kva2data_kva (kva); kni->va[i] =pa2va (kni->pa[i], kva);
Thomas Monjalon
Applied11/07/2019 17:33, Stephen Hemminger:
Quoted 10 lines
Quoted 5 lines · On Thu, 11 Jul 2019 13:35:07 +0100 Ferruh Yigit <[email protected]> wrote:
'
kni_net_rx_lo_fifo()' can get segmented buffers, using 'pkt_len' for that case will be wrong and some values can cause buffer overflow in destination mbuf data.Signed-off-by Ferruh Yigit <[email protected]>
Applied, thanks
18/07/2019 23:24, Thomas Monjalon:
Quoted 8 lines
11/07/2019 17:33, Stephen Hemminger:
Quoted 7 lines
Quoted 4 lines · On Thu, 11 Jul 2019 13:35:07 +0100 Ferruh Yigit <[email protected]> wrote:
'
kni_net_rx_lo_fifo()' can get segmented buffers, using 'pkt_len' for that case will be wrong and some values can cause buffer overflow in destination mbuf data.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Ferruh Yigit <[email protected]>Applied, thanks
I hope these lines are correct:
Quoted 11 lines · Thomas Monjalon
18/07/2019 23:24, Thomas Monjalon:
Quoted 10 lines
11/07/2019 17:33, Stephen Hemminger:
Quoted 9 lines
Quoted 5 lines · On Thu, 11 Jul 2019 13:35:07 +0100 Ferruh Yigit <[email protected]> wrote:
'
kni_net_rx_lo_fifo()' can get segmented buffers, using 'pkt_len' for that case will be wrong and some values can cause buffer overflow in destination mbuf data.Signed-off-by Ferruh Yigit <[email protected]>
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Applied, thanks
I hope these lines are correct:
Fixes d89a58dfe90b ("kni: support chained mbufs")
Thanks for updating it, even before this commit the related code was wrong I think, but agree that this commit should have fixed it, so agreed with the fixes line.