Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Mon, 19 Feb 2001 11:41:05 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Mon, 19 Feb 2001 11:40:56 -0500 Received: from [62.172.234.2] ([62.172.234.2]:36269 "EHLO localhost.localdomain") by vger.kernel.org with ESMTP id ; Mon, 19 Feb 2001 11:40:49 -0500 Date: Mon, 19 Feb 2001 16:39:45 +0000 (GMT) From: Hugh Dickins To: Linus Torvalds cc: Alan Cox , Manfred Spraul , Christoph Rohland , Tigran Aivazian , linux-kernel@vger.kernel.org Subject: [PATCH] sys_semop() EIDRM BUG fix Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org sys_semop() is wrong to insist that queue.status be -EIDRM when sem_lock() fails on awakening. It is quite normal for update_queue() to have set status 0, removed process from queue and woken it; but IPC_RMID come in before that process gets to run (or to lock) - since process already off queue, its status is not set to -EIDRM. If we want a safety check here, check removed from queue instead. Return original status or -EIDRM? Checked other OSes, use -EIDRM. diff -urN linux-2.4.2-pre4/ipc/sem.c linux/ipc/sem.c --- linux-2.4.2-pre4/ipc/sem.c Sat Feb 17 11:14:27 2001 +++ linux/ipc/sem.c Sun Feb 18 08:21:37 2001 @@ -922,7 +922,7 @@ tmp = sem_lock(semid); if(tmp==NULL) { - if(queue.status != -EIDRM) + if(queue.prev != NULL) BUG(); current->semsleeping = NULL; error = -EIDRM; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/