From patchwork Tue Feb 21 09:40:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryder Lee X-Patchwork-Id: 9584165 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 BF0D2600C1 for ; Tue, 21 Feb 2017 09:41:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A592C288DD for ; Tue, 21 Feb 2017 09:41:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A2C9288E2; Tue, 21 Feb 2017 09:41:56 +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 7973D288DD for ; Tue, 21 Feb 2017 09:41:54 +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=rxyuH18+P818sgCUlAalKHBNkZD36nYzFcdW1b/ZxgQ=; b=e1UlNJUIDIYF9n u3sMxprMo9/oa1FtP2O21x76wnvjjQ87yzl/eAyPG0lSY4y0b0y3J9BibW6rfKiWJ5l04toI/XExE TjiJ63qHC13X2/9207e7n0pJB+o44YHxRr+L6K/KAd/Tuj0scZ8yKeX7cHJXy+t+b8PtJ5gIDiWjS RtvogJOMoXy8QAPCkcmtuh4+KutsAQgcmlKBBvIY4u6QD068tjUrZwsbQH5Cnca3JIkdgfFi2G6qv gjEQIAqUhuTbQReOBBNbLYaae94rGIOFZq9djTYTSOqjT4JR++t7U40exBuP5VNgqNqY1WGHmY5c2 NdYwqiRBJvI9AkZMM5rA==; 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 1cg6xF-0005p9-Lg; Tue, 21 Feb 2017 09:41:53 +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 1cg6wf-0005Xe-R6 for linux-mediatek@lists.infradead.org; Tue, 21 Feb 2017 09:41:20 +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 1033452164; Tue, 21 Feb 2017 17:40:49 +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; Tue, 21 Feb 2017 17:40:48 +0800 From: Ryder Lee To: "David S. Miller" , Sabrina Dubroca Subject: [PATCH net-next v2] macsec: fix validation failed in asynchronous operation. Date: Tue, 21 Feb 2017 17:40:45 +0800 Message-ID: <1487670045-54641-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-20170221_014118_225473_2FD696D7 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 v2: - fix indentation and replace "err == 0" with "!err". 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..899853a 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) + 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)) {