Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp833062pxu; Mon, 23 Nov 2020 05:27:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxStIwpJjxGP3G1itVjcr+Hbzvujcq0vVhGTI4nz/80Lnds+M2Z1o2fpARIBtNwl5HJFFVt X-Received: by 2002:a50:eb84:: with SMTP id y4mr7982340edr.319.1606138033155; Mon, 23 Nov 2020 05:27:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606138033; cv=none; d=google.com; s=arc-20160816; b=OkD5KE3D1FJ1C84PPEV7vK9+Tkvz4CHWDu0KRA+Rh1fJ7Wj2LUkE+J1DB4rAVRBLAA h8iyz84WQRdZLxu8F74br25NDFJs8ki3joZMpyynvHGW0EGiO24KGYaebbiiiclV1KNv vEKllFVzadpMhRdLiQ9xlsKo3RFjFCdUxRsInR3+dOWyRoRk/hTC3LeHhFZz7JYWwCWr fEabdAwontjRJ6OV+mEKKAIpKXDKXA9uYQ8WcaAusoWYfTOV1H/QbJrCbbpG0YQ10Dyy dSD2h4tNak/MgfO0f0Iycfpq60vYktxM3T5OlndbCLFaAvXUJuyJ0VWTDaIw4lmt28Tk ONSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+eJzTkcw7aBHDUAaFOho2fdVP8THBg0anyGpT0I49UE=; b=lwzdzY9hw+9p5pW8H4P1awQUfqNPdF9I4wKtuqWu+I7fdPcCSPz3GTgPluLSQ8iFQo hE0chVvmw+LBE33TzMqrjrYxtaB0CIMiRQyVtjSsSULhshBUZ9NuYnj+Jzy/uj1VU28V YEURE98xQJjKRuxrClXtLff9HRhJpdnNUhg7GD9tgkMRP9mHbfYXSC/Qad2OZhxQo9yV 9WZ4H51WPz48P/qVvpGpVgo4uVG4QIvQn4bEUOP+ov0y9ARJFfz5qNK9BbpJnNfuEfNH wrCruXco8zIgLz92NTqm3vImRdZJUFARoi/QxuCSpXVrQXWQbZk3p6eAm1k3s9pHmNVz 76XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pyuGSGxo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jt2si5160911ejb.552.2020.11.23.05.26.49; Mon, 23 Nov 2020 05:27:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pyuGSGxo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731421AbgKWMen (ORCPT + 99 others); Mon, 23 Nov 2020 07:34:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:46476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731413AbgKWMek (ORCPT ); Mon, 23 Nov 2020 07:34:40 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 165C120857; Mon, 23 Nov 2020 12:34:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134880; bh=0QUuYwQkWoMKYnKni8fZwZNkzY8pchoHHX125HGgVnc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pyuGSGxoqHPG2y2cP22ZMPNuCsw3a2QAPuFDrANPfV7iGYCU4QpbGsZNjt3DmPO5A IdDe2A3DABWuxidADFZ6cYzyXTs2hYkkzOP5kGCkk5BJD98vUlWkB2TAIRw1Ir/Sr0 nrA4QzhomDavUoHVZA3decJQsDq7gKtLDG4DcQRs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wang Hai , Jakub Kicinski Subject: [PATCH 5.4 006/158] inet_diag: Fix error path to cancel the meseage in inet_req_diag_fill() Date: Mon, 23 Nov 2020 13:20:34 +0100 Message-Id: <20201123121820.251426365@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121819.943135899@linuxfoundation.org> References: <20201123121819.943135899@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wang Hai [ Upstream commit e33de7c5317e2827b2ba6fd120a505e9eb727b05 ] nlmsg_cancel() needs to be called in the error path of inet_req_diag_fill to cancel the message. Fixes: d545caca827b ("net: inet: diag: expose the socket mark to privileged processes.") Reported-by: Hulk Robot Signed-off-by: Wang Hai Link: https://lore.kernel.org/r/20201116082018.16496-1-wanghai38@huawei.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv4/inet_diag.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c @@ -388,8 +388,10 @@ static int inet_req_diag_fill(struct soc r->idiag_inode = 0; if (net_admin && nla_put_u32(skb, INET_DIAG_MARK, - inet_rsk(reqsk)->ir_mark)) + inet_rsk(reqsk)->ir_mark)) { + nlmsg_cancel(skb, nlh); return -EMSGSIZE; + } nlmsg_end(skb, nlh); return 0;