]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
sctp: free cmd->obj.chunk for the unprocessed SCTP_CMD_REPLY
authorXin Long <lucien.xin@gmail.com>
Sat, 4 Jan 2020 06:15:02 +0000 (14:15 +0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
commit7c9535f3d11eeeb1fd5895469dc605843b1b4a75
treee006da4f1faf5627bd93a6501c86a48de5f1f5e7
parentc817b7dc8a9832dd4170bf883cb66219107c8a6c
sctp: free cmd->obj.chunk for the unprocessed SCTP_CMD_REPLY

BugLink: https://bugs.launchpad.net/bugs/1861739
[ Upstream commit be7a7729207797476b6666f046d765bdf9630407 ]

This patch is to fix a memleak caused by no place to free cmd->obj.chunk
for the unprocessed SCTP_CMD_REPLY. This issue occurs when failing to
process a cmd while there're still SCTP_CMD_REPLY cmds on the cmd seq
with an allocated chunk in cmd->obj.chunk.

So fix it by freeing cmd->obj.chunk for each SCTP_CMD_REPLY cmd left on
the cmd seq when any cmd returns error. While at it, also remove 'nomem'
label.

Reported-by: syzbot+107c4aff5f392bf1517f@syzkaller.appspotmail.com
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/sctp/sm_sideeffect.c