From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BD4843F8CB for ; Thu, 30 Jul 2026 16:15:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785428106; cv=none; b=JeVpjsDBbJQAMcZs9i3NMSCvhtxAwS2WOCTV5AsTsV9yrvXikmZE9TXI7yQ6MeMwuAjRez9Y8tYoszNDgBFTiBD6KS3vsvrjLjoK7zmaaQ1Ai54BMiEPKxwvJyEbkBlm1jr89iAXVCOM8Gey3oX2iGrVL8eULBTCIKT16Onw2gU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785428106; c=relaxed/simple; bh=Prrq3lRrNtjBMcFNoLT6vy0bmYe4ExXeIRC0llIkt7s=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=V62tkykvD+KCRSxoa7EMI9KZbCO9NFRY1o5porjeMgAN0NFqL7hQuu/1YnNyoB9mohYu/e4a4o+j21dzI8T5mfW9lcWCnZutYSo0VSJqePOl0aKmevdJtGfS9J3W4SV+ov9JjiZBGlifnG3jJlek/qvu+NGCxNTh54fIuPqMREw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dama.to; spf=none smtp.mailfrom=dama.to; dkim=pass (2048-bit key) header.d=dama-to.20251104.gappssmtp.com header.i=@dama-to.20251104.gappssmtp.com header.b=aD1x7KZO; arc=none smtp.client-ip=209.85.216.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dama.to Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=dama.to Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dama-to.20251104.gappssmtp.com header.i=@dama-to.20251104.gappssmtp.com header.b="aD1x7KZO" Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-381216921aaso62103a91.1 for ; Thu, 30 Jul 2026 09:15:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dama-to.20251104.gappssmtp.com; s=20251104; t=1785428104; x=1786032904; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=sc7/PIL5nmBZuTJI/qyxnyFN7S+kHFcyfHQ2vtF45hE=; b=aD1x7KZOof0CcjkO3K2mWdjMAAFm27fqdl7lL9hKPfT7nYI/samOcztz60bwQqvTPE wFyQsC7b70zbV5K6ObSxMVMDfwqRXrBLb+8MozDJ/MVkPH7qUbhzdEAUYxKLYSGqxLMA 5coRJy5pRS4vLsXDunzwN4PDIYvKWsQaMEE4QtGTOtlUDa9ijQJETS4xUHaQJh42o1+1 q31yDnWZcszUH53+AQZNb9dPr94O6Qmme1jJDcEh4rAaH8Sn3X/Peq6mLw+6bFRTYFCN aE5yGr82pAMRs/cmeZkd42a4dpwg2XgrW0bhcBbOM8re1S7ktPRrEAFLhrYcnD/FtP/f WbkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785428104; x=1786032904; h=in-reply-to:content-disposition:content-type:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=sc7/PIL5nmBZuTJI/qyxnyFN7S+kHFcyfHQ2vtF45hE=; b=LKFvRMffqS/EayfFdRjMWwOYTjeruPA2gKUkHkMFfYejeX3kDsVVtJPY+73fe7tuqR Dm2obDa6O7weGF4ym7RmZ/bNanw4jpCDSB9TGy883uZJetB1Jvb+Wbsnsse1Cef/164V wez6Ki5ej4/nr42f6oT8NiKFc2TBiqNCRB6rNMQXSPEifJgFv6v+DPQNTuTX/IdYhdIn S+YGwiogpdad0bSrh8XGV3GgifQi5XT8auFNLOlLLhkuZyizDBFcCEkh7ASY0ebGiPIO Keoq2J0beOMIdfMaP3C07GOF77FsGIzfg9f+/NuDpVzE0r9+s30RgGiC12rlxP6gSyGF MXFA== X-Forwarded-Encrypted: i=1; AHgh+RpRdOcGyzVKNJHSPCRBdCdJodXu6RLcrFgjnIty72UmnilMwUMtG4UIYaKQL2O9NXwPzKgTqHQ4pn3P4AQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxNnBSkIFa+hixLFcpLQewsPjhZKpSdUhMvmclqoNAfa9TXZ2ZV 2/jvMzq03eMSodMs7ROps1Jlo4J+Pw9WLb3EmfmTJhWrSLLo0u6nPUUMuycgVO6R1Do= X-Gm-Gg: AR+sD11xducJLBdbPo3hD822vAE0hyZKl0ImMP1FgIPB/1DipsyM6vWTJ+hgQdzkc2l tPZ9TEBzlPJr4NH6CBsYvmp3iBgjQ1+mp6BgbW3+R7cgEFektiUCCgFoP+w/QsRuA0dk0dBZ3Vt WUkNlB288i345c9rVgvBGkCGneSvLfe++kLQNC+RtqdamHmsy7DL1aVwiRiRhHxVydKi1HZY3Rn rzT7NlPtDl9TjofhnVpZHnKrLORjlPmanvJmu1IEDCaW+0kIwI/LwpxygCWzghUmle68ofaGewC ErFRpUdRgwUtHjrTuRnsOdg93HVzxC8BjX6toGTaRh7vQsVdBZGMpMDRnWTl5x3Fkl1/D/UnPUz PFVA2Iu58cYYVJNWk2J10UX88ZoC0VUrt9Xi1vvO/hon6hJbyjx9XA1woRfDzis+0NJy8ndJ5c4 MjDQAESxwu3JKHSdUl5PAi/7kArwnTSbMvBJMR6B6Ib4P07N1LAGkN X-Received: by 2002:a17:90b:582c:b0:38e:57a3:f218 with SMTP id 98e67ed59e1d1-38f9bdd2f2dmr2888847a91.13.1785428103654; Thu, 30 Jul 2026 09:15:03 -0700 (PDT) Received: from localhost ([2a03:2880:2ff:48::]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38faba8491esm4092a91.2.2026.07.30.09.15.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jul 2026 09:15:02 -0700 (PDT) Date: Thu, 30 Jul 2026 09:15:02 -0700 From: Joe Damato To: Hidayath Khan Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, wintera@linux.ibm.com, aswin@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, borntraeger@linux.ibm.com, svens@linux.ibm.com, horms@kernel.org, netdev@vger.kernel.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH net] s390/qeth: validate user buffer length in SNMP and ARP query ioctls Message-ID: Mail-Followup-To: Joe Damato , Hidayath Khan , davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, wintera@linux.ibm.com, aswin@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, borntraeger@linux.ibm.com, svens@linux.ibm.com, horms@kernel.org, netdev@vger.kernel.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20260730142216.218309-1-hidayath@linux.ibm.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: <20260730142216.218309-1-hidayath@linux.ibm.com> On Thu, Jul 30, 2026 at 04:22:16PM +0200, Hidayath Khan wrote: > qeth_snmp_command() and qeth_l3_arp_query() allocate a buffer sized by > a user-supplied length (udata_len) without checking a lower bound, then > set udata_offset to a fixed non-zero value and pass both to a reply > callback. The callback bounds-checks the copy with > > if ((udata_len - udata_offset) < len) > > Both fields are u32, so a udata_len smaller than udata_offset makes the > subtraction wrap and the check pass, and the following memcpy() writes > past the allocation. A udata_len of 0 also yields ZERO_SIZE_PTR from > kzalloc(), which the existing NULL check does not catch. > > Reject buffers smaller than udata_offset before allocating, so the > callback subtraction can no longer underflow. > > Fixes: 4a71df50047f ("qeth: new qeth device driver") > Cc: stable@vger.kernel.org > Reviewed-by: Alexandra Winter > Signed-off-by: Hidayath Khan > --- > drivers/s390/net/qeth_core_main.c | 3 +++ > drivers/s390/net/qeth_l3_main.c | 5 +++++ > 2 files changed, 8 insertions(+) Reviewed-by: Joe Damato