Messages in this thread Patch in this message |  | | From | NIIBE Yutaka <> | Subject | [PATCH] alignment issue with ipchains | Date | Sat, 09 Sep 2000 11:25:28 +0900 |
| |
With ipchains, we have alignment problem. H. Kambara <hkanbara@torisan.co.jp> found that it core dumps on SuperH machine.
The cause of this problem is get_user accesses wrongly in ip_setsockopt.
Here's a patch, avoiding useless access.
diff -ruN linux-2.4.0-test8-pre6/net/ipv4/ip_sockglue.c kernel/net/ipv4/ip_sockglue.c --- linux-2.4.0-test8-pre6/net/ipv4/ip_sockglue.c Fri Aug 11 05:01:26 2000 +++ kernel/net/ipv4/ip_sockglue.c Thu Aug 24 16:30:33 2000 @@ -39,6 +39,9 @@ #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) #include <net/transp_v6.h> #endif +#ifdef CONFIG_NETFILTER +#include <linux/netfilter_ipv4/ipchains_core.h> +#endif #include <linux/errqueue.h> #include <asm/uaccess.h> @@ -380,15 +383,18 @@ { int val=0,err; - if(optlen>=sizeof(int)) { - if(get_user(val, (int *) optval)) - return -EFAULT; - } else if(optlen>=sizeof(char)) { - unsigned char ucval; - if(get_user(ucval, (unsigned char *) optval)) - return -EFAULT; - val = (int)ucval; - } +#ifdef CONFIG_NETFILTER + if (!(optname >= IP_FW_APPEND && optname <= IP_FW_MASQ_CTL)) +#endif + if(optlen>=sizeof(int)) { + if(get_user(val, (int *) optval)) + return -EFAULT; + } else if(optlen>=sizeof(char)) { + unsigned char ucval; + if(get_user(ucval, (unsigned char *) optval)) + return -EFAULT; + val = (int)ucval; + } /* If optlen==0, it is equivalent to val == 0 */ if(level!=SOL_IP) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
|  |