summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-05-02 13:58:53 +0300
committerSasha Levin <alexander.levin@verizon.com>2017-06-13 09:29:21 -0400
commite8701e0f6768291622b01a3083c3a7e6761f6c51 (patch)
tree9eeba11ce019e534907d31f9e68f07785c3d11ab /net
parent709dcf11a35318f4d9b8aeb0c5c144fd59fbabc1 (diff)
ipx: call ipxitf_put() in ioctl error path
[ Upstream commit ee0d8d8482345ff97a75a7d747efc309f13b0d80 ] We should call ipxitf_put() if the copy_to_user() fails. Reported-by: 李强 <liqiang6-s@360.cn> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'net')
-rw-r--r--net/ipx/af_ipx.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index 4ea5d7497b5f..83a4b5d8747b 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -1168,11 +1168,10 @@ static int ipxitf_ioctl(unsigned int cmd, void __user *arg)
sipx->sipx_network = ipxif->if_netnum;
memcpy(sipx->sipx_node, ipxif->if_node,
sizeof(sipx->sipx_node));
- rc = -EFAULT;
+ rc = 0;
if (copy_to_user(arg, &ifr, sizeof(ifr)))
- break;
+ rc = -EFAULT;
ipxitf_put(ipxif);
- rc = 0;
break;
}
case SIOCAIPXITFCRT: