Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4232448ybb; Tue, 7 Apr 2020 03:29:19 -0700 (PDT) X-Google-Smtp-Source: APiQypKMT40bjwoJxBRLGixHOC9YH1oBWb03qMMdJ3T4c0CWA4H5UHAYN4jrNfKoRHGMBrUwyK7U X-Received: by 2002:a4a:9881:: with SMTP id a1mr1272634ooj.75.1586255359700; Tue, 07 Apr 2020 03:29:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586255359; cv=none; d=google.com; s=arc-20160816; b=MqyeRVhZLXv1Em3HYx7UaE/6dD6hf8HOfsPuehEqy3yotFa3DVnbG8nV7gaXHbyvsI 5xxaGI28+dBiX1dg+eQ338h1EThxHNOdFSaJFdmqr2jHjlNsW4YpydhxHwXTTwLuUKOL H4JCbrlzX6jUT0dd1EX0CDKYPSVnEWAubQEo45qQ04LNI921IZ3JQBPkfayXUsfRtvRR lmAVMrZm6Sv6DZb7n92fh/4yCc6343vIom6OXzdu8HccduEiCuYp6I7seDkb8YdXTyzJ pOTw7rGgkEVi4jwMOyuPU4DkjkQpcwxde4YGl1l7PgToFloY3Gc375TbmQM4p5dnPo5z r6rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hADqXe4ctCG29IkZvWzePJPHWhns/OTJYHNJxLpSwpQ=; b=cml2VbtB0LjJtZrSshkTufBJfQswyjpUahHjTm8kmvtw2qRIPUrftEKXCkfeRJxrcP xfDefD5+ncM5sLF0enolueJAaniGqF8eC8M17+zwg+o4O1MgAoM8dNtJvn14pdPHjt2C G5kHCcXrAgllrjAsx5gG/rhF0NHu65JO7SulL8mevmXQeip7cKcRCv4KcwNGglLWnMuY hrc+3ShmOcvcxLd0XWuPfUbZimDlGciuzW+64w4fUxZhnv6S2xgHx5ls9z2Ba1Vz8Lfk bA73zJ06p0qJsexTl+pObCjk5lPMpRDVtPU/0RXt3RAcoIMwLPyO7UdGat0E2GQ7fX5p SaAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lV4Ig1EW; 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 s18si1046404ooc.59.2020.04.07.03.29.07; Tue, 07 Apr 2020 03:29:19 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=lV4Ig1EW; 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 S1728615AbgDGKZg (ORCPT + 99 others); Tue, 7 Apr 2020 06:25:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:36196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728608AbgDGKZd (ORCPT ); Tue, 7 Apr 2020 06:25:33 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BC256207FF; Tue, 7 Apr 2020 10:25:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586255132; bh=3cR19qKiPaDwlXrsWSDSoSc5ShG6sGpNsCElSxC29fE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lV4Ig1EWzbFQPsi0tF3V8LkJvx1KK+tOu3yCzmgMdvw65CUsRnGFWdyaLUFfPRoUA RNWnDw0O969aDqVncbsIev3hWt7vcHl2OsHC5i3Ub/g7pX7y17Hqhya3Jh6uHSD3Mh T1UJRxHF8k+nL7tBUIfGW2fQ2RtPhnF25ORoaVHc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paolo Abeni , Jiri Pirko , "David S. Miller" Subject: [PATCH 5.5 43/46] net: genetlink: return the error code when attribute parsing fails. Date: Tue, 7 Apr 2020 12:22:14 +0200 Message-Id: <20200407101503.947995141@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200407101459.502593074@linuxfoundation.org> References: <20200407101459.502593074@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paolo Abeni commit 39f3b41aa7cae917f928ef9f31d09da28188e5ed upstream. Currently if attribute parsing fails and the genl family does not support parallel operation, the error code returned by __nlmsg_parse() is discarded by genl_family_rcv_msg_attrs_parse(). Be sure to report the error for all genl families. Fixes: c10e6cf85e7d ("net: genetlink: push attrbuf allocation and parsing to a separate function") Fixes: ab5b526da048 ("net: genetlink: always allocate separate attrs for dumpit ops") Signed-off-by: Paolo Abeni Reviewed-by: Jiri Pirko Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/netlink/genetlink.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -497,8 +497,9 @@ genl_family_rcv_msg_attrs_parse(const st err = __nlmsg_parse(nlh, hdrlen, attrbuf, family->maxattr, family->policy, validate, extack); - if (err && parallel) { - kfree(attrbuf); + if (err) { + if (parallel) + kfree(attrbuf); return ERR_PTR(err); } return attrbuf;