[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOrHB_AgEXL4hrrZ5FCes2dQXMBUTA6NssvFDKs=uxjy=aOHwg@mail.gmail.com>
Date: Mon, 28 Nov 2016 21:15:52 -0800
From: Pravin Shelar <pshelar@....org>
To: Haishuang Yan <yanhaishuang@...s.chinamobile.com>
Cc: Pravin Shelar <pshelar@...ira.com>,
"David S. Miller" <davem@...emloft.net>,
Linux Kernel Network Developers <netdev@...r.kernel.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] openvswitch: add sanity check in queue_userspace_packet.
On Mon, Nov 28, 2016 at 8:36 PM, Haishuang Yan
<yanhaishuang@...s.chinamobile.com> wrote:
> kernel will crash in oops if genlmsg_put return NULL,
> so add the sanity check.
>
> Signed-off-by: Haishuang Yan <yanhaishuang@...s.chinamobile.com>
> ---
> net/openvswitch/datapath.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
> index 2d4c4d3..ceb1b1e 100644
> --- a/net/openvswitch/datapath.c
> +++ b/net/openvswitch/datapath.c
> @@ -474,6 +474,10 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
>
> upcall = genlmsg_put(user_skb, 0, 0, &dp_packet_genl_family,
> 0, upcall_info->cmd);
> + if (!upcall) {
> + err = -EMSGSIZE;
> + goto out;
> + }
user_skb has already enough space allocated, so there is no need to
check upcall pointer.
Powered by blists - more mailing lists