From patchwork Thu May 15 21:56:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rickard Strandqvist X-Patchwork-Id: 4186271 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D716EBFF02 for ; Thu, 15 May 2014 21:56:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2210A2011E for ; Thu, 15 May 2014 21:56:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F54520395 for ; Thu, 15 May 2014 21:56:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754721AbaEOVz4 (ORCPT ); Thu, 15 May 2014 17:55:56 -0400 Received: from mail-ee0-f46.google.com ([74.125.83.46]:56873 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751076AbaEOVzz (ORCPT ); Thu, 15 May 2014 17:55:55 -0400 Received: by mail-ee0-f46.google.com with SMTP id t10so1019458eei.33 for ; Thu, 15 May 2014 14:55:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-type:content-transfer-encoding; bh=67GJcmqTortJsLEr5QDuKSiUSIwO3rK4+iXS8K3JRnI=; b=Z06ezXV7zaUL94x4C3btdswoyjxvWXIj7M56cANB+1W09irvc2aVG3lS8/jkIacG/U g1z3++Ij+RLLVwSkBGz4z2tcZOmURVqqEIobq0PLfbVllcMw4eaLqjXcbA/lPhZDAVSC i2C3zNCajBZELinyb9ivDCaaWvVCShh77vtsLDGjI4USeMHNFU8UtAMleTcGIOIgq07l DRPRHp6Ig4aAG1LM9xsYD/mUyr8cx3QPyAkXo5AlHn+NSbUUd6N9l2u5Rz08WCB9tAj3 Fc08mCtQLZ6JVSvE0qW+wdLB/Us5yk6dFlGTGDLUOEYDVVy9s9LGn2RJkNRkUShBM0yW QHXg== X-Gm-Message-State: ALoCoQlBEoP0QKh44BbDMOKGgvhWov0KAK/lnSGEwn6cUmqFJrqp5CQDecwWNT8UUhsDEhNQZ+sX X-Received: by 10.14.215.9 with SMTP id d9mr7545308eep.64.1400190953966; Thu, 15 May 2014 14:55:53 -0700 (PDT) Received: from localhost.localdomain (h-245-62.a218.priv.bahnhof.se. [85.24.245.62]) by mx.google.com with ESMTPSA id b12sm3358429eeh.45.2014.05.15.14.55.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 May 2014 14:55:53 -0700 (PDT) From: Rickard Strandqvist To: "J. Bruce Fields" , Trond Myklebust Cc: Rickard Strandqvist , "David S. Miller" , linux-nfs@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: =?UTF-8?q?=5BPATCH=5D=20Fix=20for=20possible=20null=20pointer=20dereference=20in=20auth=2Ec?= Date: Thu, 15 May 2014 23:56:38 +0200 Message-Id: <1400190998-28153-1-git-send-email-rickard_strandqvist@spectrumdigital.se> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 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.5 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 There is otherwise a risk of a possible null pointer dereference. Was largely found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist --- net/sunrpc/auth.c | 10 +++++++--- 1 fil ändrad, 7 tillägg(+), 3 borttagningar(-) diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 5285ead..3a55698 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c @@ -801,10 +801,14 @@ rpcauth_invalcred(struct rpc_task *task) { struct rpc_cred *cred = task->tk_rqstp->rq_cred; - dprintk("RPC: %5u invalidating %s cred %p\n", - task->tk_pid, cred->cr_auth->au_ops->au_name, cred); - if (cred) + if (cred) { + dprintk("RPC: %5u invalidating %s cred %p\n", + task->tk_pid, cred->cr_auth->au_ops->au_name, cred); + clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags); + } + else + dprintk("RPC: %5u invalidating is NULL\n", task->tk_pid); } int