mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-05 19:31:57 -04:00
sock: Correct error checking condition for (assign|release)_proto_idx()
[ Upstream commit faeefc173be40512341b102cf1568aa0b6571acd ] (assign|release)_proto_idx() wrongly check find_first_zero_bit() failure by condition '(prot->inuse_idx == PROTO_INUSE_NR - 1)' obviously. Fix by correcting the condition to '(prot->inuse_idx == PROTO_INUSE_NR)' Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com> Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com> Link: https://patch.msgid.link/20250410-fix_net-v2-1-d69e7c5739a4@quicinc.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
ac7bfaa099
commit
7e372262cd
1 changed files with 2 additions and 2 deletions
|
|
@ -3370,7 +3370,7 @@ static int assign_proto_idx(struct proto *prot)
|
|||
{
|
||||
prot->inuse_idx = find_first_zero_bit(proto_inuse_idx, PROTO_INUSE_NR);
|
||||
|
||||
if (unlikely(prot->inuse_idx == PROTO_INUSE_NR - 1)) {
|
||||
if (unlikely(prot->inuse_idx == PROTO_INUSE_NR)) {
|
||||
pr_err("PROTO_INUSE_NR exhausted\n");
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
|
@ -3381,7 +3381,7 @@ static int assign_proto_idx(struct proto *prot)
|
|||
|
||||
static void release_proto_idx(struct proto *prot)
|
||||
{
|
||||
if (prot->inuse_idx != PROTO_INUSE_NR - 1)
|
||||
if (prot->inuse_idx != PROTO_INUSE_NR)
|
||||
clear_bit(prot->inuse_idx, proto_inuse_idx);
|
||||
}
|
||||
#else
|
||||
|
|
|
|||
Loading…
Reference in a new issue