Patch "netfilter: nfnetlink_queue: fix secctx memory leak" has been added to the 4.9-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
netfilter: nfnetlink_queue: fix secctx memory leak
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
netfilter-nfnetlink_queue-fix-secctx-memory-leak.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Thu Dec 21 09:02:40 CET 2017
From: Liping Zhang <[email protected]>
Date: Tue, 28 Mar 2017 22:59:25 +0800
Subject: netfilter: nfnetlink_queue: fix secctx memory leak
From: Liping Zhang <[email protected]>
[ Upstream commit 77c1c03c5b8ef28e55bb0aff29b1e006037ca645 ]
We must call security_release_secctx to free the memory returned by security_secid_to_secctx, otherwise memory may be leaked forever.
--- net/netfilter/nfnetlink_queue.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
net/netfilter/nfnetlink_queue.c +7 -2
@@ -443,7 +443,7 @@ nfqnl_build_packet_message(struct net *n skb =alloc_skb (size,GFP_ATOMIC );if (!skb) {skb_tx_error (entskb); -return NULL ; + goto nlmsg_failure; } nlh = nlmsg_put(skb, 0, 0,
@@ -452,7 +452,7 @@ nfqnl_build_packet_message(struct net *nif (!nlh) {skb_tx_error (entskb);kfree_skb (skb); -return NULL ; + goto nlmsg_failure; } nfmsg =nlmsg_data (nlh); nfmsg->nfgen_family = entry->state.pf;
@@ -598,12 +598,17 @@ nfqnl_build_packet_message(struct net *n } nlh->nlmsg_len = skb->len; +if (seclen) +security_release_secctx (secdata, seclen);return skb; nla_put_failure:skb_tx_error (entskb);kfree_skb (skb);net_err_ratelimited ("nf_queue: error creating packet message\n" ); +nlmsg_failure: +if (seclen) +security_release_secctx (secdata, seclen);return NULL ; }
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/netfilter-nfnetlink_queue-fix-secctx-memory-leak.patch queue-4.9/netfilter-nfnl_cthelper-fix-runtime-expectation-policy-updates.patch queue-4.9/netfilter-nfnl_cthelper-fix-a-race-when-walk-the-nf_ct_helper_hash-table.patch