From: Greg KH <gregkh@linuxfoundation.org>
To: Pimyn@web.codeaurora.org, Girgis@web.codeaurora.org,
bemenboshra2001@gmail.com
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
syzkaller-bugs@googlegroups.com, nogikh@google.com,
glider@google.com, dvyukov@google.com, elver@google.com,
pimyn@google.com,
syzbot+8f282cce71948071c335@syzkaller.appspotmail.com
Subject: Re: [PATCH] usb: usbtmc: initialize memory written to device
Date: Fri, 4 Oct 2024 14:58:42 +0200 [thread overview]
Message-ID: <2024100421-emerald-player-e331@gregkh> (raw)
In-Reply-To: <20241004123313.2463701-1-bemenboshra2001@gmail.com>
On Fri, Oct 04, 2024 at 12:33:13PM +0000, Pimyn@web.codeaurora.org wrote:
> Avoid kernel-usb-infoleak by initializing all memory written to device.
> The buffer length uses 32bit alignment which might cause some buffer
> data to be read without any initialization.
>
> Reported-by: syzbot+8f282cce71948071c335@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/all/0000000000006f6622061eb52dba@google.com/T/
> Signed-off-by: Pimyn Girgis <bemenboshra2001@gmail.com> (Google)
> ---
> drivers/usb/class/usbtmc.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
> index ffc9c6fdd7e1..d79a08dfb54d 100644
> --- a/drivers/usb/class/usbtmc.c
> +++ b/drivers/usb/class/usbtmc.c
> @@ -21,6 +21,7 @@
> #include <linux/usb.h>
> #include <linux/compat.h>
> #include <linux/usb/tmc.h>
> +#include <linux/string.h>
>
> /* Increment API VERSION when changing tmc.h with new flags or ioctls
> * or when changing a significant behavior of the driver.
> @@ -1169,6 +1170,8 @@ static ssize_t usbtmc_generic_write(struct usbtmc_file_data *file_data,
> * (size + 3 & ~3) rounds up and simplifies user code
> */
> aligned = (this_part + 3) & ~3;
> + /* Initialize the remaining part of the buffer */
> + memzero_explicit(buffer + this_part, aligned - this_part);
Why "explicit"?
Also, what about commit 625fa77151f0 ("USB: usbtmc: prevent
kernel-usb-infoleak"), doesn't that solve the issue here?
thanks,
greg k-h
next prev parent reply other threads:[~2024-10-04 12:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-04 12:33 [PATCH] usb: usbtmc: initialize memory written to device Pimyn
2024-10-04 12:57 ` Greg KH
2024-10-04 13:41 ` Alexander Potapenko
2024-10-04 13:56 ` Greg KH
2024-10-04 12:58 ` Greg KH [this message]
2024-10-04 13:38 ` Ⲡⲟⲓⲙⲏⲛ
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2024100421-emerald-player-e331@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=Girgis@web.codeaurora.org \
--cc=Pimyn@web.codeaurora.org \
--cc=bemenboshra2001@gmail.com \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=nogikh@google.com \
--cc=pimyn@google.com \
--cc=syzbot+8f282cce71948071c335@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.