]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usb-storage: alauda: Check whether the media is initialized
authorShichao Lai <shichaorai@gmail.com>
Sun, 26 May 2024 01:27:45 +0000 (09:27 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Jun 2024 12:40:39 +0000 (14:40 +0200)
commit24bff7f714bdff97c2a75a0ff6a368cdf8ad5af4
tree346e0f82173112f41fcbff396a78b6716c7a9964
parent0367dc153c06f4c7dfaa76c7e3465b3a920acc46
usb-storage: alauda: Check whether the media is initialized

[ Upstream commit 16637fea001ab3c8df528a8995b3211906165a30 ]

The member "uzonesize" of struct alauda_info will remain 0
if alauda_init_media() fails, potentially causing divide errors
in alauda_read_data() and alauda_write_lba().
- Add a member "media_initialized" to struct alauda_info.
- Change a condition in alauda_check_media() to ensure the
  first initialization.
- Add an error check for the return value of alauda_init_media().

Fixes: e80b0fade09e ("[PATCH] USB Storage: add alauda support")
Reported-by: xingwei lee <xrivendell7@gmail.com>
Reported-by: yue sun <samsun1006219@gmail.com>
Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Shichao Lai <shichaorai@gmail.com>
Link: https://lore.kernel.org/r/20240526012745.2852061-1-shichaorai@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/storage/alauda.c