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>

Change-Id: Ib541c679cc5f4242713eb035aed458043b8ce97e
(cherry picked from commit ee0d8d8482345ff97a75a7d747efc309f13b0d80)
This commit is contained in:
Dan Carpenter 2017-05-02 13:58:53 +03:00 committed by Sean McCreary
parent b660e27533
commit 6d64f82cb0
1 changed files with 3 additions and 4 deletions

View File

@ -1194,11 +1194,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;
if (copy_to_user(arg, &ifr, sizeof(ifr)))
break;
ipxitf_put(ipxif);
rc = 0;
if (copy_to_user(arg, &ifr, sizeof(ifr)))
rc = -EFAULT;
ipxitf_put(ipxif);
break;
}
case SIOCAIPXITFCRT: