]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
hsr: Prevent use after free in prp_create_tagged_frame()
authorDan Carpenter <dan.carpenter@linaro.org>
Fri, 27 Oct 2023 12:19:01 +0000 (15:19 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:57:22 +0000 (11:57 +0100)
commit1787b9f0729d318d67cf7c5a95f0c3dba9a7cc18
tree3bebf337831498ec623c317f97ce03e6d56cab7b
parent0a720d0259ad3521ec6c9e4199f9f6fc75bac77a
hsr: Prevent use after free in prp_create_tagged_frame()

[ Upstream commit 876f8ab52363f649bcc74072157dfd7adfbabc0d ]

The prp_fill_rct() function can fail.  In that situation, it frees the
skb and returns NULL.  Meanwhile on the success path, it returns the
original skb.  So it's straight forward to fix bug by using the returned
value.

Fixes: 451d8123f897 ("net: prp: add packet handling support")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Link: https://lore.kernel.org/r/57af1f28-7f57-4a96-bcd3-b7a0f2340845@moroto.mountain
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/hsr/hsr_forward.c