From: Dan Carpenter <[email protected]>

upstream ee0d8d8482345ff97a75a7d747efc309f13b0d80 commit

We should call ipxitf_put() if the copy_to_user() fails.

Reported-by: 李强 <[email protected]>
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Jianchuan Wang <[email protected]>
---
 net/ipx/af_ipx.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index 8a9219f..fa31ef2 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:
-- 
2.8.1

-- 
_______________________________________________
linux-yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/linux-yocto

Reply via email to