Commit cd84ca9f authored by Wang Yufen's avatar Wang Yufen Committed by Zheng Zengkai
Browse files

tcp_comp: Avoiding the null pointer problem of ctx in comp_stream_read

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I45UYC?from=project-issue


CVE: NA

-------------------------------------------------

In comp_stream_read ctx might be null, add null check to avoid oops. And delete
unnecessary tcp_comp_err_abort.

Signed-off-by: default avatarWang Yufen <wangyufen@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarLu Wei <luwei32@huawei.com>
Reviewed-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 75e388d7
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -699,8 +699,6 @@ static int tcp_comp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
		if (!ctx->rx.decompressed) {
			err = tcp_comp_decompress(sk, skb);
			if (err < 0) {
				if (err != -ENOSPC)
					tcp_comp_err_abort(sk, EBADMSG);
				goto recv_end;
			}
			ctx->rx.decompressed = true;
@@ -734,6 +732,9 @@ bool comp_stream_read(const struct sock *sk)
{
	struct tcp_comp_context *ctx = comp_get_ctx(sk);

	if (!ctx)
		return false;

	if (ctx->rx.pkt)
		return true;