]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
xfrm_user: fix info leak in build_report()
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Apr 2026 15:34:22 +0000 (17:34 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Apr 2026 08:35:55 +0000 (10:35 +0200)
commit d10119968d0e1f2b669604baf2a8b5fdb72fa6b4 upstream.

struct xfrm_user_report is a __u8 proto field followed by a struct
xfrm_selector which means there is three "empty" bytes of padding, but
the padding is never zeroed before copying to userspace.  Fix that up by
zeroing the structure before setting individual member variables.

Cc: stable <stable@kernel.org>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>
Assisted-by: gregkh_clanker_t1000
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/xfrm/xfrm_user.c

index e4f9b98a46d9c99f543543676e81178dba9bb116..d70640a0f27ffdbaf949c5b07227a5055dba17c5 100644 (file)
@@ -3679,6 +3679,7 @@ static int build_report(struct sk_buff *skb, u8 proto,
                return -EMSGSIZE;
 
        ur = nlmsg_data(nlh);
+       memset(ur, 0, sizeof(*ur));
        ur->proto = proto;
        memcpy(&ur->sel, sel, sizeof(ur->sel));