Skip to content

Commit 239a7dc

Browse files
Mike ChristieJames Bottomley
authored andcommitted
[SCSI] iscsi_transport: Check iscsi interface skb allocation return value
Let's not oops when we cannot allocate a skb! Add a check for if alloc_skb fails. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1 parent 5c9cfed commit 239a7dc

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

drivers/scsi/scsi_transport_iscsi.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -609,12 +609,10 @@ iscsi_if_send_reply(int pid, int seq, int type, int done, int multi,
609609
int t = done ? NLMSG_DONE : type;
610610

611611
skb = alloc_skb(len, GFP_ATOMIC);
612-
/*
613-
* FIXME:
614-
* user is supposed to react on iferror == -ENOMEM;
615-
* see iscsi_if_rx().
616-
*/
617-
BUG_ON(!skb);
612+
if (!skb) {
613+
printk(KERN_ERR "Could not allocate skb to send reply.\n");
614+
return -ENOMEM;
615+
}
618616

619617
nlh = __nlmsg_put(skb, pid, seq, t, (len - sizeof(*nlh)), 0);
620618
nlh->nlmsg_flags = flags;

0 commit comments

Comments
 (0)