[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZK5l8HdIbF7qRwyp@shredder>
Date: Wed, 12 Jul 2023 11:36:00 +0300
From: Ido Schimmel <idosch@...dia.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: Jiri Pirko <jiri@...nulli.us>, Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Ido Schimmel <idosch@...lanox.com>, netdev@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH net] devlink: uninitialized data in
nsim_dev_trap_fa_cookie_write()
On Tue, Jul 11, 2023 at 11:52:26AM +0300, Dan Carpenter wrote:
> The simple_write_to_buffer() function is designed to handle partial
> writes. It returns negatives on error, otherwise it returns the number
> of bytes that were able to be copied. This code doesn't check the
> return properly. We only know that the first byte is written, the rest
> of the buffer might be uninitialized.
>
> There is no need to use the simple_write_to_buffer() function.
> Partial writes are prohibited by the "if (*ppos != 0)" check at the
> start of the function. Just use memdup_user() and copy the whole
> buffer.
>
> Fixes: d3cbb907ae57 ("netdevsim: add ACL trap reporting cookie as a metadata")
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
Reviewed-by: Ido Schimmel <idosch@...dia.com>
Powered by blists - more mailing lists