From patchwork Sun Apr 3 01:09:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herbert Xu X-Patchwork-Id: 8732651 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4F4D29F44D for ; Sun, 3 Apr 2016 01:10:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2A81620218 for ; Sun, 3 Apr 2016 01:10:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B469E20211 for ; Sun, 3 Apr 2016 01:09:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751970AbcDCBJ5 (ORCPT ); Sat, 2 Apr 2016 21:09:57 -0400 Received: from helcar.hengli.com.au ([209.40.204.226]:51486 "EHLO helcar.hengli.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750833AbcDCBJ5 (ORCPT ); Sat, 2 Apr 2016 21:09:57 -0400 Received: from gondolin.me.apana.org.au ([192.168.0.6]) by norbury.hengli.com.au with esmtp (Exim 4.80 #3 (Debian)) id 1amWY6-0005P7-2x; Sun, 03 Apr 2016 11:09:54 +1000 Received: from herbert by gondolin.me.apana.org.au with local (Exim 4.80) (envelope-from ) id 1amWY5-0006ix-4m; Sun, 03 Apr 2016 09:09:53 +0800 Date: Sun, 3 Apr 2016 09:09:52 +0800 From: Herbert Xu To: "J. Bruce Fields" Cc: linux-nfs@vger.kernel.org, linux-crypto@vger.kernel.org Subject: Re: nfs/krb5 crash on 4.6-rc1 Message-ID: <20160403010952.GA25687@gondor.apana.org.au> References: <20160403001319.GB12588@fieldses.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160403001319.GB12588@fieldses.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Sat, Apr 02, 2016 at 08:13:19PM -0400, J. Bruce Fields wrote: > As of 3b5cf20c "sunrpc: Use skcipher and ahash/shash", I get a NULL > dereference in krb5_encrypt on an NFS server when a client attempts to > mount using krb5. I haven't tried to figure out what's going on beyond > that.... Oops, looks like I missed a couple of set_tfm calls. ---8<-- Subject: sunrpc: Add missing skcipher_request_set_tfm calls A couple of skcipher_request users were missing set_tfm calls which leads to a crash when they are called. Fixes: 3b5cf20cf439 ("sunrpc: Use skcipher and ahash/shash") Reported-by: J. Bruce Fields Signed-off-by: Herbert Xu diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c index d94a8e1..ccc59aa 100644 --- a/net/sunrpc/auth_gss/gss_krb5_crypto.c +++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c @@ -78,6 +78,7 @@ krb5_encrypt( memcpy(out, in, length); sg_init_one(sg, out, length); + skcipher_request_set_tfm(req, tfm); skcipher_request_set_callback(req, 0, NULL, NULL); skcipher_request_set_crypt(req, sg, sg, length, local_iv); @@ -115,6 +116,7 @@ krb5_decrypt( memcpy(out, in, length); sg_init_one(sg, out, length); + skcipher_request_set_tfm(req, tfm); skcipher_request_set_callback(req, 0, NULL, NULL); skcipher_request_set_crypt(req, sg, sg, length, local_iv);