hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/net/can/j1939/transport.c
....@@ -600,7 +600,10 @@
600600 /* reserve CAN header */
601601 skb_reserve(skb, offsetof(struct can_frame, data));
602602
603
- memcpy(skb->cb, re_skcb, sizeof(skb->cb));
603
+ /* skb->cb must be large enough to hold a j1939_sk_buff_cb structure */
604
+ BUILD_BUG_ON(sizeof(skb->cb) < sizeof(*re_skcb));
605
+
606
+ memcpy(skb->cb, re_skcb, sizeof(*re_skcb));
604607 skcb = j1939_skb_to_cb(skb);
605608 if (swap_src_dst)
606609 j1939_skbcb_swap(skcb);
....@@ -1087,10 +1090,6 @@
10871090 bool active;
10881091
10891092 j1939_session_list_lock(priv);
1090
- /* This function should be called with a session ref-count of at
1091
- * least 2.
1092
- */
1093
- WARN_ON_ONCE(kref_read(&session->kref) < 2);
10941093 active = j1939_session_deactivate_locked(session);
10951094 j1939_session_list_unlock(priv);
10961095