Received: by 2002:aa6:c429:0:b029:98:93ff:f56f with SMTP id g9csp3389003lkq; Mon, 23 Nov 2020 04:34:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJzXYIo+m7xIJI0AS0OlQeoati4M8DN374ltbgvz5i9MwfiL756rvQEZLg3hDkxUPqTLlqIP X-Received: by 2002:a17:907:2631:: with SMTP id aq17mr33045365ejc.497.1606134869700; Mon, 23 Nov 2020 04:34:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606134869; cv=none; d=google.com; s=arc-20160816; b=JVUdElMtCFlc7Jhv8FcJcKQHZDibyqLt9WFEdh/GFzp+Q1H7JO+hOIrhaQTkg0d1pW S+RvOd+cL7rDF5XmucvoqtB9gAhwbgm4/knnoYllkWHJHSyoWbXKFnw5EvZFulm6uxO9 /uGq8r5R1rB9L13F1jw5txyyFTXsJ2+/i072rGR77NlkJmFt2/D0Nm98cJtZltPCUMUa AJGCdNB+rD4Y6fRVNDZ5T5kfHQ85QARc3AKiXK4J6ASrVXycEXdPZIObEeMSfV5YpFpU iNASN/0YoSybqheSMuz79xkxM21Qt1w+wzFWpwprQKZWWsU1wCGBieCcNFt+TgHD368t PSVw== 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=BvFnnRXHnprH7v6b0G45eT8ujTuh7rz4aJOFKeZoCLY=; b=sfLXxmKWwrqduhRiaxqFa6dKVHaZF161kVap+7hjNa6KHqybOVdgpLtD1gw95PL6mj +FYyXGRnYlmi7FGDlxkqhJ+8IzhAePFH7K97B1F58+BZ0DnBR2DIoVAL6s4HIGAtCesE V/k0c5P9BOH/O5yHc6THHlJ3RxFfb+9ToWobH063btiYEzBod4YZ3fXJrGN91gZjSYka tmlO+ghPgUg/FKV7HQ6XEeiw0n0kHFcc9OHCq3ixtQyC2zDbrYsTPvj3yMJiztn++8JO buDQMEV+OZAQe6DD8roda9s1/yDcRJL+kWCZSBKy7V13EhjgyO0VUfL4AHoRHskTnIPR E9uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="AV6Pl/aw"; 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 u11si6592746edj.59.2020.11.23.04.34.06; Mon, 23 Nov 2020 04:34:29 -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="AV6Pl/aw"; 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 S1730796AbgKWMa7 (ORCPT + 99 others); Mon, 23 Nov 2020 07:30:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:41818 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730784AbgKWMax (ORCPT ); Mon, 23 Nov 2020 07:30:53 -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 086B820781; Mon, 23 Nov 2020 12:30:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134653; bh=RNDdpvsr4AnaQ92wC0CyQ0rGz2EMONacs4D4j72Ur+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AV6Pl/awyqQllf7+v2zFLWIq58OUmbS9TC37np9zGSCl0JPpA2zh6x38v8/hffaOb D9O82NqdYUS707t6KwODmttJyuQlUm9yphtHfzhUiapJcI2aDzw1vPqteDSJybKpZS d/vjmxVxaWaTIAqUDww2j4mwQ0kSowxucePLNu/s= 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 4.19 05/91] inet_diag: Fix error path to cancel the meseage in inet_req_diag_fill() Date: Mon, 23 Nov 2020 13:21:25 +0100 Message-Id: <20201123121809.560228074@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121809.285416732@linuxfoundation.org> References: <20201123121809.285416732@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 @@ -392,8 +392,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;