From patchwork Fri Dec 11 23:42:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Youquan Song X-Patchwork-Id: 66712 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nBBG5YUQ027197 for ; Fri, 11 Dec 2009 16:07:05 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933558AbZLKQG5 (ORCPT ); Fri, 11 Dec 2009 11:06:57 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933527AbZLKQG5 (ORCPT ); Fri, 11 Dec 2009 11:06:57 -0500 Received: from mga07.intel.com ([143.182.124.22]:62758 "EHLO azsmga101.ch.intel.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933136AbZLKQGz (ORCPT ); Fri, 11 Dec 2009 11:06:55 -0500 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 11 Dec 2009 08:07:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.47,316,1257148800"; d="scan'208";a="221616542" Received: from youquan-linux.bj.intel.com (HELO localhost) ([172.16.182.102]) by azsmga001.ch.intel.com with ESMTP; 11 Dec 2009 08:07:00 -0800 Date: Fri, 11 Dec 2009 18:42:35 -0500 From: "Youquan,Song" To: jbarnes@virtuousgeek.org Cc: andi@firstfloor.org, ying.huang@intel.com, kent.liu@intel.com, youquan.song@intel.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH]PCIe AER: fix aer inject result in kernel oops Message-ID: <20091211234235.GA7196@youquan-linux.bj.intel.com> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.9i Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c index 62d15f6..ad77f0c 100644 --- a/drivers/pci/pcie/aer/aer_inject.c +++ b/drivers/pci/pcie/aer/aer_inject.c @@ -392,8 +392,14 @@ static int aer_inject(struct aer_error_inj *einj) if (ret) goto out_put; - if (find_aer_device(rpdev, &edev)) + if (find_aer_device(rpdev, &edev)) { + if (!get_service_data(edev)) { + printk(KERN_WARNING "AER service is not initialized\n"); + ret = -EINVAL; + goto out_put; + } aer_irq(-1, edev); + } else ret = -EINVAL; out_put: