From: Stephen Hemminger <stephen@networkplumber.org>
To: Michal Kubecek <mkubecek@suse.cz>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH iproute2] ip xfrm: use correct key length for netlink message
Date: Sun, 1 Oct 2017 13:48:52 -0700 [thread overview]
Message-ID: <20171001134852.5aadf10b@xeon-e3> (raw)
In-Reply-To: <20170929114105.2D971A0F6B@unicorn.suse.cz>
On Fri, 29 Sep 2017 13:41:05 +0200 (CEST)
Michal Kubecek <mkubecek@suse.cz> wrote:
> When SA is added manually using "ip xfrm state add", xfrm_state_modify()
> uses alg_key_len field of struct xfrm_algo for the length of key passed to
> kernel in the netlink message. However alg_key_len is bit length of the key
> while we need byte length here. This is usually harmless as kernel ignores
> the excess data but when the bit length of the key exceeds 512
> (XFRM_ALGO_KEY_BUF_SIZE), it can result in buffer overflow.
>
> We can simply divide by 8 here as the only place setting alg_key_len is in
> xfrm_algo_parse() where it is always set to a multiple of 8 (and there are
> already multiple places using "algo->alg_key_len / 8").
>
> Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
This looks correct applied.
prev parent reply other threads:[~2017-10-01 20:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-29 11:41 [PATCH iproute2] ip xfrm: use correct key length for netlink message Michal Kubecek
2017-10-01 20:48 ` Stephen Hemminger [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171001134852.5aadf10b@xeon-e3 \
--to=stephen@networkplumber.org \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).