diff options
author | Sergey Nazarov <s-nazarov@yandex.ru> | 2021-03-05 11:05:54 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-03-05 13:00:38 -0800 |
commit | e233febda6ebab750e30662a7cc9b9efad127685 (patch) | |
tree | 41e2255035768e8841c14c0dae428409e643f994 /net | |
parent | 8eb37ab7cc045ec6305a6a1a9c32374695a1a977 (diff) | |
download | linux-e233febda6ebab750e30662a7cc9b9efad127685.tar.bz2 |
CIPSO: Fix unaligned memory access in cipso_v4_gentag_hdr
We need to use put_unaligned when writing 32-bit DOI value
in cipso_v4_gentag_hdr to avoid unaligned memory access.
v2: unneeded type cast removed as Ondrej Mosnacek suggested.
Signed-off-by: Sergey Nazarov <s-nazarov@yandex.ru>
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/cipso_ipv4.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c index be09c7669a79..bfaf327e9d12 100644 --- a/net/ipv4/cipso_ipv4.c +++ b/net/ipv4/cipso_ipv4.c @@ -1153,7 +1153,7 @@ static void cipso_v4_gentag_hdr(const struct cipso_v4_doi *doi_def, { buf[0] = IPOPT_CIPSO; buf[1] = CIPSO_V4_HDR_LEN + len; - *(__be32 *)&buf[2] = htonl(doi_def->doi); + put_unaligned_be32(doi_def->doi, &buf[2]); } /** |