Skip to content

Commit b7ca845

Browse files
committed
Check args.
1 parent c194a32 commit b7ca845

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

lib/ff_dpdk_if.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,6 +2134,17 @@ int
21342134
ff_dpdk_if_send(struct ff_dpdk_if_context *ctx, void *m,
21352135
int total)
21362136
{
2137+
/* FU-CB-DPDKIF-NULLGUARD: defend against NULL ctx callers. The
2138+
* function dereferences ctx->port_id / ctx->hw_features in both the
2139+
* FF_USE_PAGE_ARRAY and the default mempool paths; a NULL ctx would
2140+
* SIGSEGV. Treat it as a tx-drop and free any caller-supplied mbuf. */
2141+
if (unlikely(ctx == NULL)) {
2142+
ff_traffic.tx_dropped++;
2143+
if (m != NULL) {
2144+
ff_mbuf_free(m);
2145+
}
2146+
return -1;
2147+
}
21372148
#ifdef FF_USE_PAGE_ARRAY
21382149
struct lcore_conf *qconf = &lcore_conf;
21392150
int len = 0;

0 commit comments

Comments
 (0)