diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2017-05-02 06:58:53 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-05-25 09:44:41 -0400 |
commit | 820adccd0e3be9bdd2384ca8fc4712108cfdf28b (patch) | |
tree | a83313dc0081019e79e5107240f131f55ca3b448 /net | |
parent | c67e87a22dd8b39ea1c9864336f7c17175053744 (diff) |
ipx: call ipxitf_put() in ioctl error path
commit ee0d8d8482345ff97a75a7d747efc309f13b0d80 upstream.
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipx/af_ipx.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index 48d0dc89b58d..e735f781e4f3 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) | |||
1168 | sipx->sipx_network = ipxif->if_netnum; | 1168 | sipx->sipx_network = ipxif->if_netnum; |
1169 | memcpy(sipx->sipx_node, ipxif->if_node, | 1169 | memcpy(sipx->sipx_node, ipxif->if_node, |
1170 | sizeof(sipx->sipx_node)); | 1170 | sizeof(sipx->sipx_node)); |
1171 | rc = -EFAULT; | 1171 | rc = 0; |
1172 | if (copy_to_user(arg, &ifr, sizeof(ifr))) | 1172 | if (copy_to_user(arg, &ifr, sizeof(ifr))) |
1173 | break; | 1173 | rc = -EFAULT; |
1174 | ipxitf_put(ipxif); | 1174 | ipxitf_put(ipxif); |
1175 | rc = 0; | ||
1176 | break; | 1175 | break; |
1177 | } | 1176 | } |
1178 | case SIOCAIPXITFCRT: | 1177 | case SIOCAIPXITFCRT: |