net: abort SO_DEVMEM_DONTNEED sooner
In case user provided wrong input, SO_DEVMEM_DONTNEED could
spin many times (2^32 or more) and lock cpu for many seconds.
Abort the loop immediately in case of an error.
Note the ABI does not report back number of pages that have
been released anyway, so tcpdirect never expected a failure there.
Test the unlikely() case first, to reduce indentation level
of the fast path.
Fixes: ac4a2b0ef821 ("PRODKERNEL: net-tcpdirect-fastrak: add SO_DEVMEM_DONTNEED setsockopt to release pages")
Tested: Ran syzbot repro
Reported-and-tested-by: syzbot+875fb850060d22c10eb2@syzkaller.appspotmail.com
Effort: net-tcpdirect-fastrak
Upstream-Plan: 232518966
Google-Bug-Id: 325732619
Signed-off-by: Eric Dumazet <edumazet@google.com>
Change-Id: I4c64ec56bd0ea65d030a9e817e64517dc01333a6
Reviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/65370
Reviewed-by: Mina Almasry <almasrymina@google.com>
Tested-by: Minh-Anh Nguyen <minhanhdn@google.com>
Reviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/65413
Reviewed-by: Oleksandr Tymoshenko <ovt@google.com>
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
1 file changed