lkml.org 
[lkml]   [2005]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 2/7] HPET: fix HPET_INFO calls from kernel space
    From: Clemens Ladisch <clemens@ladisch.de>

    Fix a wrong memory access in hpet_ioctl_common(). It was not possible
    to use the HPET_INFO ioctl from kernel space because it always called
    copy_to_user().

    Signed-off-by: Clemens Ladisch <clemens@ladisch.de>

    Index: linux-2.6.13/drivers/char/hpet.c
    ===================================================================
    --- linux-2.6.13.orig/drivers/char/hpet.c 2005-10-03 22:53:09.000000000 +0200
    +++ linux-2.6.13/drivers/char/hpet.c 2005-10-03 22:53:12.000000000 +0200
    @@ -500,8 +500,12 @@ hpet_ioctl_common(struct hpet_dev *devp,
    readq(&timer->hpet_config) & Tn_PER_INT_CAP_MASK;
    info.hi_hpet = devp->hd_hpets->hp_which;
    info.hi_timer = devp - devp->hd_hpets->hp_dev;
    - if (copy_to_user((void __user *)arg, &info, sizeof(info)))
    - err = -EFAULT;
    + if (kernel)
    + memcpy((void *)arg, &info, sizeof(info));
    + else
    + if (copy_to_user((void __user *)arg, &info,
    + sizeof(info)))
    + err = -EFAULT;
    break;
    }
    case HPET_EPI:
    -
    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/
    \
     
     \ /
      Last update: 2005-10-04 14:48    [W:2.215 / U:0.072 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site