sctp: return next obj by passing pos + 1 into sctp_transport_get_idx
Xin Long authored
[ Upstream commit 988c7322 ]

In sctp_for_each_transport, pos is used to save how many objs it has
dumped. Now it gets the last obj by sctp_transport_get_idx, then gets
the next obj by sctp_transport_get_next.

The issue is that in the meanwhile if some objs in transport hashtable
are removed and the objs nums are less than pos, sctp_transport_get_idx
would return NULL and hti.walker.tbl is NULL as well. At this moment
it should stop hti, instead of continue getting the next obj. Or it
would cause a NULL pointer dereference in sctp_transport_get_next.

This patch is to pass pos + 1 into sctp_transport_get_idx to get the
next obj directly, even if pos > objs nums, it would return NULL and
stop hti.

Fixes: 626d16f5

 ("sctp: export some apis or variables for sctp_diag and reuse some for proc")
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-b...
eb0d418f
Name Last commit Last update
Documentation mm: larger stack guard gap, between vmas
arch arm64/vdso: Fix nsec handling for CLOCK_MONOTONIC_RAW
block partitions/msdos: FreeBSD UFS2 file systems are not recognized
certs certs: Add a secondary system keyring that can be added to dynamically
crypto crypto: gcm - wait for crypto op not signal safe
drivers qmi_wwan: new Telewell and Sierra device IDs
firmware WHENCE: use https://linuxtv.org for LinuxTV URLs
fs CIFS: Fix some return values in case of error in 'crypt_message'
include net: ipv6: Release route when device is unregistering
init initramfs: avoid "label at end of compound statement" error
ipc Merge branch 'WIP.sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
kernel time: Fix CLOCK_MONOTONIC_RAW sub-nanosecond accounting
lib lib/cmdline.c: fix get_options() overflow while parsing ranges
mm mm: fix new crash in unmapped_area_topdown()
net sctp: return next obj by passing pos + 1 into sctp_transport_get_idx
samples statx: Include a mask for stx_attributes in struct statx
scripts Merge tag 'kbuild-fixes-v4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
security selinux: fix double free in selinux_parse_opts_str()
sound ALSA: hda - Apply quirks to Broxton-T, too
tools perf probe: Fix probe definition for inlined functions
usr kbuild: initramfs cleanup, set target from Kconfig
virt KVM: arm/arm64: vgic-v3: Do not use Active+Pending state for a HW interrupt
.cocciconfig scripts: add Linux .cocciconfig for coccinelle
.get_maintainer.ignore Add hch to .get_maintainer.ignore
.gitattributes .gitattributes: set git diff driver for C source code files
.gitignore Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
.mailmap mailmap: add Martin Kepplinger's email
COPYING [PATCH] update FSF address in COPYING
CREDITS MAINTAINERS: Remove old e-mail address
Kbuild scripts/gdb: provide linux constants
Kconfig kbuild: migrate all arch to the kconfig mainmenu upgrade
MAINTAINERS bpf, doc: update bpf maintainers entry
Makefile Linux 4.11.8
README README: add a new README file, pointing to the Documentation/
Linux kernel
============

This file was moved to Documentation/admin-guide/README.rst

Please notice that there are several guides for kernel developers and users.
These guides can be rendered in a number of formats, like HTML and PDF.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.
See Documentation/00-INDEX for a list of what is contained in each file.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.