qcacmn: Add sanity check for pktlog msgs
Add sanity check for pktlog messages, as we have seen a single case of inconsisten nbuf. Assert if fails. Change-Id: I6a076c4dfaa2ff8e1972dd795cadeca1302b2c0e CRs-Fixed: 2131952
This commit is contained in:

committed by
snandini

parent
fa601a66eb
commit
6bd48f118a
@@ -741,6 +741,17 @@ void pktlog_process_fw_msg(uint32_t *buff)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(QCA_WIFI_3_0_ADRASTEA)
|
#if defined(QCA_WIFI_3_0_ADRASTEA)
|
||||||
|
static inline int pktlog_nbuf_check_sanity(qdf_nbuf_t nbuf)
|
||||||
|
{
|
||||||
|
int rc = 0; /* sane */
|
||||||
|
|
||||||
|
if ((!nbuf) ||
|
||||||
|
(nbuf->data < nbuf->head) ||
|
||||||
|
((nbuf->data + skb_headlen(nbuf)) > skb_end_pointer(nbuf)))
|
||||||
|
rc = -EINVAL;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* pktlog_t2h_msg_handler() - Target to host message handler
|
* pktlog_t2h_msg_handler() - Target to host message handler
|
||||||
* @context: pdev context
|
* @context: pdev context
|
||||||
@@ -754,6 +765,15 @@ static void pktlog_t2h_msg_handler(void *context, HTC_PACKET *pkt)
|
|||||||
qdf_nbuf_t pktlog_t2h_msg = (qdf_nbuf_t) pkt->pPktContext;
|
qdf_nbuf_t pktlog_t2h_msg = (qdf_nbuf_t) pkt->pPktContext;
|
||||||
uint32_t *msg_word;
|
uint32_t *msg_word;
|
||||||
|
|
||||||
|
/* check for sanity of the packet, have seen corrupted pkts */
|
||||||
|
if (pktlog_nbuf_check_sanity(pktlog_t2h_msg)) {
|
||||||
|
qdf_print("%s: packet 0x%p corrupted? Leaking...",
|
||||||
|
__func__, pktlog_t2h_msg);
|
||||||
|
/* do not free; may crash! */
|
||||||
|
QDF_ASSERT(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* check for successful message reception */
|
/* check for successful message reception */
|
||||||
if (pkt->Status != QDF_STATUS_SUCCESS) {
|
if (pkt->Status != QDF_STATUS_SUCCESS) {
|
||||||
if (pkt->Status != QDF_STATUS_E_CANCELED)
|
if (pkt->Status != QDF_STATUS_E_CANCELED)
|
||||||
|
Reference in New Issue
Block a user