]> git.baikalelectronics.ru Git - kernel.git/commit
virtio-net: get build_skb() buf by data ptr
authorXuan Zhuo <xuanzhuo@linux.alibaba.com>
Thu, 13 May 2021 11:48:08 +0000 (19:48 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 13 May 2021 22:51:14 +0000 (15:51 -0700)
commitd9b2caafda2c1a328f898382533c3103ec5a2ac8
treeddf5446f1fc95b4219761f87deef5a6278b44917
parent3fc5c0caa67a7b9e77aa5e9ff005ca4350d24e82
virtio-net: get build_skb() buf by data ptr

In the case of merge, the page passed into page_to_skb() may be a head
page, not the page where the current data is located. So when trying to
get the buf where the data is located, you should directly use the
pointer(p) to get the address corresponding to the page.

At the same time, the offset of the data in the page should also be
obtained using offset_in_page().

This patch solves this problem. But if you don’t use this patch, the
original code can also run, because if the page is not the page of the
current data, the calculated tailroom will be less than 0, and will not
enter the logic of build_skb() . The significance of this patch is to
modify this logical problem, allowing more situations to use
build_skb().

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/virtio_net.c