Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
net/9p: fix memory handling/allocation in rdma_request()

+18 -11
+18 -11
net/9p/trans_rdma.c
··· 426 426 427 427 /* Allocate an fcall for the reply */ 428 428 rpl_context = kmalloc(sizeof *rpl_context, GFP_KERNEL); 429 - if (!rpl_context) 429 + if (!rpl_context) { 430 + err = -ENOMEM; 430 431 goto err_close; 432 + } 431 433 432 434 /* 433 435 * If the request has a buffer, steal it, otherwise ··· 447 445 } 448 446 rpl_context->rc = req->rc; 449 447 if (!rpl_context->rc) { 450 - kfree(rpl_context); 451 - goto err_close; 448 + err = -ENOMEM; 449 + goto err_free2; 452 450 } 453 451 454 452 /* ··· 460 458 */ 461 459 if (atomic_inc_return(&rdma->rq_count) <= rdma->rq_depth) { 462 460 err = post_recv(client, rpl_context); 463 - if (err) { 464 - kfree(rpl_context->rc); 465 - kfree(rpl_context); 466 - goto err_close; 467 - } 461 + if (err) 462 + goto err_free1; 468 463 } else 469 464 atomic_dec(&rdma->rq_count); 470 465 ··· 470 471 471 472 /* Post the request */ 472 473 c = kmalloc(sizeof *c, GFP_KERNEL); 473 - if (!c) 474 - goto err_close; 474 + if (!c) { 475 + err = -ENOMEM; 476 + goto err_free1; 477 + } 475 478 c->req = req; 476 479 477 480 c->busa = ib_dma_map_single(rdma->cm_id->device, ··· 500 499 return ib_post_send(rdma->qp, &wr, &bad_wr); 501 500 502 501 error: 502 + kfree(c); 503 + kfree(rpl_context->rc); 504 + kfree(rpl_context); 503 505 P9_DPRINTK(P9_DEBUG_ERROR, "EIO\n"); 504 506 return -EIO; 505 - 507 + err_free1: 508 + kfree(rpl_context->rc); 509 + err_free2: 510 + kfree(rpl_context); 506 511 err_close: 507 512 spin_lock_irqsave(&rdma->req_lock, flags); 508 513 if (rdma->state < P9_RDMA_CLOSING) {