YueHaibing
10ceab64db
net/x25: Fix null-ptr-deref in x25_disconnect
...
commit 8999dc89497ab1c80d0718828e838c7cd5f6bffe upstream.
We should check null before do x25_neigh_put in x25_disconnect,
otherwise may cause null-ptr-deref like this:
#include <sys/socket.h>
#include <linux/x25.h>
int main() {
int sck_x25;
sck_x25 = socket(AF_X25, SOCK_SEQPACKET, 0);
close(sck_x25);
return 0;
}
BUG: kernel NULL pointer dereference, address: 00000000000000d8
CPU: 0 PID: 4817 Comm: t2 Not tainted 5.7.0-rc3+ #159
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-
RIP: 0010:x25_disconnect+0x91/0xe0
Call Trace:
x25_release+0x18a/0x1b0
__sock_release+0x3d/0xc0
sock_close+0x13/0x20
__fput+0x107/0x270
____fput+0x9/0x10
task_work_run+0x6d/0xb0
exit_to_usermode_loop+0x102/0x110
do_syscall_64+0x23c/0x260
entry_SYSCALL_64_after_hwframe+0x49/0xb3
Reported-by: syzbot+6db548b615e5aeefdce2@syzkaller.appspotmail.com
Fixes: 4becb7ee5b3d ("net/x25: Fix x25_neigh refcnt leak when x25 disconnect")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-08-21 11:01:50 +02:00
..
2020-01-29 10:24:22 +01:00
2020-08-21 11:01:48 +02:00
2020-01-12 11:24:27 +01:00
2019-12-21 10:41:45 +01:00
2019-04-27 09:34:40 +02:00
2020-07-31 16:44:06 +02:00
2020-05-20 08:15:29 +02:00
2020-06-20 10:24:14 +02:00
2020-06-03 08:16:45 +02:00
2019-05-08 07:19:07 +02:00
2019-07-10 09:55:33 +02:00
2020-06-03 08:16:41 +02:00
2020-07-31 16:44:06 +02:00
2018-09-19 22:47:15 +02:00
2020-05-20 08:15:30 +02:00
2019-12-05 15:35:12 +01:00
2018-07-22 14:27:39 +02:00
2020-04-13 10:32:53 +02:00
2020-01-12 11:24:19 +01:00
2020-04-24 07:59:02 +02:00
2020-03-20 09:07:39 +01:00
2020-07-31 16:44:06 +02:00
2020-07-31 16:44:07 +02:00
2017-05-25 15:44:41 +02:00
2018-09-15 09:43:01 +02:00
2020-01-29 10:24:26 +01:00
2019-04-17 08:36:44 +02:00
2019-09-16 08:19:32 +02:00
2020-07-22 09:10:47 +02:00
2016-09-10 23:12:53 -07:00
2019-06-22 08:17:22 +02:00
2020-07-22 09:10:47 +02:00
2020-07-31 16:44:01 +02:00
2018-09-09 20:01:19 +02:00
2020-05-20 08:15:30 +02:00
2016-10-20 11:23:08 -04:00
2020-07-09 09:35:57 +02:00
2020-05-20 08:15:39 +02:00
2020-07-22 09:10:48 +02:00
2020-05-02 17:23:08 +02:00
2020-03-20 09:07:40 +01:00
2019-12-21 10:42:23 +01:00
2020-01-29 10:24:35 +01:00
2019-03-23 13:19:44 +01:00
2020-06-03 08:16:29 +02:00
2020-08-21 11:01:49 +02:00
2020-01-12 11:24:23 +01:00
2019-04-03 06:24:14 +02:00
2020-07-31 16:44:06 +02:00
2020-06-30 15:38:37 -04:00
2020-06-30 15:38:39 -04:00
2018-04-29 11:32:02 +02:00
2020-06-30 15:38:45 -04:00
2016-10-19 10:58:04 -04:00
2020-05-20 08:15:30 +02:00
2019-11-28 18:28:28 +01:00
2020-06-11 09:22:21 +02:00
2020-03-20 09:07:57 +01:00
2020-08-21 11:01:50 +02:00
2020-06-03 08:16:44 +02:00
2019-01-09 16:16:41 +01:00
2020-05-27 16:42:00 +02:00
2016-10-06 09:52:23 -07:00