]> git.baikalelectronics.ru Git - kernel.git/commit
s390/qeth: fix length check in SNMP processing
authorJulian Wiedmann <jwi@linux.ibm.com>
Wed, 28 Nov 2018 15:20:50 +0000 (16:20 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 28 Nov 2018 19:16:54 +0000 (11:16 -0800)
commit8240d65343ecd157c9a5f36275c97dc05d0a1d41
tree2af9ac65e1285e7883a3b3d2a7877c416fed00d5
parentd7d7679a640998257b0331a2e8acb7f48a90d24a
s390/qeth: fix length check in SNMP processing

The response for a SNMP request can consist of multiple parts, which
the cmd callback stages into a kernel buffer until all parts have been
received. If the callback detects that the staging buffer provides
insufficient space, it bails out with error.
This processing is buggy for the first part of the response - while it
initially checks for a length of 'data_len', it later copies an
additional amount of 'offsetof(struct qeth_snmp_cmd, data)' bytes.

Fix the calculation of 'data_len' for the first part of the response.
This also nicely cleans up the memcpy code.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/s390/net/qeth_core_main.c