diff options
| -rw-r--r-- | drivers/char/ipmi/ipmi_msghandler.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index d745004281d0..abd4c5118a1b 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
| @@ -736,7 +736,8 @@ int ipmi_create_user(unsigned int if_num, | |||
| 736 | intf = ipmi_interfaces[if_num]; | 736 | intf = ipmi_interfaces[if_num]; |
| 737 | if ((if_num >= MAX_IPMI_INTERFACES) || IPMI_INVALID_INTERFACE(intf)) { | 737 | if ((if_num >= MAX_IPMI_INTERFACES) || IPMI_INVALID_INTERFACE(intf)) { |
| 738 | spin_unlock_irqrestore(&interfaces_lock, flags); | 738 | spin_unlock_irqrestore(&interfaces_lock, flags); |
| 739 | return -EINVAL; | 739 | rv = -EINVAL; |
| 740 | goto out_kfree; | ||
| 740 | } | 741 | } |
| 741 | 742 | ||
| 742 | /* Note that each existing user holds a refcount to the interface. */ | 743 | /* Note that each existing user holds a refcount to the interface. */ |
| @@ -751,14 +752,14 @@ int ipmi_create_user(unsigned int if_num, | |||
| 751 | 752 | ||
| 752 | if (!try_module_get(intf->handlers->owner)) { | 753 | if (!try_module_get(intf->handlers->owner)) { |
| 753 | rv = -ENODEV; | 754 | rv = -ENODEV; |
| 754 | goto out_err; | 755 | goto out_kref; |
| 755 | } | 756 | } |
| 756 | 757 | ||
| 757 | if (intf->handlers->inc_usecount) { | 758 | if (intf->handlers->inc_usecount) { |
| 758 | rv = intf->handlers->inc_usecount(intf->send_info); | 759 | rv = intf->handlers->inc_usecount(intf->send_info); |
| 759 | if (rv) { | 760 | if (rv) { |
| 760 | module_put(intf->handlers->owner); | 761 | module_put(intf->handlers->owner); |
| 761 | goto out_err; | 762 | goto out_kref; |
| 762 | } | 763 | } |
| 763 | } | 764 | } |
| 764 | 765 | ||
| @@ -769,9 +770,10 @@ int ipmi_create_user(unsigned int if_num, | |||
| 769 | *user = new_user; | 770 | *user = new_user; |
| 770 | return 0; | 771 | return 0; |
| 771 | 772 | ||
| 772 | out_err: | 773 | out_kref: |
| 773 | kfree(new_user); | ||
| 774 | kref_put(&intf->refcount, intf_free); | 774 | kref_put(&intf->refcount, intf_free); |
| 775 | out_kfree: | ||
| 776 | kfree(new_user); | ||
| 775 | return rv; | 777 | return rv; |
| 776 | } | 778 | } |
| 777 | 779 | ||
