summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-05-02 13:58:53 +0300
committerDavid S. Miller <davem@davemloft.net>2017-05-02 15:34:53 -0400
commitee0d8d8482345ff97a75a7d747efc309f13b0d80 (patch)
tree3f717a7aa3a5595cf6b3a08b0658dcd4fb87f1c6
parent9da3242e6a83b6f315aa9c394c939da8e4ad7774 (diff)
downloadlinux-ee0d8d8482345ff97a75a7d747efc309f13b0d80.tar.bz2
ipx: call ipxitf_put() in ioctl error path
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>
-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 8a9219ff2e77..fa31ef29e3fa 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: