Received: by 10.223.164.202 with SMTP id h10csp268199wrb; Thu, 9 Nov 2017 06:08:08 -0800 (PST) X-Google-Smtp-Source: ABhQp+QyWF6//ag0h6ifwpjohmEJH9y7h8NVjjX3qjsudoo6oAYKylCCCI7MaK5VDzi97iraKFyi X-Received: by 10.98.68.8 with SMTP id r8mr603307pfa.161.1510236488287; Thu, 09 Nov 2017 06:08:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510236488; cv=none; d=google.com; s=arc-20160816; b=INDOb67JDn2XkqBnW1WYenbFWkgxYxXN8C33bJCAiOHuWKUyVDUftMUU1MoRkf3YDu mYpCj1kU9wZyHgL2UVu643ci3kJAlFtbDEM87Uz4bCTtyVu0so26eSK+Tb2B0F50KkAG OUW1M48sMmuYjBRCBZO/w0Rqpxzfsi1XKdzoyBOHYbq/Nrq7p1vNrmcMD7u/esZWIpK2 Uf7oqDY3EFXDzvnYtsFYtEpQy5qTWQ9r9QXyDP7g8bTy3ZeWnVITSIIXcb/3pZ8uiFts WhmaNCmPw6IR49/0izwMUOQripRcGtbEivQK4PIzQcqZMAWUKYau1Qyoebo1EE0nNW64 69jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:arc-authentication-results; bh=BBviyztUIYALxCbpqFuIwf1SNrruu+AL/1MfFseiHFs=; b=tpPZMFiluzQNqpCnGzGOt+s6VJVri8988aRCtO/3hD1LyO5+ky2UAYtajVtlGL8L+c 9T5JRXI5hl5BohO6IKd5vdaRYyi8QC8xvZUUFG9/cX6o3+kV11nPOYIBsLbNWKNQzHaC CFy+MALxZZgHFuf0lZ0baVelGrGbxIJ8NuGQsfMJfOW17C3TMorCbW4vN0JAZQYqeNYh gZolHk1As7iky35eytDCm0DJHl/CatVg054aVqGCpx4eBqMbedX6+J6INQZo7gOUXm8v XcWAp/jdxeGaZM2Lhn486UjWQb1x1/hKZWFDzddda5JBckOSoKx1R/88qC02dUTQ0xfh n/rA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q3si6378644pgf.680.2017.11.09.06.07.56; Thu, 09 Nov 2017 06:08:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754793AbdKIOGr (ORCPT + 80 others); Thu, 9 Nov 2017 09:06:47 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:55672 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751128AbdKIOGq (ORCPT ); Thu, 9 Nov 2017 09:06:46 -0500 X-Originating-IP: 74.125.82.47 Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) (Authenticated sender: pshelar@ovn.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 4D7BC17209B; Thu, 9 Nov 2017 15:06:44 +0100 (CET) Received: by mail-wm0-f47.google.com with SMTP id n74so2353887wmi.1; Thu, 09 Nov 2017 06:06:44 -0800 (PST) X-Gm-Message-State: AJaThX6PiN5/U/KqoEdOnHLqT2ZSwX8whh4rwuXzesH1JgMRJaJnArFW KRjMmODlssPvq8obs/2fvovHAYY+qY1XQGINX3A= X-Received: by 10.28.21.4 with SMTP id 4mr446965wmv.84.1510236403858; Thu, 09 Nov 2017 06:06:43 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.130.72 with HTTP; Thu, 9 Nov 2017 06:06:43 -0800 (PST) In-Reply-To: <20171109135943.418-1-colin.king@canonical.com> References: <20171109135943.418-1-colin.king@canonical.com> From: Pravin Shelar Date: Thu, 9 Nov 2017 19:36:43 +0530 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [ovs-dev] [PATCH] openvswitch: add null pointer check on upcall To: Colin King Cc: Pravin Shelar , "David S . Miller" , Linux Kernel Network Developers , ovs dev , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 9, 2017 at 7:29 PM, Colin King wrote: > From: Colin Ian King > > upcall may be assigned a NULL pointer as genlmsg_put can potentially > return a NULL. Add a null check to avoid a null pointer dereference > on upcall. > > Detected by CoverityScan, CID#728404 ("Dereference null return value") > > Fixes: commit ccb1352e76cf ("net: Add Open vSwitch kernel components.") > Signed-off-by: Colin Ian King > --- > net/openvswitch/datapath.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c > index 4d38ac044cee..e8fb3d76fa6e 100644 > --- a/net/openvswitch/datapath.c > +++ b/net/openvswitch/datapath.c > @@ -461,6 +461,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 = -ENOBUFS; > + goto out; > + } user_skb is allocated according to all required attributes, so genlmsg_put() can not return null value. > upcall->dp_ifindex = dp_ifindex; > > err = ovs_nla_put_key(key, key, OVS_PACKET_ATTR_KEY, false, user_skb); > -- > 2.14.1 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev From 1583597262146487208@xxx Thu Nov 09 14:00:36 +0000 2017 X-GM-THRID: 1583597262146487208 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread