Skip to content

Commit 4f01024

Browse files
Christoph Hellwigborkmann
authored andcommitted
net/bpfilter: Initialize pos in __bpfilter_process_sockopt
__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 now verified the position, which can lead to a failure depending on the exact stack initialization pattern. Initialize the variable to zero to make rw_verify_area happy. Fixes: 6955a76 ("bpfilter: switch to kernel_write") Reported-by: Christian Brauner <[email protected]> Reported-by: Rodrigo Madera <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Tested-by: Rodrigo Madera <[email protected]> Tested-by: Christian Brauner <[email protected]> Reviewed-by: Christian Brauner <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 0ba5834 commit 4f01024

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/bpfilter/bpfilter_kern.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static int __bpfilter_process_sockopt(struct sock *sk, int optname,
3939
{
4040
struct mbox_request req;
4141
struct mbox_reply reply;
42-
loff_t pos;
42+
loff_t pos = 0;
4343
ssize_t n;
4444
int ret = -EFAULT;
4545

0 commit comments

Comments
 (0)