[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170502105853.yz3ny6lyso6isdvx@mwanda>
Date: Tue, 2 May 2017 13:58:53 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: "David S. Miller" <davem@...emloft.net>
Cc: netdev@...r.kernel.org,
"security@...nel.org" <security@...nel.org>,
"secalert@...hat.com" <secalert@...hat.com>
Subject: [PATCH] ipx: call ipxitf_put() in ioctl error path
We should call ipxitf_put() if the copy_to_user() fails.
Reported-by: 李强 <liqiang6-s@....cn>
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
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:
Powered by blists - more mailing lists