The auto-ASCONF address work queue invokes sctp_primitive_ASCONF() from its
timer while holding the address work queue and socket spinlocks. The
generated primitive wrapper passes GFP_KERNEL to sctp_do_sm(), so transmit
allocation can enter reclaim from softirq context:
BUG: sleeping function called from invalid context at
include/linux/sched/mm.h:322
Call Trace:
<IRQ>
__alloc_skb (net/core/skbuff.c:705)
sctp_packet_transmit (net/sctp/output.c:604)
sctp_outq_flush (net/sctp/outqueue.c:1177 net/sctp/outqueue.c:1225)
sctp_do_sm (net/sctp/sm_sideeffect.c:1826 net/sctp/sm_sideeffect.c:1211)
sctp_primitive_ASCONF (net/sctp/primitive.c:198)
sctp_send_asconf_add_ip (net/sctp/socket.c:695)
sctp_addr_wq_timeout_handler (net/sctp/protocol.c:648)
Use GFP_ATOMIC for the ASCONF primitive. Keep GFP_KERNEL for the other
primitive wrappers, which are not called by this timer path.
Fixes: 9f7d653b67ae ("sctp: Add Auto-ASCONF support (core).")
Signed-off-by: Kyuwon Cho <kyuw…@skku.edu>
---
This issue was found by an LLM-guided test generator used in our research prototype.
A reproducer is available on request.
net/sctp/primitive.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/sctp/primitive.c b/net/sctp/primitive.c
index 782d673c3fba..fb35db712202 100644
--- a/net/sctp/primitive.c
+++ b/net/sctp/primitive.c
@@ -48,7 +48,8 @@ int sctp_primitive_ ## name(struct net *net, struct sctp_association *asoc, \
ep = asoc ? asoc->ep : NULL; \
\
error = sctp_do_sm(net, event_type, subtype, state, ep, asoc, \
- arg, GFP_KERNEL); \
+ arg, SCTP_PRIMITIVE_ ## name == SCTP_PRIMITIVE_ASCONF ? \
+ GFP_ATOMIC : GFP_KERNEL); \
return error; \
}
--
2.43.0