LKML Archive on lore.kernel.org help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com> To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Cc: Ralph Wuerthner <rwuerthn@de.ibm.com>, Martin Schwidefsky <schwidefsky@de.ibm.com> Subject: [patch 07/10] zcrypt: fix ap_device_list handling Date: Wed, 05 Mar 2008 12:54:39 +0100 [thread overview] Message-ID: <20080305115714.450809645@de.ibm.com> (raw) In-Reply-To: 20080305115432.691030908@de.ibm.com [-- Attachment #1: 007-crypto-probe.diff --] [-- Type: text/plain, Size: 1623 bytes --] From: Ralph Wuerthner <rwuerthn@de.ibm.com> In ap_device_probe() we can add the new ap device to the internal device list only if the device probe function successfully returns. Otherwise we might end up with an invalid device in the internal ap device list. Signed-off-by: Ralph Wuerthner <rwuerthn@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> --- drivers/s390/crypto/ap_bus.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) Index: quilt-2.6/drivers/s390/crypto/ap_bus.c =================================================================== --- quilt-2.6.orig/drivers/s390/crypto/ap_bus.c +++ quilt-2.6/drivers/s390/crypto/ap_bus.c @@ -490,10 +490,12 @@ static int ap_device_probe(struct device int rc; ap_dev->drv = ap_drv; - spin_lock_bh(&ap_device_lock); - list_add(&ap_dev->list, &ap_device_list); - spin_unlock_bh(&ap_device_lock); rc = ap_drv->probe ? ap_drv->probe(ap_dev) : -ENODEV; + if (!rc) { + spin_lock_bh(&ap_device_lock); + list_add(&ap_dev->list, &ap_device_list); + spin_unlock_bh(&ap_device_lock); + } return rc; } @@ -532,11 +534,11 @@ static int ap_device_remove(struct devic ap_flush_queue(ap_dev); del_timer_sync(&ap_dev->timeout); - if (ap_drv->remove) - ap_drv->remove(ap_dev); spin_lock_bh(&ap_device_lock); list_del_init(&ap_dev->list); spin_unlock_bh(&ap_device_lock); + if (ap_drv->remove) + ap_drv->remove(ap_dev); spin_lock_bh(&ap_dev->lock); atomic_sub(ap_dev->queue_count, &ap_poll_requests); spin_unlock_bh(&ap_dev->lock); -- blue skies, Martin. "Reality continues to ruin my life." - Calvin.
next prev parent reply other threads:[~2008-03-05 11:58 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-03-05 11:54 [patch 00/10] s390 bux fixes for 2.6.25-rc4 Martin Schwidefsky 2008-03-05 11:54 ` [patch 01/10] Update default configuration Martin Schwidefsky 2008-03-05 11:54 ` [patch 02/10] idle: Fix machine check handling in idle loop Martin Schwidefsky 2008-03-05 11:54 ` [patch 03/10] Get rid of memcpy gcc warning workaround Martin Schwidefsky 2008-03-05 11:54 ` [patch 04/10] dasd: let dasd erp matching recognize alias recovery Martin Schwidefsky 2008-03-05 11:54 ` [patch 05/10] dasd: fix reference counting in display method for proc/dasd/devices Martin Schwidefsky 2008-03-05 11:54 ` [patch 06/10] sclp_vt220: speed up console output for interactive work Martin Schwidefsky 2008-03-05 11:54 ` Martin Schwidefsky [this message] 2008-03-05 11:54 ` [patch 08/10] Fix IPL from NSS Martin Schwidefsky 2008-03-05 11:54 ` [patch 09/10] Load disabled wait psw if reipl fails Martin Schwidefsky 2008-03-05 11:54 ` [patch 10/10] incorrect reipl nss name Martin Schwidefsky
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080305115714.450809645@de.ibm.com \ --to=schwidefsky@de.ibm.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-s390@vger.kernel.org \ --cc=rwuerthn@de.ibm.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).