<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Crash after dequeuing invalid L2CAP PDU</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/117653/crash-after-dequeuing-invalid-l2cap-pdu</link><description>Hi, 
 I have to develop a BLE peripheral, that communicates larger amounts of data over L2CAP. Establishing the channel between central and peripheral works. I&amp;#39;m able to receive two SDUs and send two SDUs, until I find the application reproducible in</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 02 Jan 2025 11:28:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/117653/crash-after-dequeuing-invalid-l2cap-pdu" /><item><title>RE: Crash after dequeuing invalid L2CAP PDU</title><link>https://devzone.nordicsemi.com/thread/516629?ContentTypeID=1</link><pubDate>Thu, 02 Jan 2025 11:28:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb8c3d6a-5a6b-4e05-9fa8-2e818fcab613</guid><dc:creator>Torsten Robitzki</dc:creator><description>&lt;p&gt;From a debug session: It seems like the l2cap layer is accessing the buffers user data (which is documented). What is not documented, is the required size, when declaring the buffer pool. The obvious choice would be `sizeof struct closure` from `conn_internal.h`. As this header is not included in the public include path, I was searching for the documented buffer head room:&amp;nbsp;BT_L2CAP_BUF_SIZE. From that search result I extrapolated, that the public available required size could be `CONFIG_BT_CONN_TX_USER_DATA_SIZE` (which is twice the size as&amp;nbsp;&lt;span&gt;`sizeof &lt;/span&gt;&lt;span&gt;struct closure`, but who cares).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Adding `CONFIG_BT_CONN_TX_USER_DATA_SIZE` as &amp;quot;user&amp;quot;-data size to the definition of the buffer pool, fixes the issue.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>