All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Aswin Karuvally" <aswin@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, "Vasily Gorbik" <gor@linux.ibm.com>,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	"Heiko Carstens" <hca@linux.ibm.com>
Subject: Re: [PATCH net] s390/qeth: Check CAP_NET_ADMIN for private ioctls
Date: Fri, 24 Jul 2026 14:01:14 +0000	[thread overview]
Message-ID: <20260724140115.2523F1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260723140050.762991-1-aswin@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] An integer underflow in the buffer size check allows privileged users to cause a kernel heap buffer overflow.
--

--- Patch [1]: [PATCH net] s390/qeth: Check CAP_NET_ADMIN for private ioctls ---
commit 3ec90fe5fb86d5d8d0432c2487ad687ef4d3e227
Author: Aswin Karuvally <aswin@linux.ibm.com>

s390/qeth: Check CAP_NET_ADMIN for private ioctls

This commit adds a CAP_NET_ADMIN capability check to the
SIOC_QETH_ADP_SET_SNMP_CONTROL, SIOC_QETH_GET_CARD_TYPE, and
SIOC_QETH_QUERY_OAT private ioctls. This ensures that these commands cannot
be invoked by unprivileged users.

> diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
> index 20fb0d2e02a9a..f18eed9df3c7a 100644
> --- a/drivers/s390/net/qeth_core_main.c
> +++ b/drivers/s390/net/qeth_core_main.c
> @@ -6525,6 +6525,9 @@ int qeth_siocdevprivate(struct net_device *dev, struct ifreq *rq, void __user *d
>  	struct qeth_card *card = dev->ml_priv;
>  	int rc = 0;
>  
> +	if (!capable(CAP_NET_ADMIN))
> +		return -EPERM;
> +
>  	switch (cmd) {
>  	case SIOC_QETH_ADP_SET_SNMP_CONTROL:
>  		rc = qeth_snmp_command(card, data);

[Severity: High]
This is a pre-existing issue, but does qeth_snmp_command() allow an integer
underflow that leads to a heap buffer overflow?

If a user provides a udata_len smaller than sizeof(struct qeth_snmp_ureq_hdr)
(16 bytes), the unsigned subtraction in the callback underflows:

drivers/s390/net/qeth_core_main.c:qeth_snmp_command() {
    ...
	if (get_user(qinfo.udata_len, &ureq->hdr.data_len) ||
    ...
	qinfo.udata = kzalloc(qinfo.udata_len, GFP_KERNEL);
    ...
	qinfo.udata_offset = sizeof(struct qeth_snmp_ureq_hdr);
    ...
}

drivers/s390/net/qeth_core_main.c:qeth_snmp_command_cb() {
    ...
	if ((qinfo->udata_len - qinfo->udata_offset) < data_len) {
    ...
}

The underflow would bypass the available space check, leading to an
out-of-bounds memcpy into the allocated heap buffer.

The same integer underflow pattern appears to exist in qeth_l3_arp_query_cb()
for the SIOC_QETH_ARP_QUERY_INFO ioctl.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260723140050.762991-1-aswin@linux.ibm.com?part=1

  reply	other threads:[~2026-07-24 14:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23 14:00 [PATCH net] s390/qeth: Check CAP_NET_ADMIN for private ioctls Aswin Karuvally
2026-07-24 14:01 ` sashiko-bot [this message]
2026-07-28  1:06 ` Jakub Kicinski
2026-07-28 10:50   ` Aswin Karuvally
2026-07-28  1:10 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260724140115.2523F1F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=aswin@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.