提交 cd84ca9f 编写于 作者: W Wang Yufen 提交者: Zheng Zengkai

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: NWang Yufen <wangyufen@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NLu Wei <luwei32@huawei.com>
Reviewed-by: NWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 75e388d7
...@@ -699,8 +699,6 @@ static int tcp_comp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, ...@@ -699,8 +699,6 @@ static int tcp_comp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
if (!ctx->rx.decompressed) { if (!ctx->rx.decompressed) {
err = tcp_comp_decompress(sk, skb); err = tcp_comp_decompress(sk, skb);
if (err < 0) { if (err < 0) {
if (err != -ENOSPC)
tcp_comp_err_abort(sk, EBADMSG);
goto recv_end; goto recv_end;
} }
ctx->rx.decompressed = true; ctx->rx.decompressed = true;
...@@ -734,6 +732,9 @@ bool comp_stream_read(const struct sock *sk) ...@@ -734,6 +732,9 @@ bool comp_stream_read(const struct sock *sk)
{ {
struct tcp_comp_context *ctx = comp_get_ctx(sk); struct tcp_comp_context *ctx = comp_get_ctx(sk);
if (!ctx)
return false;
if (ctx->rx.pkt) if (ctx->rx.pkt)
return true; return true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册