lkml.org 
[lkml]   [2020]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Linux-kernel-mentees] [PATCH v2] block/floppy: Prevent kernel-infoleak in raw_cmd_copyout()
On Wed, Jul 29, 2020 at 04:22:41PM +0300, Denis Efremov wrote:
>
> On 7/29/20 3:58 PM, Dan Carpenter wrote:
> > Argh... This isn't right still. The "ptr" comes from raw_cmd_copyin()
> >
> > ptr = kmalloc(sizeof(struct floppy_raw_cmd), GFP_KERNEL);
> >
>
> copy_from_user overwrites the padding bytes:
> ptr = kmalloc(sizeof(struct floppy_raw_cmd), GFP_KERNEL);
> if (!ptr)
> return -ENOMEM;
> *rcmd = ptr;
> ret = copy_from_user(ptr, param, sizeof(*ptr));
>
> I think memcpy should be safe in this patch.

Oh yeah. You're right. My bad. I just saw the:

ptr->next = NULL;
ptr->buffer_length = 0;
ptr->kernel_data = NULL;

Assignments and I missed the copy_from_user.

regards,
dan carpenter

\
 
 \ /
  Last update: 2020-07-29 15:43    [W:0.067 / U:0.576 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site