[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200730161303.erzgrhqsgc77d4ny@wittgenstein>
Date: Thu, 30 Jul 2020 18:13:03 +0200
From: Christian Brauner <christian.brauner@...ntu.com>
To: Christoph Hellwig <hch@....de>
Cc: davem@...emloft.net, kuba@...nel.org, ast@...nel.org,
daniel@...earbox.net, netdev@...r.kernel.org, bpf@...r.kernel.org,
Rodrigo Madera <rodrigo.madera@...il.com>
Subject: Re: [PATCH net] net/bpfilter: initialize pos in
__bpfilter_process_sockopt
On Thu, Jul 30, 2020 at 06:09:00PM +0200, Christoph Hellwig wrote:
> __bpfilter_process_sockopt never initialized the pos variable passed to
> the pipe write. This has been mostly harmless in the past as pipes
> ignore the offset, but the switch to kernel_write no verified the
s/no/now/
> position, which can lead to a failure depending on the exact stack
> initialization patter. Initialize the variable to zero to make
s/patter/pattern/
> rw_verify_area happy.
>
> Fixes: 6955a76fbcd5 ("bpfilter: switch to kernel_write")
> Reported-by: Christian Brauner <christian.brauner@...ntu.com>
> Reported-by: Rodrigo Madera <rodrigo.madera@...il.com>
> Signed-off-by: Christoph Hellwig <hch@....de>
> Tested-by: Rodrigo Madera <rodrigo.madera@...il.com>
> ---
Thanks for tracking this down, Christoph! This fixes the logging issue
for me.
Tested-by: Christian Brauner <christian.brauner@...ntu.com>
Reviewed-by: Christian Brauner <christian.brauner@...ntu.com>
> net/bpfilter/bpfilter_kern.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/bpfilter/bpfilter_kern.c b/net/bpfilter/bpfilter_kern.c
> index 1905e01c3aa9a7..4494ea6056cdb8 100644
> --- a/net/bpfilter/bpfilter_kern.c
> +++ b/net/bpfilter/bpfilter_kern.c
> @@ -39,7 +39,7 @@ static int __bpfilter_process_sockopt(struct sock *sk, int optname,
> {
> struct mbox_request req;
> struct mbox_reply reply;
> - loff_t pos;
> + loff_t pos = 0;
> ssize_t n;
> int ret = -EFAULT;
>
> --
> 2.27.0
>
Powered by blists - more mailing lists