Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Alexandra Winter <wintera@linux.ibm.com>
To: sashiko-reviews@lists.linux.dev, Bryam Vargas <hexlabsecurity@proton.me>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	linux-s390@vger.kernel.org,
	Hidayath Khan <hidayath@linux.ibm.com>
Subject: Re: [PATCH net] net/iucv: take a reference on the socket found in afiucv_hs_rcv()
Date: Thu, 9 Jul 2026 19:17:44 +0200	[thread overview]
Message-ID: <b524ae17-9fe5-4270-bb8d-3e411ef683e5@linux.ibm.com> (raw)
In-Reply-To: <20260707032441.B1FB31F00A3A@smtp.kernel.org>



On 07.07.26 05:24, sashiko-bot@kernel.org wrote:
> [Severity: High]
> This is a pre-existing issue, but does modifying the socket state from a
> softirq context corrupt the socket state machine?
> 
> Since this handler runs in softirq context when network packets arrive, it
> acquires the socket spinlock and directly mutates sk->sk_state. 
> 
> If a user process is concurrently executing a system call and holds the socket
> mutex via lock_sock(), does bypassing the backlog mechanism by failing to check
> sock_owned_by_user() cause race conditions?
> 
> [ ... ]
> 
>> @@ -2089,6 +2089,8 @@ static int afiucv_hs_rcv(struct sk_buff *skb, struct net_device *dev,
>>  			}
>>  		}
>>  	}
>> +	if (sk)
>> +		sock_hold(sk);
>>  	read_unlock(&iucv_sk_list.lock);
>>  	if (!iucv)
>>  		sk = NULL;
>> @@ -2138,6 +2140,8 @@ static int afiucv_hs_rcv(struct sk_buff *skb, struct net_device *dev,
>>  		kfree_skb(skb);
>>  	}
>>  
>> +	if (sk)
>> +		sock_put(sk);
>>  	return err;
>>  }


I think sashiko is right, this patch does not completely close the gap.
See my commit message for
f558120cd709 ("net/iucv: fix use after free in iucv_sock_close()")
Iiuc the socket locking in AF_IUCV is incomplete in general.

Bryam, would you like to try to update the socket locking in AF_IUCV altogether?
Otherwise Hidayath or I can take that task.

  reply	other threads:[~2026-07-09 17:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06  3:24 [PATCH net] net/iucv: take a reference on the socket found in afiucv_hs_rcv() Bryam Vargas via B4 Relay
2026-07-07  3:24 ` sashiko-bot
2026-07-09 17:17   ` Alexandra Winter [this message]
2026-07-08 16:06 ` Hidayathulla Khan I
2026-07-08 16:45 ` Hidayathulla Khan I
2026-07-10 14:30 ` 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=b524ae17-9fe5-4270-bb8d-3e411ef683e5@linux.ibm.com \
    --to=wintera@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=hexlabsecurity@proton.me \
    --cc=hidayath@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox