Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp490488lqd; Wed, 24 Apr 2024 08:17:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVjx29eYftOoO7MWeLY3bMTJ/YnjVUtFZGHOBtZJnYJ80z+a2X4k9ImiC/KZeqiX7tRoUjBlkqyo4O+12sIFcE6BB33PiYCpGXgvqdC1Q== X-Google-Smtp-Source: AGHT+IGG4xttoBUTf+066vre5vepAhIIOLzfDC9LD3tZqLhxY1Y5/m0ap4ZP1GjFM4WN8oi6FOsU X-Received: by 2002:a5d:510e:0:b0:33e:dbc0:773 with SMTP id s14-20020a5d510e000000b0033edbc00773mr2061861wrt.44.1713971866739; Wed, 24 Apr 2024 08:17:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713971866; cv=pass; d=google.com; s=arc-20160816; b=LX/OxcqG7wavPWHpL4xN94RKXovEmh1zns9hRa4RAt9OrdQN6liu1es+HrKqPmR6tE OAneK43jOb87lp8PAxxBKdH0S5lk//QQOR752y9fJTVjLcuwLTo6JR0CW3YctJJH3W58 uNhdy++3gaq5bMBYy1IYDVbupAKAsj1s0uIeMfZ2wxw5l/iCPmLhg0URuo5ejSYlbUKT /x1mVXr9NsT8/VOGWVLdFaxvXaZ6lfyHCEWSpxSmebqAOl7uLkY2Y+sskyqn0+HHgq08 m76g5aR+wiILnXCuHTwYVfHM8jo/mP3YMW7KunCFLV55tUBl12dkU0yr4lN+xc7Plrjj zMXQ== 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=LRXZigEswTP7y+kxZAU4wvy9qxPw5anZoKBCkQwQ0VQ=; fh=lBgI+/z/4iz/EjDg2+ru0xFlEfEbCHRXG/D+687u+XE=; b=asEJStcb2IT8VSdcytGS29LSsV7YdcL6/kWF8eeZgrudzTpnZpCnkEWCKZSBqaMwn2 ZjmfsJsZHz45RZGYVlRL570n1S77nha7e0oB7YSn0hC7FK5wn9TlvWbEbBgLo46K7XOI l3yffEeY3qiOm4+apurwLvBzFDkEVwhKYyo0CXTQ9HXGBSJ+d0S5BBgNKXBp+L9oNPEy k47bkutgj+GMhtk1YVm8ArKk3ndu/0bZ7CuzFfdHGquco00irPvwrrbDH3i+gvUl7TPG BSkrHUIaoggtis740ermMKrKU2YIfKznjDe2chE9LP8eMFqBqRAWi9Lvw9YN9h9WAaja wSsg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=jcO+Had0; 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-157176-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157176-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id lu15-20020a170906facf00b00a55b58c2f8bsi4150133ejb.473.2024.04.24.08.17.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 08:17:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-157176-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=jcO+Had0; 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-157176-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157176-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 70D011F22E2A for ; Wed, 24 Apr 2024 15:17:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3FF5815FA71; Wed, 24 Apr 2024 15:17:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="jcO+Had0" 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 410C315EFC2; Wed, 24 Apr 2024 15:17:16 +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=1713971838; cv=none; b=SNEHZ5AYwJS3UtO2/8Vli/pNQW705XloWEYzT2wQmTmUTRFKxO3w7O8kz19a5BWcfjxKuHtsiwJSWQ1Cbi+gqCEGkHUQltaJA+Cy2FKiFGu9+R4kT9IlDrHRg/xPA7sZs5dARwdi468E6BeMHLk5bVyNw54glvi6WHBxA+HEZuI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713971838; c=relaxed/simple; bh=lxUuics4jmlqF3JSO6RqVRtlVjf5w9O3L4++yNBHbuE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=t2YNXpSLCyKSrIV4v9z4sFSB9vuZuYvDtcKH7JBuWhCkL19bpmxtt3oDTpnqcGjzkt2PLoE3IoR+UKirJCxv0lj4gt+71yRdVSdbPI3GjSs3slKi+BzA2C7RJd3oOw8wTgKmslcVl+Jx3neEXUQhICWRHTX7/dP7YLHd0S4pLk8= 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=jcO+Had0; 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 (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43OEvP0q032428; Wed, 24 Apr 2024 15:17:05 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=LRXZigEswTP7y+kxZAU4wvy9qxPw5anZoKBCkQwQ0VQ=; b=jcO+Had0aSg52rZjlhEaia1uEq0IAOPidGvLK3ScMBO1iM2O9dpLxgdeiGZ1EU59bfil y5ZiP3JKZbUHYXoV5/EbsA9QHzFiHOxznQEQa1+yRMo1JjdMmsnAu7UsIHRnBvU8Vj+Q nzIaegcCM7US4b15+hGy2iFLTVx2jtQEJWW5HkPNLlGuU1K7q3qP8zkyrKIa1/bQxhGd vNSLIpahPzDfeQZTiEO9sRzTxhrMd3i8X59qGNBc7Sfjvm+55EK69kqDKtSIz5oaIm8x P03VgAi8NBw7tJ7TAyc3zNr9SQEXLYcFwyrpRS4cZtVir0/TVa1D0VE59tj1RjWXkGUU gg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3xq49x01h2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Apr 2024 15:17:04 +0000 Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 43OFH3Ut032269; Wed, 24 Apr 2024 15:17:04 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 3xq49x01gs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Apr 2024 15:17:03 +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 43OCad22015430; Wed, 24 Apr 2024 15:17:02 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3xmshmc5aa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Apr 2024 15:17:02 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 43OFGuq732375212 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 Apr 2024 15:16:58 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4CEC520040; Wed, 24 Apr 2024 15:16:56 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9F3D32004D; Wed, 24 Apr 2024 15:16:55 +0000 (GMT) Received: from li-008a6a4c-3549-11b2-a85c-c5cc2836eea2.ibm.com (unknown [9.155.204.135]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTPS; Wed, 24 Apr 2024 15:16:55 +0000 (GMT) Date: Wed, 24 Apr 2024 17:16:54 +0200 From: Alexander Gordeev 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 , Heiko Carstens , Vasily Gorbik , 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: 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-GUID: fZkGofveKPRbJZUl0Si2IEFY5soD-mFd X-Proofpoint-ORIG-GUID: JvjdeUHiZLMhgcceAmf2eHuewusCBopA 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 adultscore=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 mlxscore=0 spamscore=0 suspectscore=0 mlxlogscore=892 phishscore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404240059 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(-) Applied, thanks!