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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c67e87a22d
commit
820adccd0e
+3
-4
@@ -1168,11 +1168,10 @@ static int ipxitf_ioctl(unsigned int cmd, void __user *arg)
|
|||||||
sipx->sipx_network = ipxif->if_netnum;
|
sipx->sipx_network = ipxif->if_netnum;
|
||||||
memcpy(sipx->sipx_node, ipxif->if_node,
|
memcpy(sipx->sipx_node, ipxif->if_node,
|
||||||
sizeof(sipx->sipx_node));
|
sizeof(sipx->sipx_node));
|
||||||
rc = -EFAULT;
|
|
||||||
if (copy_to_user(arg, &ifr, sizeof(ifr)))
|
|
||||||
break;
|
|
||||||
ipxitf_put(ipxif);
|
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
if (copy_to_user(arg, &ifr, sizeof(ifr)))
|
||||||
|
rc = -EFAULT;
|
||||||
|
ipxitf_put(ipxif);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SIOCAIPXITFCRT:
|
case SIOCAIPXITFCRT:
|
||||||
|
|||||||
Reference in New Issue
Block a user