From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754326AbbFKW7m (ORCPT ); Thu, 11 Jun 2015 18:59:42 -0400 Received: from mga14.intel.com ([192.55.52.115]:17315 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751399AbbFKW7k (ORCPT ); Thu, 11 Jun 2015 18:59:40 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,598,1427785200"; d="scan'208";a="745232663" Message-ID: <557A12D1.90409@intel.com> Date: Thu, 11 Jun 2015 15:59:29 -0700 From: Tadeusz Struk User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Stephan Mueller CC: "'Herbert Xu" , "'Quentin Gouchet'" , Daniel Borkmann , linux-api@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v13 1/2] crypto: AF_ALG: add AEAD support References: <2180298.gqj58NYuqx@tachyon.chronox.de> <14853152.iudhcNpbrH@tachyon.chronox.de> In-Reply-To: <14853152.iudhcNpbrH@tachyon.chronox.de> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Stephan, On 02/28/2015 11:50 AM, Stephan Mueller wrote: > + err = af_alg_wait_for_completion(ctx->enc ? > + crypto_aead_encrypt(&ctx->aead_req) : > + crypto_aead_decrypt(&ctx->aead_req), > + &ctx->completion); > + > + if (err) { > + /* EBADMSG implies a valid cipher operation took place */ > + if (err == -EBADMSG) > + aead_put_sgl(sk); > + goto unlock; Shouldn't we free the TX sgl regardless of the error was? Or do we expect that the user will try to read again and it will be Ok the second time? Hope you still remember :) > + } > + > + aead_put_sgl(sk); > + > + err = 0; > + > +unlock: > + for (i = 0; i < cnt; i++) > + af_alg_free_sg(&ctx->rsgl[i]); > + > + aead_wmem_wakeup(sk); > + release_sock(sk); > + > + return err ? err : outlen; > +}