Commit 0f5d82f
net/filter: Permit reading NET in load_bytes_relative when MAC not set
Added a check in the switch case on start_header that checks for
the existence of the header, and in the case that MAC is not set
and the caller requests for MAC, -EFAULT. If the caller requests
for NET then MAC's existence is completely ignored.
There is no function to check NET header's existence and as far
as cgroup_skb/egress is concerned it should always be set.
Removed for ptr >= the start of header, considering offset is
bounded unsigned and should always be true. len <= end - mac is
redundant to ptr + len <= end.
Fixes: 3eee1f7 ("bpf: fix bpf_skb_load_bytes_relative pkt length check")
Signed-off-by: YiFei Zhu <zhuyifei@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Stanislav Fomichev <sdf@google.com>
Link: https://lore.kernel.org/bpf/76bb820ddb6a95f59a772ecbd8c8a336f646b362.1591812755.git.zhuyifei@google.com1 parent 47f6bc4 commit 0f5d82f
1 file changed
Lines changed: 9 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1755 | 1755 | | |
1756 | 1756 | | |
1757 | 1757 | | |
1758 | | - | |
1759 | | - | |
1760 | | - | |
| 1758 | + | |
1761 | 1759 | | |
1762 | | - | |
| 1760 | + | |
1763 | 1761 | | |
1764 | 1762 | | |
1765 | 1763 | | |
1766 | 1764 | | |
1767 | | - | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
1768 | 1768 | | |
1769 | 1769 | | |
1770 | | - | |
| 1770 | + | |
1771 | 1771 | | |
1772 | 1772 | | |
1773 | 1773 | | |
1774 | 1774 | | |
1775 | 1775 | | |
1776 | | - | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
1777 | 1779 | | |
1778 | 1780 | | |
1779 | 1781 | | |
| |||
0 commit comments