lkml.org 
[lkml]   [2024]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [syzbot] [PATCH] net: Fix kernel-infoleak in __skb_datagram_iter (2)
From
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [PATCH] net: Fix kernel-infoleak in __skb_datagram_iter (2)
Author: ryasuoka@redhat.com

#syz test

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 27998f73183e..c7bf1c38b292 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2532,6 +2532,11 @@ static inline unsigned char
*skb_tail_pointer(const struct sk_buff *skb)
return skb->head + skb->tail;
}

+static inline unsigned int skb_tail_offset(const struct sk_buff *skb)
+{
+ return skb->tail;
+}
+
static inline void skb_reset_tail_pointer(struct sk_buff *skb)
{
skb->tail = skb->data - skb->head;
@@ -2549,6 +2554,11 @@ static inline unsigned char
*skb_tail_pointer(const struct sk_buff *skb)
return skb->tail;
}

+static inline unsigned int skb_tail_offset(const struct sk_buff *skb)
+{
+ return skb->tail - skb->head;
+}
+
static inline void skb_reset_tail_pointer(struct sk_buff *skb)
{
skb->tail = skb->data;
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index eb086b06d60d..f11bb308f1ed 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -167,7 +167,7 @@ static inline u32 netlink_group_mask(u32 group)
static struct sk_buff *netlink_to_full_skb(const struct sk_buff *skb,
gfp_t gfp_mask)
{
- unsigned int len = skb_end_offset(skb);
+ unsigned int len = skb_tail_offset(skb);
struct sk_buff *new;

new = alloc_skb(len, gfp_mask);

\
 
 \ /
  Last update: 2024-05-27 15:04    [W:0.267 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site