From patchwork Mon Feb 20 10:32:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryder Lee X-Patchwork-Id: 9582477 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 794A260578 for ; Mon, 20 Feb 2017 10:33:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B2E3287E2 for ; Mon, 20 Feb 2017 10:33:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5FCA828851; Mon, 20 Feb 2017 10:33:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BC901287E2 for ; Mon, 20 Feb 2017 10:33:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=tq27D+n5Q5Giuel5IpoM7xgcGwf8rL6XpMW92CshKeY=; b=qE/5+w3IpHy5zl 2laXJ1k0QTM6vWNVd6+U2Yo9Z0pnEEOSr1j1jof69WMn1q+eNF4f3t7OR/LALbjkzmrMuvDEplWNj EsZ28DAiixvCLByUVhu8hViC4k41lnp0LcLoSHJaCdwnfMHKD7WlDyIYi2X4nDXO31fdDcyed1l5e JppY6EKOYcPfK5aDPtGYnmy2CI8TguSiPmZnHexCWoV81qNOlojIoKBGKxt+i75xJ5/XQeDBWik06 JWFsiupjhvOW8MoMz61YQkyrKwyGieqIj61pMDIN+6dhBso9nVic3jjBJ+ArcJ8rVzs1lBK3M85+9 H2X0UxeYK9qIRwd2syNA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cflHF-0002Ss-4V; Mon, 20 Feb 2017 10:33:05 +0000 Received: from [210.61.82.184] (helo=mailgw02.mediatek.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cflHB-0002D5-Lt for linux-mediatek@lists.infradead.org; Mon, 20 Feb 2017 10:33:03 +0000 Received: from mtkhts07.mediatek.inc [(172.21.101.69)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1873634317; Mon, 20 Feb 2017 18:32:36 +0800 Received: from mtkslt306.mediatek.inc (10.21.14.136) by mtkhts07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 14.3.266.1; Mon, 20 Feb 2017 18:32:35 +0800 From: Ryder Lee To: "David S. Miller" , Sabrina Dubroca Subject: [PATCH net-next v1] macsec: fix validation failed in asynchronous operation. Date: Mon, 20 Feb 2017 18:32:30 +0800 Message-ID: <1487586750-38377-1-git-send-email-ryder.lee@mediatek.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170220_023301_880316_A2902308 X-CRM114-Status: GOOD ( 11.63 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, Ryder Lee , linux-mediatek@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP MACSec test failed when asynchronous crypto operations is used. It encounters packet validation failed since macsec_skb_cb(skb)->valid is always 'false'. This patch adds missing "macsec_skb_cb(skb)->valid = true" in macsec_decrypt_done() when "err == 0". Signed-off-by: Ryder Lee --- Changes since v1: - add "err == 0" to check decrypt status drivers/net/macsec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index f83cf66..96b154e 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -879,6 +879,9 @@ static void macsec_decrypt_done(struct crypto_async_request *base, int err) aead_request_free(macsec_skb_cb(skb)->req); + if (err == 0) + macsec_skb_cb(skb)->valid = true; + rcu_read_lock_bh(); pn = ntohl(macsec_ethhdr(skb)->packet_number); if (!macsec_post_decrypt(skb, &macsec->secy, pn)) {