mirror of https://github.com/xemu-project/xemu.git
hw/9pfs: Don't crash when we get a request with not supported 9p operation
Return EOPNOTSUPP as error Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
This commit is contained in:
parent
faa44e3d3e
commit
5c3234c6c0
|
@ -3606,6 +3606,11 @@ static pdu_handler_t *pdu_handlers[] = {
|
||||||
[P9_TREMOVE] = v9fs_remove,
|
[P9_TREMOVE] = v9fs_remove,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void v9fs_op_not_supp(V9fsState *s, V9fsPDU *pdu)
|
||||||
|
{
|
||||||
|
complete_pdu(s, pdu, -EOPNOTSUPP);
|
||||||
|
}
|
||||||
|
|
||||||
static void submit_pdu(V9fsState *s, V9fsPDU *pdu)
|
static void submit_pdu(V9fsState *s, V9fsPDU *pdu)
|
||||||
{
|
{
|
||||||
pdu_handler_t *handler;
|
pdu_handler_t *handler;
|
||||||
|
@ -3613,12 +3618,12 @@ static void submit_pdu(V9fsState *s, V9fsPDU *pdu)
|
||||||
if (debug_9p_pdu) {
|
if (debug_9p_pdu) {
|
||||||
pprint_pdu(pdu);
|
pprint_pdu(pdu);
|
||||||
}
|
}
|
||||||
|
if (pdu->id >= ARRAY_SIZE(pdu_handlers) ||
|
||||||
BUG_ON(pdu->id >= ARRAY_SIZE(pdu_handlers));
|
(pdu_handlers[pdu->id] == NULL)) {
|
||||||
|
handler = v9fs_op_not_supp;
|
||||||
handler = pdu_handlers[pdu->id];
|
} else {
|
||||||
BUG_ON(handler == NULL);
|
handler = pdu_handlers[pdu->id];
|
||||||
|
}
|
||||||
handler(s, pdu);
|
handler(s, pdu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue