Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp475602lqd; Wed, 24 Apr 2024 08:00:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXVYOtbBuEHjCVJTAitH7i2T1s+I7/O9Zqm7itTWE5xErbFFDuIarOzPygYDvBpeJ72hsw+FR4+flbvEch0G6WlycOLrJuyd8wk8RXu4w== X-Google-Smtp-Source: AGHT+IE9W+8F/MUkla3ro2Fjn+hIJodOTkb5VnxlRkmxUUiCMjvEDUlbfUvndToJiIGeRVieHBiP X-Received: by 2002:a17:90a:f40e:b0:2a7:b6ee:2ed0 with SMTP id ch14-20020a17090af40e00b002a7b6ee2ed0mr2293560pjb.7.1713970801506; Wed, 24 Apr 2024 08:00:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713970801; cv=pass; d=google.com; s=arc-20160816; b=CkDosDinHedx030gfJkDe42znt5PXUvkviwWkMANJMnqGxnCR3Fbtg9k7czPc5e2o2 CMyaeKscXYMILxNvY1+tc7qHfIVFQWHoKA9ErQIfv2c1t5L4HqefqAtXIi/9gWVDzo8r v848ZREo+XV/ewWK/EQwonzR6fZ/xRL7TXBedZCkRYry/s9dkvdE6vPV7tZvZWrCdUhT VnhZ8hfWjEclqRyqnv39ecrpHskgc3SXDBvy/SXV7C4dMYFdciywtHRYukDBPOS8dNdR xHo7uLFdqCvNVrTGQzBkHQjwns1R6PWEPvxOm0AZO49Enb3dtxbgAnbejGK2/u/sJoMx F2jw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=faPLB+kw4kVxRvk/awmxuWyqP9LFnkCQP2eMceG1XuI=; fh=T+ws2F8EOizaOYx0tPCD1jXs4cikHs/YcOjR7A9PN8E=; b=xceANUuHA5HzxU3yJjNLSHGW+x6xerHP+Xu4pOQApr7GxRn/h/Zp7CDplJJpoyP6Dt k2oYir9oYgqOHxW92MJ68XdG9nnC44HVBQw/dreiuVJXAf6GqONGTlS7qO7wgLFBqXOC 0YQ4LJbIcV677VsKgxcXftZhEXWgN9l3Rdd35eOaRI7jWt8m0i9MkPl6pwX5zL6VwcS+ rfATiov6tDAZhOIz4zeHIpakk23oDXJev2YbLUuXbgRsnTSM5xano4cBJBFyAl9VBMqB P0jXq+FA9focEB/+tpq/chiy0522pY6SJd18i3HvqR42PVICfbq25RO4SXXv2LIfUkD+ 82Tg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=YcDLjFHr; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-157140-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157140-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y21-20020a17090a8b1500b002a50b056bdasi13143965pjn.109.2024.04.24.08.00.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 08:00:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-157140-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=YcDLjFHr; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-157140-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157140-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BE58828D3A4 for ; Wed, 24 Apr 2024 14:55:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 99B9C16131C; Wed, 24 Apr 2024 14:54:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="YcDLjFHr" Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BD8D15F3F8; Wed, 24 Apr 2024 14:54:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713970474; cv=none; b=VS3IvO32DEjGmhkP9+dk7AXsQrMG/KjwSv8e4svXh969eI7rUC4CXY/qqUoGbhBuq0JEX0HRn3iP1OfxFlU1aVXiiGjyotTyB5HgQ+z7FFpM1YKcW++rOtGKusz8AVUg8BZoyx4+WjsWa9Msrt4AfG8yeOnljb542BjG+43vAdo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713970474; c=relaxed/simple; bh=Vke2PRjMOaaDnifLzd+g5rbY2VteuyFJwC55RRx62rU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kxm8vi40fIsu7o4RWnF2AJDSl4IS5TEVNHm/pmf7QkFFBxLRkph+mCWZtUOmW2gp6Nza16ALwc3n38z4XgE3rjTtwJYkKcHv7f27ZS68snL3hdf+9JJ1P8S3g9SQz4wkwk3YPRaITJh9ibPT/Gdt8eBpEebJGsy4Qvw8w4aN0hc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=YcDLjFHr; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43OEphXU021642; Wed, 24 Apr 2024 14:54:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=pp1; bh=faPLB+kw4kVxRvk/awmxuWyqP9LFnkCQP2eMceG1XuI=; b=YcDLjFHr2K+Ys/y15mRL/i5XlzBdFtq5rcBbzgelkmuX+/sL3KIqMraFZybJfrfhTwPF 7u7AHXycbmDG4D34xnfCR2DgOJGnNXA6qXu/y49qQVifXoEmuLv+cB606ogd5otL2rJ9 CTlExfmUkla6534BoaeqwMQQDsnlvT/bOAD7WgZx+KBlUmYtxke/Fcj80Tr0c2pYkQbG 0n18GAE8iMvexUAP3WiRGGe+SFc37h3Z8yQYk/jURhsf8SEK9VznS3OvZ6/jfObjQcJL sLBr5o0nJ8SLB7BDMIKoDPPsbH33nCyutt1MZIgWr5TXXskwRS7DOVKmLMvhLe1x+8vY nA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3xq1mjrcgs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Apr 2024 14:54:17 +0000 Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 43OEsGYx027087; Wed, 24 Apr 2024 14:54:16 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3xq1mjrcgj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Apr 2024 14:54:16 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 43OC0rH5015277; Wed, 24 Apr 2024 14:54:15 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3xmshmc1tt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Apr 2024 14:54:15 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 43OEs9Kw44761424 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 Apr 2024 14:54:11 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4449D2004B; Wed, 24 Apr 2024 14:54:09 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 23A4B20040; Wed, 24 Apr 2024 14:54:07 +0000 (GMT) Received: from osiris (unknown [9.171.4.217]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTPS; Wed, 24 Apr 2024 14:54:07 +0000 (GMT) Date: Wed, 24 Apr 2024 16:54:05 +0200 From: Heiko Carstens To: Bui Quang Minh Cc: Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Paul M Stillwell Jr , Rasesh Mody , Sudarsana Kalluru , GR-Linux-NIC-Dev@marvell.com, Anil Gurumurthy , Sudarsana Kalluru , "James E.J. Bottomley" , "Martin K. Petersen" , Fabian Frederick , Saurav Kashyap , GR-QLogic-Storage-Upstream@marvell.com, Nilesh Javali , Arun Easi , Manish Rangankar , Vineeth Vijayan , Peter Oberparleiter , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Sunil Goutham , Linu Cherian , Geetha sowjanya , Jerin Jacob , hariprasad , Subbaraya Sundeep , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, Saurav Kashyap , linux-s390@vger.kernel.org, Jens Axboe Subject: Re: [PATCH v2 5/6] cio: ensure the copied buf is NUL terminated Message-ID: <20240424145405.26193-C-hca@linux.ibm.com> References: <20240424-fix-oob-read-v2-0-f1f1b53a10f4@gmail.com> <20240424-fix-oob-read-v2-5-f1f1b53a10f4@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240424-fix-oob-read-v2-5-f1f1b53a10f4@gmail.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: P3jauZ9wnPsNqb9Y8f9APW5dRRKdbn4d X-Proofpoint-GUID: bdcVi_JhzGQ_L9LlgnK3IM-pAQHck6Ez X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-04-24_12,2024-04-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxlogscore=863 suspectscore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 spamscore=0 bulkscore=0 clxscore=1011 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404240056 On Wed, Apr 24, 2024 at 09:44:22PM +0700, Bui Quang Minh wrote: > Currently, we allocate a lbuf-sized kernel buffer and copy lbuf from > userspace to that buffer. Later, we use scanf on this buffer but we don't > ensure that the string is terminated inside the buffer, this can lead to > OOB read when using scanf. Fix this issue by using memdup_user_nul instead. > > Fixes: a4f17cc72671 ("s390/cio: add CRW inject functionality") > Signed-off-by: Bui Quang Minh > --- > drivers/s390/cio/cio_inject.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Heiko Carstens