From patchwork Wed Jul 8 06:27:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neelesh Gupta X-Patchwork-Id: 492738 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2C9F9140770 for ; Wed, 8 Jul 2015 16:29:25 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 12DC91A1C10 for ; Wed, 8 Jul 2015 16:29:25 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id C3E691A18FA for ; Wed, 8 Jul 2015 16:28:30 +1000 (AEST) Received: by ozlabs.org (Postfix) id ADB2F140D19; Wed, 8 Jul 2015 16:28:30 +1000 (AEST) Delivered-To: linuxppc-dev@ozlabs.org Received: from e23smtp07.au.ibm.com (e23smtp07.au.ibm.com [202.81.31.140]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8ACE0140B0E for ; Wed, 8 Jul 2015 16:28:30 +1000 (AEST) Received: from /spool/local by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 8 Jul 2015 16:28:30 +1000 Received: from d23dlp01.au.ibm.com (202.81.31.203) by e23smtp07.au.ibm.com (202.81.31.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 8 Jul 2015 16:28:27 +1000 X-Helo: d23dlp01.au.ibm.com X-MailFrom: neelegup@linux.vnet.ibm.com X-RcptTo: linuxppc-dev@ozlabs.org Received: from d23relay07.au.ibm.com (d23relay07.au.ibm.com [9.190.26.37]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 4F4F12CE8055; Wed, 8 Jul 2015 16:28:27 +1000 (EST) Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay07.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t686SKbn58851498; Wed, 8 Jul 2015 16:28:28 +1000 Received: from d23av02.au.ibm.com (localhost [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t686Rsa7027385; Wed, 8 Jul 2015 16:27:54 +1000 Received: from localhost.localdomain (dhcp-9-193-66-55.in.ibm.com [9.193.66.55]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t686RrOn026817; Wed, 8 Jul 2015 16:27:53 +1000 Subject: [PATCH] ipmi/powernv: Fix a minor bug From: Neelesh Gupta To: linuxppc-dev@ozlabs.org, jk@ozlabs.org Date: Wed, 08 Jul 2015 11:57:28 +0530 Message-ID: <20150708062702.11242.47257.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15070806-0025-0000-0000-000001BF28AE X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: neelegup@linux.vnet.ibm.com Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" If the OPAL call to receive the ipmi message fails, then we free up the smi message before returning. But, the driver still holds the reference to old smi message in the 'cur_msg' which is dangerous if the driver derefernces it later and it will further block the subsequent ipmi operations. So, to fix it up, we need to nullify 'cur_msg' in the error case. Signed-off-by: Neelesh Gupta --- drivers/char/ipmi/ipmi_powernv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/char/ipmi/ipmi_powernv.c b/drivers/char/ipmi/ipmi_powernv.c index 9b409c0..08dd38f 100644 --- a/drivers/char/ipmi/ipmi_powernv.c +++ b/drivers/char/ipmi/ipmi_powernv.c @@ -143,6 +143,7 @@ static int ipmi_powernv_recv(struct ipmi_smi_powernv *smi) pr_devel("%s: -> %d (size %lld)\n", __func__, rc, rc == 0 ? size : 0); if (rc) { + smi->cur_msg = NULL; spin_unlock_irqrestore(&smi->msg_lock, flags); ipmi_free_smi_msg(msg); return 0;