summaryrefslogtreecommitdiffstats
path: root/arch/um/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/drivers')
-rw-r--r--arch/um/drivers/vector_kern.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
index 627075e6d875..50ee3bb5a63a 100644
--- a/arch/um/drivers/vector_kern.c
+++ b/arch/um/drivers/vector_kern.c
@@ -188,7 +188,7 @@ static int get_transport_options(struct arglist *def)
188 if (strncmp(transport, TRANS_TAP, TRANS_TAP_LEN) == 0) 188 if (strncmp(transport, TRANS_TAP, TRANS_TAP_LEN) == 0)
189 return (vec_rx | VECTOR_BPF); 189 return (vec_rx | VECTOR_BPF);
190 if (strncmp(transport, TRANS_RAW, TRANS_RAW_LEN) == 0) 190 if (strncmp(transport, TRANS_RAW, TRANS_RAW_LEN) == 0)
191 return (vec_rx | vec_tx); 191 return (vec_rx | vec_tx | VECTOR_QDISC_BYPASS);
192 return (vec_rx | vec_tx); 192 return (vec_rx | vec_tx);
193} 193}
194 194
@@ -504,15 +504,19 @@ static struct vector_queue *create_queue(
504 504
505 result = kmalloc(sizeof(struct vector_queue), GFP_KERNEL); 505 result = kmalloc(sizeof(struct vector_queue), GFP_KERNEL);
506 if (result == NULL) 506 if (result == NULL)
507 goto out_fail; 507 return NULL;
508 result->max_depth = max_size; 508 result->max_depth = max_size;
509 result->dev = vp->dev; 509 result->dev = vp->dev;
510 result->mmsg_vector = kmalloc( 510 result->mmsg_vector = kmalloc(
511 (sizeof(struct mmsghdr) * max_size), GFP_KERNEL); 511 (sizeof(struct mmsghdr) * max_size), GFP_KERNEL);
512 if (result->mmsg_vector == NULL)
513 goto out_mmsg_fail;
512 result->skbuff_vector = kmalloc( 514 result->skbuff_vector = kmalloc(
513 (sizeof(void *) * max_size), GFP_KERNEL); 515 (sizeof(void *) * max_size), GFP_KERNEL);
514 if (result->mmsg_vector == NULL || result->skbuff_vector == NULL) 516 if (result->skbuff_vector == NULL)
515 goto out_fail; 517 goto out_skb_fail;
518
519 /* further failures can be handled safely by destroy_queue*/
516 520
517 mmsg_vector = result->mmsg_vector; 521 mmsg_vector = result->mmsg_vector;
518 for (i = 0; i < max_size; i++) { 522 for (i = 0; i < max_size; i++) {
@@ -563,6 +567,11 @@ static struct vector_queue *create_queue(
563 result->head = 0; 567 result->head = 0;
564 result->tail = 0; 568 result->tail = 0;
565 return result; 569 return result;
570out_skb_fail:
571 kfree(result->mmsg_vector);
572out_mmsg_fail:
573 kfree(result);
574 return NULL;
566out_fail: 575out_fail:
567 destroy_queue(result); 576 destroy_queue(result);
568 return NULL; 577 return NULL;
@@ -1232,9 +1241,8 @@ static int vector_net_open(struct net_device *dev)
1232 1241
1233 if ((vp->options & VECTOR_QDISC_BYPASS) != 0) { 1242 if ((vp->options & VECTOR_QDISC_BYPASS) != 0) {
1234 if (!uml_raw_enable_qdisc_bypass(vp->fds->rx_fd)) 1243 if (!uml_raw_enable_qdisc_bypass(vp->fds->rx_fd))
1235 vp->options = vp->options | VECTOR_BPF; 1244 vp->options |= VECTOR_BPF;
1236 } 1245 }
1237
1238 if ((vp->options & VECTOR_BPF) != 0) 1246 if ((vp->options & VECTOR_BPF) != 0)
1239 vp->bpf = uml_vector_default_bpf(vp->fds->rx_fd, dev->dev_addr); 1247 vp->bpf = uml_vector_default_bpf(vp->fds->rx_fd, dev->dev_addr);
1240 1248