Skip to content

Commit 4f2c821

Browse files
author
CKI KWF Bot
committed
Merge: other: stable backport for 10.1 phase 2
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1218 JIRA: https://issues.redhat.com/browse/RHEL-96625 Upstream Status: all mainline in net.git Conflicts: None Tested: boot-tested only Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com> Signed-off-by: Davide Caratti <dcaratti@redhat.com> Approved-by: Antoine Tenart <atenart@redhat.com> Approved-by: Florian Westphal <fwestpha@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents e94c7a4 + e0052b8 commit 4f2c821

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

include/linux/skbuff.h

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2910,9 +2910,19 @@ static inline void skb_reset_inner_headers(struct sk_buff *skb)
29102910
skb->inner_transport_header = skb->transport_header;
29112911
}
29122912

2913+
static inline int skb_mac_header_was_set(const struct sk_buff *skb)
2914+
{
2915+
return skb->mac_header != (typeof(skb->mac_header))~0U;
2916+
}
2917+
29132918
static inline void skb_reset_mac_len(struct sk_buff *skb)
29142919
{
2915-
skb->mac_len = skb->network_header - skb->mac_header;
2920+
if (!skb_mac_header_was_set(skb)) {
2921+
DEBUG_NET_WARN_ON_ONCE(1);
2922+
skb->mac_len = 0;
2923+
} else {
2924+
skb->mac_len = skb->network_header - skb->mac_header;
2925+
}
29162926
}
29172927

29182928
static inline unsigned char *skb_inner_transport_header(const struct sk_buff
@@ -3015,11 +3025,6 @@ static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
30153025
skb->network_header += offset;
30163026
}
30173027

3018-
static inline int skb_mac_header_was_set(const struct sk_buff *skb)
3019-
{
3020-
return skb->mac_header != (typeof(skb->mac_header))~0U;
3021-
}
3022-
30233028
static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
30243029
{
30253030
DEBUG_NET_WARN_ON_ONCE(!skb_mac_header_was_set(skb));
@@ -3044,7 +3049,10 @@ static inline void skb_unset_mac_header(struct sk_buff *skb)
30443049

30453050
static inline void skb_reset_mac_header(struct sk_buff *skb)
30463051
{
3047-
skb->mac_header = skb->data - skb->head;
3052+
long offset = skb->data - skb->head;
3053+
3054+
DEBUG_NET_WARN_ON_ONCE(offset != (typeof(skb->mac_header))offset);
3055+
skb->mac_header = offset;
30483056
}
30493057

30503058
static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)

net/8021q/vlan.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ int vlan_check_real_dev(struct net_device *real_dev,
131131
{
132132
const char *name = real_dev->name;
133133

134-
if (real_dev->features & NETIF_F_VLAN_CHALLENGED) {
134+
if (real_dev->features & NETIF_F_VLAN_CHALLENGED ||
135+
real_dev->type != ARPHRD_ETHER) {
135136
pr_info("VLANs not supported on %s\n", name);
136137
NL_SET_ERR_MSG_MOD(extack, "VLANs not supported on device");
137138
return -EOPNOTSUPP;

0 commit comments

Comments
 (0)