Skip to content

Commit 778b09d

Browse files
WhiteFox-Projectummakynes
authored andcommitted
netfilter: nfnetlink_queue: Initialize ctx to avoid memory allocation error
It is possible that ctx in nfqnl_build_packet_message() could be used before it is properly initialize, which is only initialized by nfqnl_get_sk_secctx(). This patch corrects this problem by initializing the lsmctx to a safe value when it is declared. This is similar to the commit 35fcac7 ("audit: Initialize lsmctx to avoid memory allocation error"). Fixes: 2d470c7 ("lsm: replace context+len with lsm_context") Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent eaaff9b commit 778b09d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/netfilter/nfnetlink_queue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
567567
enum ip_conntrack_info ctinfo = 0;
568568
const struct nfnl_ct_hook *nfnl_ct;
569569
bool csum_verify;
570-
struct lsm_context ctx;
570+
struct lsm_context ctx = { NULL, 0, 0 };
571571
int seclen = 0;
572572
ktime_t tstamp;
573573

0 commit comments

Comments
 (0)