summaryrefslogtreecommitdiffstats
path: root/arch/um/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-15 17:50:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-15 17:50:51 -0400
commit8d1e5133bf260aabdf2cc6facd4a8e696414d16a (patch)
tree0e152a07b3892546879f55028b26b1701f7de8e6 /arch/um/drivers
parent6a4d4b3253c1341843ba473429cf76a0e54f053d (diff)
parent5ec9121195a4f1cecd0fa592636c5f81eb03dc8c (diff)
Merge branch 'for-linus-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml
Pull uml updates from Richard Weinberger: "Minor updates for UML: - fixes for our new vector network driver by Anton - initcall cleanup by Alexander - We have a new mailinglist, sourceforge.net sucks" * 'for-linus-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml: um: Fix raw interface options um: Fix initialization of vector queues um: remove uml initcalls um: Update mailing list address
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