Skip to contentSkip to conversation

Bluetooth: Add BUILD_BUG_ON check for SKB control buffer size

PATCH Applied Marcel Holtmann 2 participants 2 messages Sep 14, 2014 – Sep 15, 2014

Subsystems (2)
lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: Add BUILD_BUG_ON check for SKB control buffer size

The struct bt_skb_cb size needs to stay within the limits of skb->cb at all times and to ensure that add a BUILD_BUG_ON to check for it at compile time.

---
 net/bluetooth/af_bluetooth.c | 3 +++
 1 file changed, 3 insertions(+)
net/bluetooth/af_bluetooth.c +3 -0
index 4dca0299ed96..339c74ad4553 100644
@@ -709,8 +709,11 @@ EXPORT_SYMBOL_GPL(bt_debugfs);
 
 static int __init bt_init(void)
 {
+	struct sk_buff *skb;
 	int err;
 
+	BUILD_BUG_ON(sizeof(struct bt_skb_cb) > sizeof(skb->cb));
+
 	BT_INFO("Core ver %s", VERSION);
 
 	bt_debugfs = debugfs_create_dir("bluetooth", NULL);
Signature · 1 line
1.9.3
#1 lore raw

Hi Marcel,

Quoted 8 lines · Marcel Holtmann

The struct bt_skb_cb size needs to stay within the limits of skb->cb at all times and to ensure that add a BUILD_BUG_ON to check for it at compile time.

---
 net/bluetooth/af_bluetooth.c | 3 +++
 1 file changed, 3 insertions(+)

Applied to bluetooth-next. Thanks.

Johan