lkml.org 
[lkml]   [2020]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Linux-kernel-mentees] [PATCH v3] media/v4l2-core: Fix kernel-infoleak in video_put_user()
On Mon, Jul 27, 2020 at 04:16:08PM +0300, Dan Carpenter wrote:
> drivers/block/floppy.c:3132 raw_cmd_copyout() warn: check that 'cmd' doesn't leak information (struct has a hole after 'flags')

(Removed some Cc: recipients from the list.)

I'm not very sure, but I think this one is also a false positive.

Here Smatch is complaining about a linked list called `my_raw_cmd`
defined in raw_cmd_ioctl():

drivers/block/floppy.c:3249:

ret = raw_cmd_copyin(cmd, param, &my_raw_cmd);

In raw_cmd_copyin(), each element of the linked list is allocated by
kmalloc() then copied from user:

drivers/block/floppy.c:3180:

loop:
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 copy_from_user() is filling in the paddings inside `struct
floppy_raw_cmd`?

Thank you,
Peilin Ye

\
 
 \ /
  Last update: 2020-07-28 00:34    [W:0.192 / U:0.492 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site