Repository navigation
Commit dfb5394
IB/hfi1: Call kobject_put() when kobject_init_and_add() fails
When kobject_init_and_add() returns an error in the function
hfi1_create_port_files(), the function kobject_put() is not called for the
corresponding kobject, which potentially leads to memory leak.
This patch fixes the issue by calling kobject_put() even if
kobject_init_and_add() fails.
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200326163813.21129.44280.stgit@awfm-01.aw.intel.com
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Kaike Wan <kaike.wan@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>1 parent 5c15abc commit dfb5394
1 file changed
Lines changed: 8 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
674 | 674 | | |
675 | 675 | | |
676 | 676 | | |
677 | | - | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
678 | 682 | | |
679 | 683 | | |
680 | 684 | | |
| |||
684 | 688 | | |
685 | 689 | | |
686 | 690 | | |
687 | | - | |
| 691 | + | |
688 | 692 | | |
689 | 693 | | |
690 | 694 | | |
| |||
694 | 698 | | |
695 | 699 | | |
696 | 700 | | |
697 | | - | |
| 701 | + | |
698 | 702 | | |
699 | 703 | | |
700 | 704 | | |
| |||
704 | 708 | | |
705 | 709 | | |
706 | 710 | | |
707 | | - | |
| 711 | + | |
708 | 712 | | |
709 | 713 | | |
710 | 714 | | |
| |||
742 | 746 | | |
743 | 747 | | |
744 | 748 | | |
745 | | - | |
746 | 749 | | |
747 | 750 | | |
748 | 751 | | |
| |||
0 commit comments