mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "D. Wythe" <alibuda@linux.alibaba.com>
To: Qianqiang Liu <qianqiang.liu@163.com>,
	xiyou.wangcong@gmail.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: check the return value of the copy_from_sockptr
Date: Wed, 11 Sep 2024 14:51:48 +0800	[thread overview]
Message-ID: <18f0012c-c7b6-410f-9c48-74419c8f7de4@linux.alibaba.com> (raw)
In-Reply-To: <20240911050435.53156-1-qianqiang.liu@163.com>



On 9/11/24 1:04 PM, Qianqiang Liu wrote:
> We must check the return value of the copy_from_sockptr. Otherwise, it
> may cause some weird issues.
>
> Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com>
> ---
>   net/socket.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)

Looks like a fix patch, maybe you could add a fix tag.

> diff --git a/net/socket.c b/net/socket.c
> index 0a2bd22ec105..6b9a414d01d5 100644
> --- a/net/socket.c
> +++ b/net/socket.c
> @@ -2370,8 +2370,11 @@ int do_sock_getsockopt(struct socket *sock, bool compat, int level,
>   	if (err)
>   		return err;
>   
> -	if (!compat)
> -		copy_from_sockptr(&max_optlen, optlen, sizeof(int));
> +	if (!compat) {
> +		err = copy_from_sockptr(&max_optlen, optlen, sizeof(int));
> +		if (err)
> +			return -EFAULT;
> +	}
>   
>   	ops = READ_ONCE(sock->ops);
>   	if (level == SOL_SOCKET) {






  reply	other threads:[~2024-09-11  6:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-11  5:04 Qianqiang Liu
2024-09-11  6:51 ` D. Wythe [this message]
2024-09-11  7:13 ` Eric Dumazet
2024-09-11  8:23   ` Qianqiang Liu
2024-09-11  9:12     ` Eric Dumazet
2024-09-11 10:24       ` Qianqiang Liu
2024-09-11 12:40         ` Eric Dumazet
2024-09-11 16:58       ` Cong Wang
2024-09-11 17:15         ` Eric Dumazet
2024-09-11 17:35           ` Cong Wang
2024-09-11 18:49             ` Stanislav Fomichev
2024-09-11 19:48               ` Cong Wang
2024-09-11 20:05                 ` Stanislav Fomichev
2024-09-14  0:49                   ` Cong Wang
2024-09-14 18:01                     ` Stanislav Fomichev
2024-09-18 13:11 ` David Laight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18f0012c-c7b6-410f-9c48-74419c8f7de4@linux.alibaba.com \
    --to=alibuda@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=qianqiang.liu@163.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®