Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp31776741rwd; Fri, 7 Jul 2023 04:25:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlH2/fWOLIomtYgMMB3ECZMr0NnjTBGORIWibbKH4eC5Z5r2ZefmUi1g/BB6+J37YZSPTwPK X-Received: by 2002:a17:90a:4e0f:b0:262:d1b8:5d43 with SMTP id n15-20020a17090a4e0f00b00262d1b85d43mr7256185pjh.22.1688729106781; Fri, 07 Jul 2023 04:25:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688729106; cv=none; d=google.com; s=arc-20160816; b=EMgXXVmWpsvd9xPfazWQqmUc41feZsl36iwr6ujJn8r5chYIYyclM4Fzo0mApSmcrv QGSwJodQGOJ8Ot0U+hZEeV5RQzlhEJOvuslX8jiEjatOFrGMiFLrfQe8/VGpsK/57VR3 v0EKe9kgil0dsSLrETJInRF++2/gCS1Ez2TmPYULRq45psipOLTxouOhVb6O0Fv81WcU XNSJsMtpAaztEAQByxiHPbqiYSdiDa+NLe9rcmKvGlRt0597p5p05k/VTJ/ub6VVZBEZ t+yXN9ekkIQ7L9u0LwmDybeBH9Qr/BJxKrrbOLknnWvIqeJ0TCnDZLgXqLc8Zq0kXErc Fy1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=EpRAyCO+/Pk6iS660rd4amRtT5eCYg13goVm7Mo2YQo=; fh=7Z04KAePUyWEJ/78A+O1wx8QoHrWm+N/Sivr1tnYc8M=; b=vM4NNtVvQsEKoTqImklRfdWG/Dgznz2FnqEqFaM9CjykCoz+u6LuhIb00KGI3IKfGG yXvrdWBaMkKqm+EWsqmJezWisviPlml1kojwGKCydZ3yOqAFMULydzl4ma5X3MSVHIZl sYaX5T5XhoqNSaDp0djb9P2WeF4dCJvxsCgpfCGk5PyzglhJa+uodmteh/eQHdCFINbz Smk7KWah0PXV2rlOd2jr7g/1zynQdUUWlmJ00lTMcItpA7dyZ3IeuDtbhumih7axv6w8 nZanUKtxjcQMNg4HRbmYV8bAxG7vJvYkrYRTEoPMGgviFDmU2ENyrZSd4cuaAj2KoKNP O6tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Z2PLjzy0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v15-20020a63150f000000b0054fd947f66dsi3551950pgl.210.2023.07.07.04.24.52; Fri, 07 Jul 2023 04:25:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Z2PLjzy0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232282AbjGGLIk (ORCPT + 99 others); Fri, 7 Jul 2023 07:08:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232066AbjGGLIh (ORCPT ); Fri, 7 Jul 2023 07:08:37 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 890891FEC; Fri, 7 Jul 2023 04:08:29 -0700 (PDT) Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 367B2baS014186; Fri, 7 Jul 2023 11:08:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : content-transfer-encoding : mime-version; s=pp1; bh=EpRAyCO+/Pk6iS660rd4amRtT5eCYg13goVm7Mo2YQo=; b=Z2PLjzy0G6o9nlrt3Bedgr5Yr/DY9M2bLwH1A7TWQUYj8XceYWz/JQObc8cjHlQ1v5xf ly4N2kfWPZjHitiiISOrsUNOJPPL8rqJjRBeJ2AcvIeoNmcQzq1+JuJg0kwZaR0FU33v bZFMpXhe9kn2GX1EtE9HGOS7oUABG/90/GW+nUeNVeKcVJeLteOAzE+DdRN4x/dOQMlh 39oWLNSfkqzhKXJx7DcbK+0+r7lW3GZG4V7HaB8LWfgqxp0ffjgtszsDDXNpDIn6mUwM Dovo+yIm/yvbzCBos3JWOk0br2VBnFa/+p5QodvtnOFdQqdgjwTGpnbbiZE6WJa557X5 9A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rphg204kg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Jul 2023 11:08:27 +0000 Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 367B2noU014621; Fri, 7 Jul 2023 11:08:27 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rphg204hc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Jul 2023 11:08:26 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3676glVl002157; Fri, 7 Jul 2023 11:08:24 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma06ams.nl.ibm.com (PPS) with ESMTPS id 3rjbde3y1b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Jul 2023 11:08:24 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 367B8Lqw22872678 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 7 Jul 2023 11:08:21 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 15BC420040; Fri, 7 Jul 2023 11:08:21 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CAAA720043; Fri, 7 Jul 2023 11:08:19 +0000 (GMT) Received: from [9.171.85.13] (unknown [9.171.85.13]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 7 Jul 2023 11:08:19 +0000 (GMT) Message-ID: Subject: Re: [PATCH net v2 1/3] s390/ism: Fix locking for forwarding of IRQs and events to clients From: Niklas Schnelle To: Paolo Abeni , Alexandra Winter , Wenjia Zhang , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , "David S. Miller" , Stefan Raspl , Jan Karcher Cc: linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 07 Jul 2023 13:08:19 +0200 In-Reply-To: <20230707104359.3324039-2-schnelle@linux.ibm.com> References: <20230707104359.3324039-1-schnelle@linux.ibm.com> <20230707104359.3324039-2-schnelle@linux.ibm.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 6yeKUNSurNLmTJfZNPfWvRpBMbmbFGL3 X-Proofpoint-GUID: CkC9CItBgXrDNoe-JubZFDYbv_FYElhc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-07_06,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 phishscore=0 mlxlogscore=444 adultscore=0 priorityscore=1501 spamscore=0 suspectscore=0 mlxscore=0 impostorscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307070102 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2023-07-07 at 12:43 +0200, Niklas Schnelle wrote: > The clients array references all registered clients and is protected by > the clients_lock. Besides its use as general list of clients the clients > array is accessed in ism_handle_irq() to forward ISM device events to > clients. >=20 > While the clients_lock is taken in the IRQ handler when calling > handle_event() it is however incorrectly not held during the > client->handle_irq() call and for the preceding clients[] access leaving > it unprotected against concurrent client (un-)registration. >=20 > Furthermore the accesses to ism->sba_client_arr[] in ism_register_dmb() > and ism_unregister_dmb() are not protected by any lock. This is > especially problematic as the client ID from the ism->sba_client_arr[] > is not checked against NO_CLIENT and neither is the client pointer > checked. >=20 > Instead of expanding the use of the clients_lock further add a separate > array in struct ism_dev which references clients subscribed to the > device's events and IRQs. This array is protected by ism->lock which is > already taken in ism_handle_irq() and can be taken outside the IRQ > handler when adding/removing subscribers or the accessing > ism->sba_client_arr[]. This also means that the clients_lock is no > longer taken in IRQ context. >=20 > Fixes: 89e7d2ba61b7 ("net/ism: Add new API for client registration") > Signed-off-by: Niklas Schnelle > --- Sorry for the mess. My get_maintainers.pl to-cmd setup in git send- email stumbled over the cover letter and so the cover letter was not sent to the right people/lists messing up the "in-reply-to" references. So I had to resend it. Thanks Niklas