[PATCH] VLAN: Add two missing checks to vlan_ioctl_handler()

Linux Kernel Mailing List <[email protected]> Wed, 19 Apr 2006 21:59:50 GMT
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
commit 6b56c2053649d588df0ab750f404ccd39664f87f
tree b68f3c6398a207c6d97132ab5660f2ca39af126d
parent 1b6e03e34074439bce3ef9eb9ca833cf6fff6b5a
author Mika Kukkonen <[email protected]> Wed, 21 Dec 2005 22:50:15 +0200
committer Willy TARREAU <willy@pcw.(none)> Sat, 15 Apr 2006 12:13:30 +0200

[PATCH] VLAN: Add two missing checks to vlan_ioctl_handler()

In vlan_ioctl_handler() the code misses couple checks for
error return values. The same patch was merged into 2.6.

Signed-of-by: Mika Kukkonen <[email protected]>

 net/8021q/vlan.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 7498888..3c67e20 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -757,6 +757,8 @@ int vlan_ioctl_handler(unsigned long arg
 
 	case GET_VLAN_REALDEV_NAME_CMD:
 		err = vlan_dev_get_realdev_name(args.device1, args.u.device2);
+		if (err)
+			goto out;
 		if (copy_to_user((void*)arg, &args,
 				 sizeof(struct vlan_ioctl_args))) {
 			err = -EFAULT;
@@ -765,6 +767,8 @@ int vlan_ioctl_handler(unsigned long arg
 
 	case GET_VLAN_VID_CMD:
 		err = vlan_dev_get_vid(args.device1, &vid);
+		if (err)
+			goto out;
 		args.u.VID = vid;
 		if (copy_to_user((void*)arg, &args,
 				 sizeof(struct vlan_ioctl_args))) {
@@ -778,7 +782,7 @@ int vlan_ioctl_handler(unsigned long arg
 			__FUNCTION__, args.cmd);
 		return -EINVAL;
 	};
-
+out:
 	return err;
 }