From patchwork Sun Apr 8 17:57:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Mueller X-Patchwork-Id: 10328455 X-Patchwork-Delegate: herbert@gondor.apana.org.au 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 D2B9160385 for ; Sun, 8 Apr 2018 18:03:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD97D2837E for ; Sun, 8 Apr 2018 18:03:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEF8F289AE; Sun, 8 Apr 2018 18:03:36 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 262122837E for ; Sun, 8 Apr 2018 18:03:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752468AbeDHSDe (ORCPT ); Sun, 8 Apr 2018 14:03:34 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.161]:26679 "EHLO mo4-p00-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752463AbeDHSDd (ORCPT ); Sun, 8 Apr 2018 14:03:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1523210612; s=strato-dkim-0002; d=chronox.de; h=Content-Type:Content-Transfer-Encoding:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:X-RZG-CLASS-ID:X-RZG-AUTH:From: Subject:Sender; bh=GTi9+KI92pW6Eu0UVeJ0IDAWRaTJwOlktNHZzr5H4Y8=; b=TKehlcptUiteVm9Wmh0qQmsOXhJ1FVuYtnQouysXdA9tgT3TY9U27EKsacPP4axd3q 3txyDiCCE0TToGSF06rxENfNq//qI9hlKUMxgd3RPZmGm1KYyBiBTNgvy38d17BxEp9O wh+n+tQ7yRY0xpxF+oqXUdwvlSZBXiARxsyVQdG35R3xmmx3FBgdLyDZ7cZyTDkjymA/ +FhKufLGDIvGlDex2BDpAey4lDXave3R1kYYTk/0YipKuXA93zmSXh64D5zrA0Kz4D1i bbI/IKA2smig94hsBg6cT1waJEKsQnNp5W4zlP7Co8kAgUzXEN9w4YKCeFOU+gtTfvAW UpvA== X-RZG-AUTH: :P2ERcEykfu11Y98lp/T7+hdri+uKZK8TKWEqNyiHySGSa9k9x2YdNp5Oujd5kpkCUA== X-RZG-CLASS-ID: mo00 Received: from positron.chronox.de ([88.128.81.87]) by smtp.strato.de (RZmta 43.1 DYNA|AUTH) with ESMTPSA id L0213fu38HvD6jz (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Sun, 8 Apr 2018 19:57:13 +0200 (CEST) From: Stephan =?ISO-8859-1?Q?M=FCller?= To: syzbot Cc: davem@davemloft.net, herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: [PATCH] AF_ALG: register completely initialized request in list Date: Sun, 08 Apr 2018 19:57:12 +0200 Message-ID: <3337259.MW9pfDCdka@positron.chronox.de> In-Reply-To: <00000000000092ad87056950ef9e@google.com> References: <00000000000092ad87056950ef9e@google.com> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, May I ask to check whether this patch fixes the issue? I cannot re-create the issue with the reproducter. Yet, as far as I understand, you try to induce errors which shall validate whether the error code paths are correct. The fix below should ensure this now. Thanks a lot. ---8<--- From 8f083e7b0684a9f91c186d7b46eec34e439689c3 Mon Sep 17 00:00:00 2001 From: Stephan Mueller Date: Sun, 8 Apr 2018 19:53:59 +0200 Subject: [PATCH] AF_ALG: Initialize sg_num_bytes in error code path The RX SGL in processing is already registered with the RX SGL tracking list to support proper cleanup. The cleanup code path uses the sg_num_bytes variable which must therefore be always initialized, even in the error code path. Signed-off-by: Stephan Mueller Reported-by: syzbot+9c251bdd09f83b92ba95@syzkaller.appspotmail.com --- crypto/af_alg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crypto/af_alg.c b/crypto/af_alg.c index c49766b03165..0d555c072669 100644 --- a/crypto/af_alg.c +++ b/crypto/af_alg.c @@ -1156,8 +1156,10 @@ int af_alg_get_rsgl(struct sock *sk, struct msghdr *msg, int flags, /* make one iovec available as scatterlist */ err = af_alg_make_sg(&rsgl->sgl, &msg->msg_iter, seglen); - if (err < 0) + if (err < 0) { + rsgl->sg_num_bytes = 0; return err; + } /* chain the new scatterlist with previous one */ if (areq->last_rsgl)