Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3786089ybi; Mon, 29 Jul 2019 12:35:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqzf3P82rrnYrBRY6uZhobZfHqqbxh2CrtZt7YzVFTRg01uFPQ+fU2b+BJLi9ZP9BgqyJ0FR X-Received: by 2002:a17:902:9a85:: with SMTP id w5mr111687870plp.221.1564428936013; Mon, 29 Jul 2019 12:35:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564428936; cv=none; d=google.com; s=arc-20160816; b=AJkqq1M+IawheMBM5yjiqknTrE2iV1bR14hsgsktssbkAz8AbxvNV5QKqKO8MGTunM gZjCFErGg2MXKXcYprj5zuqZvLLkMIdyqZmr6QenJ1HPQGINMAkyq98fXms3hUZgr/+1 CYqDQK6AlBHm+aBMvtBrYC2pnoNaDJ+zgOX4MpBBw/S15M0OOifQegCfvqkHkp0fspIj qFvGN/IkWwhaRoKRRH2oJD3O3yBFNTWLNO743VG++MSifPKdQ3vvKAUupqBIrSZaQJyg MpxontEvt4ll0QWybx276bEJywK/CW6Zilq8WKjY51eySC3POxsSLMsgWN8TufdFWN/H /t8g== 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=pFxGTRvTht/VBYqWkhRvQmipDlRusNFedAf00c6/ONI=; b=XJA5FYdtzABhnN08IS4cwSI28kh4nBin1qa0UpbXQuwKrmK19UmF2ln21axJuPbGnB CrYKLbTDtm0CAQEXXoGNp/YCT7RmkrwZ7SC+vf0a5dlY32bWHPuBhMw/9hEc0fxf9yw/ XnoKEBwAaN6JbWibm8XOA5xM/wg7zdvVDQZcmvI7tySnFhxdNIbF3Yjb5SI7oTh6AFwb qq+WoHvWaMUUi5bRJmsutcilDnCyC8liba4MPlc95Q/a8OgRwe1Kq6FSbfA8HyenTatH q04tVSHv5V6O9P+6Rkgf5jhH1S7ysSaVp48YymUZlp20izSAa8ajcvyFJHmhUxLZpBpz HpfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="vGru/Li2"; 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 r190si27186009pfr.102.2019.07.29.12.35.21; Mon, 29 Jul 2019 12:35:36 -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="vGru/Li2"; 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 S1729230AbfG2Tde (ORCPT + 99 others); Mon, 29 Jul 2019 15:33:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:47678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729096AbfG2Tdb (ORCPT ); Mon, 29 Jul 2019 15:33:31 -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 AB3162070B; Mon, 29 Jul 2019 19:33:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428810; bh=4H05V33b22NBKbavxlsFHLdxSESXPpMrppj84sOSSIE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vGru/Li2f9/xp0jYxVo0v00xz7B0T5lx/dP+LRjxqAFeI6FpkuYwJdycWOxlr8b9Q tUBTOjm0vOLvlno58ERLaTVrfFapUDGlhnBRO3mW6sPUvH9/P7yglnAV8FrKSWYbhk vPtCnBTjwdCShBdC8q31G2ZwFSeOqeB8Wunhm7AI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Steinmetz , Willem de Bruijn , "David S. Miller" Subject: [PATCH 4.14 194/293] macsec: fix use-after-free of skb during RX Date: Mon, 29 Jul 2019 21:21:25 +0200 Message-Id: <20190729190839.332167533@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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: Andreas Steinmetz [ Upstream commit 095c02da80a41cf6d311c504d8955d6d1c2add10 ] Fix use-after-free of skb when rx_handler returns RX_HANDLER_PASS. Signed-off-by: Andreas Steinmetz Acked-by: Willem de Bruijn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/macsec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -1099,10 +1099,9 @@ static rx_handler_result_t macsec_handle } skb = skb_unshare(skb, GFP_ATOMIC); - if (!skb) { - *pskb = NULL; + *pskb = skb; + if (!skb) return RX_HANDLER_CONSUMED; - } pulled_sci = pskb_may_pull(skb, macsec_extra_len(true)); if (!pulled_sci) {