hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
....@@ -502,6 +502,11 @@
502502 struct iwl_mcc_update_resp *mcc_resp = (void *)pkt->data;
503503
504504 n_channels = __le32_to_cpu(mcc_resp->n_channels);
505
+ if (iwl_rx_packet_payload_len(pkt) !=
506
+ struct_size(mcc_resp, channels, n_channels)) {
507
+ resp_cp = ERR_PTR(-EINVAL);
508
+ goto exit;
509
+ }
505510 resp_len = sizeof(struct iwl_mcc_update_resp) +
506511 n_channels * sizeof(__le32);
507512 resp_cp = kmemdup(mcc_resp, resp_len, GFP_KERNEL);
....@@ -513,6 +518,11 @@
513518 struct iwl_mcc_update_resp_v3 *mcc_resp_v3 = (void *)pkt->data;
514519
515520 n_channels = __le32_to_cpu(mcc_resp_v3->n_channels);
521
+ if (iwl_rx_packet_payload_len(pkt) !=
522
+ struct_size(mcc_resp_v3, channels, n_channels)) {
523
+ resp_cp = ERR_PTR(-EINVAL);
524
+ goto exit;
525
+ }
516526 resp_len = sizeof(struct iwl_mcc_update_resp) +
517527 n_channels * sizeof(__le32);
518528 resp_cp = kzalloc(resp_len, GFP_KERNEL);