ipmi:ssif: Add check for kstrdup
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Mon, 19 Jun 2023 09:28:02 +0000 (17:28 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:42:44 +0000 (09:42 +0200)
commit2e7d90a81b9cee4103d2c2bb9b6be60fae74806a
tree2ad5800fb5ef90c012dea6adccfbdf43f4b7f767
parentabbd28d04c365708ec4bc700fb442213ee32e0dd
ipmi:ssif: Add check for kstrdup

[ Upstream commit c5586d0f711e9744d0cade39b0c4a2d116a333ca ]

Add check for the return value of kstrdup() and return the error
if it fails in order to avoid NULL pointer dereference.

Fixes: c4436c9149c5 ("ipmi_ssif: avoid registering duplicate ssif interface")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Message-Id: <20230619092802.35384-1-jiasheng@iscas.ac.cn>
Signed-off-by: Corey Minyard <minyard@acm.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/char/ipmi/ipmi_ssif.c