The patch titled
Subject: mm: teach mincore_hugetlb about pte markers
has been added to the -mm mm-hotfixes-unstable branch. Its filename is
mm-teach-mincore_hugetlb-about-pte-markers.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patche…
This patch will later appear in the mm-hotfixes-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: James Houghton <jthoughton(a)google.com>
Subject: mm: teach mincore_hugetlb about pte markers
Date: Thu, 2 Mar 2023 22:24:04 +0000
By checking huge_pte_none(), we incorrectly classify PTE markers as
"present". Instead, check huge_pte_none_mostly(), classifying PTE markers
the same as if the PTE were completely blank.
PTE markers, unlike other kinds of swap entries, don't reference any
physical page and don't indicate that a physical page was mapped
previously. As such, treat them as non-present for the sake of mincore().
Link: https://lkml.kernel.org/r/20230302222404.175303-1-jthoughton@google.com
Fixes: 5c041f5d1f23 ("mm: teach core mm about pte markers")
Signed-off-by: James Houghton <jthoughton(a)google.com>
Acked-by: Peter Xu <peterx(a)redhat.com>
Cc: Axel Rasmussen <axelrasmussen(a)google.com>
Cc: David Hildenbrand <david(a)redhat.com>
Cc: James Houghton <jthoughton(a)google.com>
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
---
--- a/mm/mincore.c~mm-teach-mincore_hugetlb-about-pte-markers
+++ a/mm/mincore.c
@@ -33,7 +33,7 @@ static int mincore_hugetlb(pte_t *pte, u
* Hugepages under user process are always in RAM and never
* swapped out, but theoretically it needs to be checked.
*/
- present = pte && !huge_pte_none(huge_ptep_get(pte));
+ present = pte && !huge_pte_none_mostly(huge_ptep_get(pte));
for (; addr != end; vec++, addr += PAGE_SIZE)
*vec = present;
walk->private = vec;
_
Patches currently in -mm which might be from jthoughton(a)google.com are
mm-teach-mincore_hugetlb-about-pte-markers.patch
This is the start of the stable review cycle for the 6.2.2 release.
There are 16 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Fri, 03 Mar 2023 18:06:43 +0000.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.2.2-rc1.…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.2.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 6.2.2-rc1
Alan Stern <stern(a)rowland.harvard.edu>
USB: core: Don't hold device lock while reading the "descriptors" sysfs file
Saranya Gopal <saranya.gopal(a)intel.com>
usb: typec: pd: Remove usb_suspend_supported sysfs from sink PDO
Kunihiko Hayashi <hayashi.kunihiko(a)socionext.com>
arm64: dts: uniphier: Fix property name in PXs3 USB node
Prashanth K <quic_prashk(a)quicinc.com>
usb: gadget: u_serial: Add null pointer check in gserial_resume
Florian Zumbiehl <florz(a)florz.de>
USB: serial: option: add support for VW/Skoda "Carstick LTE"
Heikki Krogerus <heikki.krogerus(a)linux.intel.com>
usb: dwc3: pci: add support for the Intel Meteor Lake-M
Sascha Hauer <s.hauer(a)pengutronix.de>
wifi: rtw88: usb: drop now unnecessary URB size check
Sascha Hauer <s.hauer(a)pengutronix.de>
wifi: rtw88: usb: send Zero length packets if necessary
Sascha Hauer <s.hauer(a)pengutronix.de>
wifi: rtw88: usb: Set qsel correctly
Carlos Llamas <cmllamas(a)google.com>
scripts/tags.sh: fix incompatibility with PCRE2
Stylon Wang <stylon.wang(a)amd.com>
drm/amd/display: Properly reuse completion structure
Nicholas Kazlauskas <nicholas.kazlauskas(a)amd.com>
drm/amd/display: Move DCN314 DOMAIN power control to DMCUB
Thomas Weißschuh <linux(a)weissschuh.net>
vc_screen: don't clobber return value in vcs_read
Martin KaFai Lau <martin.lau(a)kernel.org>
bpf: bpf_fib_lookup should not return neigh in NUD_FAILED state
Herbert Xu <herbert(a)gondor.apana.org.au>
crypto: arm64/sm4-gcm - Fix possible crash in GCM cryption
Vitaly Rodionov <vitalyr(a)opensource.cirrus.com>
ALSA: hda: cs35l41: Correct error condition handling
-------------
Diffstat:
Makefile | 4 +-
.../dts/socionext/uniphier-pxs3-ref-gadget0.dts | 2 +-
.../dts/socionext/uniphier-pxs3-ref-gadget1.dts | 2 +-
arch/arm64/crypto/sm4-ce-gcm-glue.c | 51 +++++++++++-----------
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++
.../gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.c | 24 ++++++++++
.../gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.h | 2 +
.../gpu/drm/amd/display/dc/dcn314/dcn314_init.c | 2 +-
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 25 +++++++++++
drivers/net/wireless/realtek/rtw88/usb.c | 18 ++------
drivers/tty/vt/vc_screen.c | 7 +--
drivers/usb/core/hub.c | 5 +--
drivers/usb/core/sysfs.c | 5 ---
drivers/usb/dwc3/dwc3-pci.c | 4 ++
drivers/usb/gadget/function/u_serial.c | 23 ++++++++--
drivers/usb/serial/option.c | 4 ++
drivers/usb/typec/pd.c | 1 -
net/core/filter.c | 4 +-
scripts/tags.sh | 2 +-
sound/pci/hda/hda_cs_dsp_ctl.c | 4 +-
20 files changed, 125 insertions(+), 67 deletions(-)
This is the start of the stable review cycle for the 5.10.171 release.
There are 19 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Fri, 03 Mar 2023 18:06:43 +0000.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.171-r…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 5.10.171-rc1
Alan Stern <stern(a)rowland.harvard.edu>
USB: core: Don't hold device lock while reading the "descriptors" sysfs file
Prashanth K <quic_prashk(a)quicinc.com>
usb: gadget: u_serial: Add null pointer check in gserial_resume
Florian Zumbiehl <florz(a)florz.de>
USB: serial: option: add support for VW/Skoda "Carstick LTE"
Dmitry Osipenko <dmitry.osipenko(a)collabora.com>
drm/virtio: Correct drm_gem_shmem_get_sg_table() error handling
Miaoqian Lin <linmq006(a)gmail.com>
drm/virtio: Fix NULL vs IS_ERR checking in virtio_gpu_object_shmem_init
Carlos Llamas <cmllamas(a)google.com>
scripts/tags.sh: fix incompatibility with PCRE2
Cristian Ciocaltea <cristian.ciocaltea(a)collabora.com>
scripts/tags.sh: Invoke 'realpath' via 'xargs'
David Sloan <david.sloan(a)eideticom.com>
md: Flush workqueue md_rdev_misc_wq in md_alloc()
Thomas Weißschuh <linux(a)weissschuh.net>
vc_screen: don't clobber return value in vcs_read
Kuniyuki Iwashima <kuniyu(a)amazon.com>
net: Remove WARN_ON_ONCE(sk->sk_forward_alloc) from sk_stream_kill_queues().
Martin KaFai Lau <martin.lau(a)kernel.org>
bpf: bpf_fib_lookup should not return neigh in NUD_FAILED state
Xin Zhao <xnzhao(a)google.com>
HID: core: Fix deadloop in hid_apply_multiplier.
Julian Anastasov <ja(a)ssi.bg>
neigh: make sure used and confirmed times are valid
Dean Luick <dean.luick(a)cornelisnetworks.com>
IB/hfi1: Assign npages earlier
David Sterba <dsterba(a)suse.com>
btrfs: send: limit number of clones and allocated memory size
Vishal Verma <vishal.l.verma(a)intel.com>
ACPI: NFIT: fix a potential deadlock during NFIT teardown
Johan Jonker <jbx6244(a)gmail.com>
ARM: dts: rockchip: add power-domains property to dp node on rk3288
Krzysztof Kozlowski <krzysztof.kozlowski(a)linaro.org>
arm64: dts: rockchip: drop unused LED mode property from rk3328-roc-cc
Benedict Wong <benedictwong(a)google.com>
Fix XFRM-I support for nested ESP tunnels
-------------
Diffstat:
Makefile | 4 +-
arch/arm/boot/dts/rk3288.dtsi | 1 +
arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 2 -
drivers/acpi/nfit/core.c | 2 +-
drivers/gpu/drm/virtio/virtgpu_object.c | 5 ++-
drivers/hid/hid-core.c | 3 ++
drivers/infiniband/hw/hfi1/user_exp_rcv.c | 9 +----
drivers/md/md.c | 1 +
drivers/tty/vt/vc_screen.c | 7 ++--
drivers/usb/core/hub.c | 5 +--
drivers/usb/core/sysfs.c | 5 ---
drivers/usb/gadget/function/u_serial.c | 23 +++++++++--
drivers/usb/serial/option.c | 4 ++
fs/btrfs/send.c | 6 +--
net/caif/caif_socket.c | 1 +
net/core/filter.c | 4 +-
net/core/neighbour.c | 18 +++++++--
net/core/stream.c | 1 -
net/xfrm/xfrm_interface.c | 54 ++++++++++++++++++++++++--
net/xfrm/xfrm_policy.c | 3 ++
scripts/tags.sh | 11 ++++--
21 files changed, 123 insertions(+), 46 deletions(-)
This is the start of the stable review cycle for the 5.4.234 release.
There are 13 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Fri, 03 Mar 2023 18:06:43 +0000.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.234-rc…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 5.4.234-rc1
Alan Stern <stern(a)rowland.harvard.edu>
USB: core: Don't hold device lock while reading the "descriptors" sysfs file
Florian Zumbiehl <florz(a)florz.de>
USB: serial: option: add support for VW/Skoda "Carstick LTE"
Jiasheng Jiang <jiasheng(a)iscas.ac.cn>
dmaengine: sh: rcar-dmac: Check for error num after dma_set_max_seg_size
Thomas Weißschuh <linux(a)weissschuh.net>
vc_screen: don't clobber return value in vcs_read
Kuniyuki Iwashima <kuniyu(a)amazon.com>
net: Remove WARN_ON_ONCE(sk->sk_forward_alloc) from sk_stream_kill_queues().
Martin KaFai Lau <martin.lau(a)kernel.org>
bpf: bpf_fib_lookup should not return neigh in NUD_FAILED state
Xin Zhao <xnzhao(a)google.com>
HID: core: Fix deadloop in hid_apply_multiplier.
Julian Anastasov <ja(a)ssi.bg>
neigh: make sure used and confirmed times are valid
Dean Luick <dean.luick(a)cornelisnetworks.com>
IB/hfi1: Assign npages earlier
David Sterba <dsterba(a)suse.com>
btrfs: send: limit number of clones and allocated memory size
Vishal Verma <vishal.l.verma(a)intel.com>
ACPI: NFIT: fix a potential deadlock during NFIT teardown
Johan Jonker <jbx6244(a)gmail.com>
ARM: dts: rockchip: add power-domains property to dp node on rk3288
Krzysztof Kozlowski <krzysztof.kozlowski(a)linaro.org>
arm64: dts: rockchip: drop unused LED mode property from rk3328-roc-cc
-------------
Diffstat:
Makefile | 4 ++--
arch/arm/boot/dts/rk3288.dtsi | 1 +
arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 2 --
drivers/acpi/nfit/core.c | 2 +-
drivers/dma/sh/rcar-dmac.c | 5 ++++-
drivers/hid/hid-core.c | 3 +++
drivers/infiniband/hw/hfi1/user_exp_rcv.c | 9 ++-------
drivers/tty/vt/vc_screen.c | 7 ++++---
drivers/usb/core/hub.c | 5 ++---
drivers/usb/core/sysfs.c | 5 -----
drivers/usb/serial/option.c | 4 ++++
fs/btrfs/send.c | 6 +++---
net/caif/caif_socket.c | 1 +
net/core/filter.c | 4 ++--
net/core/neighbour.c | 18 +++++++++++++++---
net/core/stream.c | 1 -
16 files changed, 44 insertions(+), 33 deletions(-)
This is the start of the stable review cycle for the 4.19.275 release.
There are 9 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Fri, 03 Mar 2023 18:06:43 +0000.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.275-r…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.19.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.19.275-rc1
Alan Stern <stern(a)rowland.harvard.edu>
USB: core: Don't hold device lock while reading the "descriptors" sysfs file
Florian Zumbiehl <florz(a)florz.de>
USB: serial: option: add support for VW/Skoda "Carstick LTE"
Jiasheng Jiang <jiasheng(a)iscas.ac.cn>
dmaengine: sh: rcar-dmac: Check for error num after dma_set_max_seg_size
Thomas Weißschuh <linux(a)weissschuh.net>
vc_screen: don't clobber return value in vcs_read
Kuniyuki Iwashima <kuniyu(a)amazon.com>
net: Remove WARN_ON_ONCE(sk->sk_forward_alloc) from sk_stream_kill_queues().
Dean Luick <dean.luick(a)cornelisnetworks.com>
IB/hfi1: Assign npages earlier
David Sterba <dsterba(a)suse.com>
btrfs: send: limit number of clones and allocated memory size
Vishal Verma <vishal.l.verma(a)intel.com>
ACPI: NFIT: fix a potential deadlock during NFIT teardown
Johan Jonker <jbx6244(a)gmail.com>
ARM: dts: rockchip: add power-domains property to dp node on rk3288
-------------
Diffstat:
Makefile | 4 ++--
arch/arm/boot/dts/rk3288.dtsi | 1 +
drivers/acpi/nfit/core.c | 2 +-
drivers/dma/sh/rcar-dmac.c | 5 ++++-
drivers/infiniband/hw/hfi1/user_exp_rcv.c | 9 ++-------
drivers/tty/vt/vc_screen.c | 7 ++++---
drivers/usb/core/hub.c | 5 ++---
drivers/usb/core/sysfs.c | 5 -----
drivers/usb/serial/option.c | 4 ++++
fs/btrfs/send.c | 6 +++---
net/caif/caif_socket.c | 1 +
net/core/stream.c | 1 -
12 files changed, 24 insertions(+), 26 deletions(-)
From: Alvin Šipraga <alsi(a)bang-olufsen.dk>
In the unbind callback for f_uac1 and f_uac2, a call to snd_card_free()
via g_audio_cleanup() will disconnect the card and then wait for all
resources to be released, which happens when the refcount falls to zero.
Since userspace can keep the refcount incremented by not closing the
relevant file descriptor, the call to unbind may block indefinitely.
This can cause a deadlock during reboot, as evidenced by the following
blocked task observed on my machine:
task:reboot state:D stack:0 pid:2827 ppid:569 flags:0x0000000c
Call trace:
__switch_to+0xc8/0x140
__schedule+0x2f0/0x7c0
schedule+0x60/0xd0
schedule_timeout+0x180/0x1d4
wait_for_completion+0x78/0x180
snd_card_free+0x90/0xa0
g_audio_cleanup+0x2c/0x64
afunc_unbind+0x28/0x60
...
kernel_restart+0x4c/0xac
__do_sys_reboot+0xcc/0x1ec
__arm64_sys_reboot+0x28/0x30
invoke_syscall+0x4c/0x110
...
The issue can also be observed by opening the card with arecord and
then stopping the process through the shell before unbinding:
# arecord -D hw:UAC2Gadget -f S32_LE -c 2 -r 48000 /dev/null
Recording WAVE '/dev/null' : Signed 32 bit Little Endian, Rate 48000 Hz, Stereo
^Z[1]+ Stopped arecord -D hw:UAC2Gadget -f S32_LE -c 2 -r 48000 /dev/null
# echo gadget.0 > /sys/bus/gadget/drivers/configfs-gadget/unbind
(observe that the unbind command never finishes)
Fix the problem by using snd_card_free_when_closed() instead, which will
still disconnect the card as desired, but defer the task of freeing the
resources to the core once userspace closes its file descriptor.
Fixes: 132fcb460839 ("usb: gadget: Add Audio Class 2.0 Driver")
Cc: stable(a)vger.kernel.org
Signed-off-by: Alvin Šipraga <alsi(a)bang-olufsen.dk>
---
drivers/usb/gadget/function/u_audio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c
index c1f62e91b012..4a42574b4a7f 100644
--- a/drivers/usb/gadget/function/u_audio.c
+++ b/drivers/usb/gadget/function/u_audio.c
@@ -1422,7 +1422,7 @@ void g_audio_cleanup(struct g_audio *g_audio)
uac = g_audio->uac;
card = uac->card;
if (card)
- snd_card_free(card);
+ snd_card_free_when_closed(card);
kfree(uac->p_prm.reqs);
kfree(uac->c_prm.reqs);
--
2.39.1
From: Eric Biggers <ebiggers(a)google.com>
Once all I/O using a blk_crypto_key has completed, filesystems can call
blk_crypto_evict_key(). However, the block layer doesn't call
blk_crypto_put_keyslot() until the request is being cleaned up, which
happens after upper layers have been told (via bio_endio()) the I/O has
completed. This causes a race condition where blk_crypto_evict_key()
can see 'slot_refs > 0' without there being an actual bug.
This makes __blk_crypto_evict_key() hit the
'WARN_ON_ONCE(atomic_read(&slot->slot_refs) != 0)' and return without
doing anything, eventually causing a use-after-free in
blk_crypto_reprogram_all_keys(). (This is a very rare bug and has only
been seen when per-file keys are being used with fscrypt.)
There are two options to fix this: either release the keyslot in
blk_update_request() just before bio_endio() is called on the request's
last bio, or just make __blk_crypto_evict_key() ignore slot_refs. Let's
go with the latter solution for now, since it avoids adding overhead to
the loop in blk_update_request(). (It does have the disadvantage that
hypothetical bugs where a key is evicted while still in-use become
harder to detect. But so far there haven't been any such bugs anyway.)
A related issue with __blk_crypto_evict_key() is that ->keyslot_evict
failing would cause the same use-after-free as well. Fix this by always
removing the key from the keyslot management structures.
Update the function documentation to properly document the semantics.
Fixes: 1b2628397058 ("block: Keyslot Manager for Inline Encryption")
Cc: stable(a)vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers(a)google.com>
---
block/blk-crypto-profile.c | 52 +++++++++++++++-----------------------
block/blk-crypto.c | 24 +++++++++++-------
2 files changed, 36 insertions(+), 40 deletions(-)
diff --git a/block/blk-crypto-profile.c b/block/blk-crypto-profile.c
index 0307fb0d95d3..29b4148cc50d 100644
--- a/block/blk-crypto-profile.c
+++ b/block/blk-crypto-profile.c
@@ -354,22 +354,11 @@ bool __blk_crypto_cfg_supported(struct blk_crypto_profile *profile,
return true;
}
-/**
- * __blk_crypto_evict_key() - Evict a key from a device.
- * @profile: the crypto profile of the device
- * @key: the key to evict. It must not still be used in any I/O.
- *
- * If the device has keyslots, this finds the keyslot (if any) that contains the
- * specified key and calls the driver's keyslot_evict function to evict it.
- *
- * Otherwise, this just calls the driver's keyslot_evict function if it is
- * implemented, passing just the key (without any particular keyslot). This
- * allows layered devices to evict the key from their underlying devices.
- *
- * Context: Process context. Takes and releases profile->lock.
- * Return: 0 on success or if there's no keyslot with the specified key, -EBUSY
- * if the keyslot is still in use, or another -errno value on other
- * error.
+/*
+ * This is an internal function that evicts a key from an inline encryption
+ * device that can be either a real device or the blk-crypto-fallback "device".
+ * It is used only for blk_crypto_evict_key(). For details on what this does,
+ * see the documentation for blk_crypto_evict_key().
*/
int __blk_crypto_evict_key(struct blk_crypto_profile *profile,
const struct blk_crypto_key *key)
@@ -389,22 +378,23 @@ int __blk_crypto_evict_key(struct blk_crypto_profile *profile,
blk_crypto_hw_enter(profile);
slot = blk_crypto_find_keyslot(profile, key);
- if (!slot)
- goto out_unlock;
-
- if (WARN_ON_ONCE(atomic_read(&slot->slot_refs) != 0)) {
- err = -EBUSY;
- goto out_unlock;
+ if (slot) {
+ /*
+ * Note: it is a bug if the key is still in use by I/O here.
+ * But 'slot_refs > 0' can't be used to detect such bugs here,
+ * since the keyslot isn't released until after upper layers
+ * have already been told the I/O is complete.
+ */
+ err = profile->ll_ops.keyslot_evict(
+ profile, key, blk_crypto_keyslot_index(slot));
+ /*
+ * Even on ->keyslot_evict failure, we must remove the
+ * blk_crypto_key from the keyslot management structures, since
+ * the caller is allowed to free it regardless.
+ */
+ hlist_del(&slot->hash_node);
+ slot->key = NULL;
}
- err = profile->ll_ops.keyslot_evict(profile, key,
- blk_crypto_keyslot_index(slot));
- if (err)
- goto out_unlock;
-
- hlist_del(&slot->hash_node);
- slot->key = NULL;
- err = 0;
-out_unlock:
blk_crypto_hw_exit(profile);
return err;
}
diff --git a/block/blk-crypto.c b/block/blk-crypto.c
index 45378586151f..3dcbe578beb2 100644
--- a/block/blk-crypto.c
+++ b/block/blk-crypto.c
@@ -399,17 +399,23 @@ int blk_crypto_start_using_key(struct block_device *bdev,
}
/**
- * blk_crypto_evict_key() - Evict a key from any inline encryption hardware
- * it may have been programmed into
- * @bdev: The block_device who's associated inline encryption hardware this key
- * might have been programmed into
- * @key: The key to evict
+ * blk_crypto_evict_key() - Evict a blk_crypto_key from a block_device
+ * @bdev: a block_device on which I/O using the key may have been done
+ * @key: the key to evict
*
- * Upper layers (filesystems) must call this function to ensure that a key is
- * evicted from any hardware that it might have been programmed into. The key
- * must not be in use by any in-flight IO when this function is called.
+ * For a given block_device, this function removes the given blk_crypto_key from
+ * the keyslot management structures and evicts it from any underlying hardware
+ * or fallback keyslot(s) it may have been programmed into.
*
- * Return: 0 on success or if the key wasn't in any keyslot; -errno on error.
+ * Upper layers must call this before freeing the blk_crypto_key. It must be
+ * called for every block_device the key may have been used on. The key must no
+ * longer be in use by any I/O when this function is called.
+ *
+ * Context: May sleep.
+ * Return: 0 on success or if the key wasn't in any keyslot; -errno if the key
+ * failed to be evicted from a hardware keyslot. Even in the -errno
+ * case, the key is removed from the keyslot management structures and
+ * the caller is allowed (and expected) to free the blk_crypto_key.
*/
int blk_crypto_evict_key(struct block_device *bdev,
const struct blk_crypto_key *key)
base-commit: 489fa31ea873282b41046d412ec741f93946fc2d
--
2.39.2
The WinSystems WS16C48 I/O address region spans offsets 0x0 through 0xA,
which is a total of 11 bytes. Fix the WS16C48_EXTENT define to the
correct value of 11 so that access to necessary device registers is
properly requested in the ws16c48_probe() callback by the
devm_request_region() function call.
Fixes: 2c05a0f29f41 ("gpio: ws16c48: Implement and utilize register structures")
Cc: Paul Demetrotion <pdemetrotion(a)winsystems.com>
Signed-off-by: William Breathitt Gray <william.gray(a)linaro.org>
---
drivers/gpio/gpio-ws16c48.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-ws16c48.c b/drivers/gpio/gpio-ws16c48.c
index e73885a4dc32..afb42a8e916f 100644
--- a/drivers/gpio/gpio-ws16c48.c
+++ b/drivers/gpio/gpio-ws16c48.c
@@ -18,7 +18,7 @@
#include <linux/spinlock.h>
#include <linux/types.h>
-#define WS16C48_EXTENT 10
+#define WS16C48_EXTENT 11
#define MAX_NUM_WS16C48 max_num_isa_dev(WS16C48_EXTENT)
static unsigned int base[MAX_NUM_WS16C48];
base-commit: 4827aae061337251bb91801b316157a78b845ec7
--
2.39.2
Make sure to clear the transfer buffer before fetching the EDID to
avoid leaking slab data to the logs on errors that leave the buffer
unchanged.
Fixes: 69c7717c20cc ("drm/edid: Dump the EDID when drm_edid_get_panel_id() has an error")
Cc: stable(a)vger.kernel.org # 6.2
Cc: Douglas Anderson <dianders(a)chromium.org>
Signed-off-by: Johan Hovold <johan+linaro(a)kernel.org>
---
drivers/gpu/drm/drm_edid.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 3841aba17abd..8707fe72a028 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2797,7 +2797,7 @@ u32 drm_edid_get_panel_id(struct i2c_adapter *adapter)
* the EDID then we'll just return 0.
*/
- base_block = kmalloc(EDID_LENGTH, GFP_KERNEL);
+ base_block = kzalloc(EDID_LENGTH, GFP_KERNEL);
if (!base_block)
return 0;
--
2.39.2
The following commit has been merged into the irq/urgent branch of tip:
Commit-ID: 0fb7fb713461e44b12e72c292bf90ee300f40710
Gitweb: https://git.kernel.org/tip/0fb7fb713461e44b12e72c292bf90ee300f40710
Author: Thomas Gleixner <tglx(a)linutronix.de>
AuthorDate: Wed, 01 Mar 2023 22:07:48 +01:00
Committer: Thomas Gleixner <tglx(a)linutronix.de>
CommitterDate: Thu, 02 Mar 2023 18:09:44 +01:00
genirq/msi, platform-msi: Ensure that MSI descriptors are unreferenced
Miquel reported a warning in the MSI core which is triggered when
interrupts are freed via platform_msi_device_domain_free().
This code got reworked to use core functions for freeing the MSI
descriptors, but nothing took care to clear the msi_desc->irq entry, which
then triggers the warning in msi_free_msi_desc() which uses desc->irq to
validate that the descriptor has been torn down. The same issue exists in
msi_domain_populate_irqs().
Up to the point that msi_free_msi_descs() grew a warning for this case,
this went un-noticed.
Provide the counterpart of msi_domain_populate_irqs() and invoke it in
platform_msi_device_domain_free() before freeing the interrupts and MSI
descriptors and also in the error path of msi_domain_populate_irqs().
Fixes: 2f2940d16823 ("genirq/msi: Remove filter from msi_free_descs_free_range()")
Reported-by: Miquel Raynal <miquel.raynal(a)bootlin.com>
Signed-off-by: Thomas Gleixner <tglx(a)linutronix.de>
Tested-by: Miquel Raynal <miquel.raynal(a)bootlin.com>
Cc: stable(a)vger.kernel.org
Link: https://lore.kernel.org/r/87mt4wkwnv.ffs@tglx
---
drivers/base/platform-msi.c | 1 +
include/linux/msi.h | 2 ++
kernel/irq/msi.c | 23 ++++++++++++++++++++++-
3 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/drivers/base/platform-msi.c b/drivers/base/platform-msi.c
index 5883e76..f37ad34 100644
--- a/drivers/base/platform-msi.c
+++ b/drivers/base/platform-msi.c
@@ -324,6 +324,7 @@ void platform_msi_device_domain_free(struct irq_domain *domain, unsigned int vir
struct platform_msi_priv_data *data = domain->host_data;
msi_lock_descs(data->dev);
+ msi_domain_depopulate_descs(data->dev, virq, nr_irqs);
irq_domain_free_irqs_common(domain, virq, nr_irqs);
msi_free_msi_descs_range(data->dev, virq, virq + nr_irqs - 1);
msi_unlock_descs(data->dev);
diff --git a/include/linux/msi.h b/include/linux/msi.h
index a112b91..15dd718 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -631,6 +631,8 @@ int msi_domain_prepare_irqs(struct irq_domain *domain, struct device *dev,
int nvec, msi_alloc_info_t *args);
int msi_domain_populate_irqs(struct irq_domain *domain, struct device *dev,
int virq, int nvec, msi_alloc_info_t *args);
+void msi_domain_depopulate_descs(struct device *dev, int virq, int nvec);
+
struct irq_domain *
__platform_msi_create_device_domain(struct device *dev,
unsigned int nvec,
diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
index efd21b7..d169ee0 100644
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -1109,14 +1109,35 @@ int msi_domain_populate_irqs(struct irq_domain *domain, struct device *dev,
return 0;
fail:
- for (--virq; virq >= virq_base; virq--)
+ for (--virq; virq >= virq_base; virq--) {
+ msi_domain_depopulate_descs(dev, virq, 1);
irq_domain_free_irqs_common(domain, virq, 1);
+ }
msi_domain_free_descs(dev, &ctrl);
unlock:
msi_unlock_descs(dev);
return ret;
}
+void msi_domain_depopulate_descs(struct device *dev, int virq_base, int nvec)
+{
+ struct msi_ctrl ctrl = {
+ .domid = MSI_DEFAULT_DOMAIN,
+ .first = virq_base,
+ .last = virq_base + nvec - 1,
+ };
+ struct msi_desc *desc;
+ struct xarray *xa;
+ unsigned long idx;
+
+ if (!msi_ctrl_valid(dev, &ctrl))
+ return;
+
+ xa = &dev->msi.data->__domains[ctrl.domid].store;
+ xa_for_each_range(xa, idx, desc, ctrl.first, ctrl.last)
+ desc->irq = 0;
+}
+
/*
* Carefully check whether the device can use reservation mode. If
* reservation mode is enabled then the early activation will assign a