]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
bpfilter: Initialize pos variable
authorAlexei Starovoitov <ast@kernel.org>
Tue, 14 Jul 2020 19:31:45 +0000 (12:31 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:26:34 +0000 (08:26 +0200)
[ Upstream commit a4fa458950b40d3849946daa32466392811a3716 ]

Make sure 'pos' is initialized to zero before calling kernel_write().

Fixes: d2ba09c17a06 ("net: add skeleton of bpfilter kernel module")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bpfilter/bpfilter_kern.c

index 4494ea6056cdb81e189c4d6cf95209d182a9fc0d..42b88a92afe9521c9848ff7332d416a137d84ab7 100644 (file)
@@ -50,6 +50,7 @@ static int __bpfilter_process_sockopt(struct sock *sk, int optname,
        req.len = optlen;
        if (!bpfilter_ops.info.pid)
                goto out;
+       pos = 0;
        n = kernel_write(bpfilter_ops.info.pipe_to_umh, &req, sizeof(req),
                           &pos);
        if (n != sizeof(req)) {