lkml.org 
[lkml]   [2000]   [Sep]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH] alignment issue with ipchains
    Date
    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/
    \
     
     \ /
      Last update: 2005-03-22 12:38    [W:0.022 / U:0.100 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site