]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
net: ipa: fix atomic update in ipa_endpoint_replenish()
authorAlex Elder <elder@linaro.org>
Wed, 12 Jan 2022 13:30:10 +0000 (07:30 -0600)
committerPaolo Pisati <paolo.pisati@canonical.com>
Fri, 28 Jan 2022 10:03:35 +0000 (11:03 +0100)
commitf1566df76aa74218d8b3e2ec7dd4e73afd0ac21a
tree40dcda415ac383cef57338f1832efe7f37e27a68
parent763672b77e6264794e266cc632940bff179c7f29
net: ipa: fix atomic update in ipa_endpoint_replenish()

BugLink: https://bugs.launchpad.net/bugs/1959376
commit 6c0e3b5ce94947b311348c367db9e11dcb2ccc93 upstream.

In ipa_endpoint_replenish(), if an error occurs when attempting to
replenish a receive buffer, we just quit and try again later.  In
that case we increment the backlog count to reflect that the attempt
was unsuccessful.  Then, if the add_one flag was true we increment
the backlog again.

This second increment is not included in the backlog local variable
though, and its value determines whether delayed work should be
scheduled.  This is a bug.

Fix this by determining whether 1 or 2 should be added to the
backlog before adding it in a atomic_add_return() call.

Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Fixes: 84f9bd12d46db ("soc: qcom: ipa: IPA endpoints")
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/net/ipa/ipa_endpoint.c