Re: [PATCH 2.4] Wireless Extension v17 (resend)

From: Chris Wright (chrisw_at_osdl.org)
Date: 02/09/05

  • Next message: Adrian Bunk: "[2.6 patch] kill drivers/scsi/hosts.h"
    Date:	Tue, 8 Feb 2005 17:51:29 -0800
    To: Jean Tourrilhes <jt@hpl.hp.com>
    
    

    * Jean Tourrilhes (jt@hpl.hp.com) wrote:
    > The first is the handling of spyoffset which is potentially
    > unsafe. Unfortunately, the fix involve some API/infrastructure change,
    > so is not transparent. Fortunately drivers are clever enough to not
    > trigger this bug.
    > The second is a potential leak of kernel data to user space in
    > private handler handling. Few drivers use that feature, there is no
    > risk of crash or direct attack, so I would not worry about it.

    Hmm, having ability to read kernel data is not so nice. prism54 uses
    this, and is a reasonably popular card. Looks to me like this should be
    plugged. Is the patch below sufficient? (stolen from full 2.6 patch)

    thanks,
    -chris

    ===== net/core/wireless.c 1.4 vs edited =====
    --- 1.4/net/core/wireless.c 2003-09-03 04:12:57 -07:00
    +++ edited/net/core/wireless.c 2005-02-08 17:45:15 -08:00
    @@ -310,7 +310,7 @@ static inline int call_commit_handler(st
     
     /* ---------------------------------------------------------------- */
     /*
    - * Number of private arguments
    + * Calculate size of private arguments
      */
     static inline int get_priv_size(__u16 args)
     {
    @@ -320,6 +320,24 @@ static inline int get_priv_size(__u16 ar
             return num * priv_type_size[type];
     }
     
    +/* ---------------------------------------------------------------- */
    +/*
    + * Re-calculate the size of private arguments
    + */
    +static inline int adjust_priv_size(__u16 args,
    + union iwreq_data * wrqu)
    +{
    + int num = wrqu->data.length;
    + int max = args & IW_PRIV_SIZE_MASK;
    + int type = (args & IW_PRIV_TYPE_MASK) >> 12;
    +
    + /* Make sure the driver doesn't goof up */
    + if (max < num)
    + num = max;
    +
    + return num * priv_type_size[type];
    +}
    +
     
     /******************** /proc/net/wireless SUPPORT ********************/
     /*
    @@ -701,7 +719,7 @@ static inline int ioctl_private_call(str
                                ((extra_size + offset) <= IFNAMSIZ))
                                     extra_size = 0;
                     } else {
    - /* Size of set arguments */
    + /* Size of get arguments */
                             extra_size = get_priv_size(descr->get_args);
     
                             /* Does it fits in iwr ? */
    @@ -731,7 +749,7 @@ static inline int ioctl_private_call(str
                                     return -EFAULT;
     
                             /* Does it fits within bounds ? */
    - if(iwr->u.data.length > (descr->set_args &
    + if(iwr->u.data.length > (descr->get_args &
                                                      IW_PRIV_SIZE_MASK))
                                     return -E2BIG;
                     } else {
    @@ -771,6 +789,14 @@ static inline int ioctl_private_call(str
     
                     /* If we have something to return to the user */
                     if (!ret && IW_IS_GET(cmd)) {
    +
    + /* Adjust for the actual length if it's variable,
    + * avoid leaking kernel bits outside. */
    + if (!(descr->get_args & IW_PRIV_SIZE_FIXED)) {
    + extra_size = adjust_priv_size(descr->get_args,
    + &(iwr->u));
    + }
    +
                             err = copy_to_user(iwr->u.data.pointer, extra,
                                                extra_size);
                             if (err)
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Adrian Bunk: "[2.6 patch] kill drivers/scsi/hosts.h"

    Relevant Pages

    • [05/11] Fix i2c messsage flags in video drivers
      ... The drivers improperly copy the i2c client ... flags as the message flags, while both sets are mostly unrelated. ... I think this patch qualifies hands down as a "critical bug fix" to be ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ - ...
      (Linux-Kernel)
    • Re: [PATCH 0/23] reboot-fixes
      ... >> Presumably it unfixes Pavel's patch? ... > the suspend path. ... > But those are among the few drivers that do anything in either ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [patch] Real-Time Preemption, -RT-2.6.13-rc6-V0.7.53-11
      ... the patch should be okay. ... Perhaps most of the USB drivers don't care whether interrupts ... are enabled or not in their completion routines. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: RT patch acceptance
      ... Look at the patch. ... You're the one spreading FUD that preempt-RT is as good as RTAI, ... even worse than local_irq_disable isn't used in drivers or not safe to ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [2.6 patch] PCI cleanups
      ... > The patch below does some cleanups in the PCI code: ... Care to make a patch for just this? ... I've heard rumors that those drivers will be public ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)