Skip to content

Commit

Permalink
ipx: call ipxitf_put() in ioctl error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed May 2, 2017
1 parent 9da3242 commit ee0d8d8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions net/ipx/af_ipx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ee0d8d8

Please sign in to comment.