Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1166941ybi; Fri, 2 Aug 2019 10:24:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGNT1akfJU570lcW/9RagUBuaiBqXO9PFZO3j7xm+/HCRo6vpDX7uJFkK6SvBB2J8z7IJI X-Received: by 2002:a17:902:2bc5:: with SMTP id l63mr136757283plb.30.1564766643646; Fri, 02 Aug 2019 10:24:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564766643; cv=none; d=google.com; s=arc-20160816; b=NsPljozTYdtjIVsLUESfeSGzEg72bh+LD02qWSulja42VdS41TXBmjrAQYIOsVAx3f HrBlToHOS0gYxqyqjPS67UxSprzzScuubw8RCfSz4fArSVtvUI5howM0r3pilkHV4h+9 RsLy2KM+zIYIjcKh9iVSmhvz0TyFgKdb8skud6Kwkh65eZvd9ofRBmp+R6MFmDMrYY9V Z4m+wp3j8LVo9lj2daoN58o0WoyHorKb5s0i7GgRxzxbfCOYW5gpNYuiNIIxdlaal8F7 Hp28gKDItxUBo1IPHAm/OZR8H/5Y7hdRTz45tkFt3b6bv0HGznrpsKYkhlImuA40Lh+A 1s/g== 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=hGYs8kp3La/3/HoEMqD7t8j2rp2xEfuwRN8Mpmg59CY=; b=OmJHzNqk0GphaIupFw/DML6Y+xDP5os5f9NjdHZw441BzezdajbSckkB5AV/1C9w0F jmJPVzq8jWv7pQyT5Qp1KoSAFpQkSDA9/i5bbkZWRF3H5DsQMZB38AliB+mRJN7j8kPl cQk/ecNS50/+aAyK7nmP9iCLxfKyBKC2JLjTVXoFUyo7cD+hK0z6og792pj+Y7jG5wK6 P0U3E1k21QuwF30fLTz/xWFL49WWVGseyPAjk0pFayY5ArYRm/o+W2miQ7SqqzIQFypA O9SLwGfExOlmRcdxbBbuFOi9aWzj/ttVhTDhvKKUEV+G7LyiDR6ycqRrE+USrxdXLam+ mq4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qHd2PW6t; 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 l186si38200750pge.215.2019.08.02.10.23.48; Fri, 02 Aug 2019 10:24:03 -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=qHd2PW6t; 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 S2405544AbfHBJqU (ORCPT + 99 others); Fri, 2 Aug 2019 05:46:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:50432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405487AbfHBJqQ (ORCPT ); Fri, 2 Aug 2019 05:46:16 -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 0002B216C8; Fri, 2 Aug 2019 09:46:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564739175; bh=5pXf1QQkdAsQE0c2Gh3X5otJETN860PSkXY/eB1K56M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qHd2PW6t5U+bc3ahNaPTMLISejBRkQDsG2CG3K5iWRxEejMhz85YLe+j/Qnbi5ewS sMSayFSsN2EAeGCSGjA9f4c+DQyS6VwgXILXJPFjJKF12BRCC1Ur/+yiZGXbl3u32i M8vxP0C9EdbufWHimlytjf2lTB77yfRy4U9oaIh8= 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.9 142/223] macsec: fix use-after-free of skb during RX Date: Fri, 2 Aug 2019 11:36:07 +0200 Message-Id: <20190802092247.893113264@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802092238.692035242@linuxfoundation.org> References: <20190802092238.692035242@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 @@ -1105,10 +1105,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) {